Skip to content

Commit

Permalink
delete deprecated force pull flag
Browse files Browse the repository at this point in the history
update bash and zsh

remove --force-pull
  • Loading branch information
guangxuli committed Mar 28, 2017
1 parent 427ef53 commit 2816855
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 37 deletions.
3 changes: 0 additions & 3 deletions cmd/s2i/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,6 @@ $ s2i build . centos/ruby-22-centos7 hello-world-app
fmt.Fprintln(os.Stderr, "ERROR: Incremental build with runtime image isn't supported")
os.Exit(1)
}
if cfg.ForcePull {
glog.Warning("DEPRECATED: The '--force-pull' option is deprecated. Use '--pull-policy' instead")
}
//set default image pull policy
if len(cfg.BuilderPullPolicy) == 0 {
cfg.BuilderPullPolicy = api.DefaultBuilderPullPolicy
Expand Down
6 changes: 0 additions & 6 deletions contrib/completions/bash/s2i
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ _s2i_build()
local_nonpersistent_flags+=("--environment-file=")
flags+=("--exclude=")
local_nonpersistent_flags+=("--exclude=")
flags+=("--force-pull")
local_nonpersistent_flags+=("--force-pull")
flags+=("--ignore-submodules")
local_nonpersistent_flags+=("--ignore-submodules")
flags+=("--incremental")
Expand Down Expand Up @@ -396,8 +394,6 @@ _s2i_rebuild()
local_nonpersistent_flags+=("--destination=")
flags+=("--dockercfg-path=")
local_nonpersistent_flags+=("--dockercfg-path=")
flags+=("--force-pull")
local_nonpersistent_flags+=("--force-pull")
flags+=("--incremental")
local_nonpersistent_flags+=("--incremental")
flags+=("--incremental-pull-policy=")
Expand Down Expand Up @@ -446,8 +442,6 @@ _s2i_usage()
local_nonpersistent_flags+=("--destination=")
flags+=("--dockercfg-path=")
local_nonpersistent_flags+=("--dockercfg-path=")
flags+=("--force-pull")
local_nonpersistent_flags+=("--force-pull")
flags+=("--incremental")
local_nonpersistent_flags+=("--incremental")
flags+=("--incremental-pull-policy=")
Expand Down
6 changes: 0 additions & 6 deletions contrib/completions/zsh/s2i
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,6 @@ _s2i_build()
local_nonpersistent_flags+=("--environment-file=")
flags+=("--exclude=")
local_nonpersistent_flags+=("--exclude=")
flags+=("--force-pull")
local_nonpersistent_flags+=("--force-pull")
flags+=("--ignore-submodules")
local_nonpersistent_flags+=("--ignore-submodules")
flags+=("--incremental")
Expand Down Expand Up @@ -557,8 +555,6 @@ _s2i_rebuild()
local_nonpersistent_flags+=("--destination=")
flags+=("--dockercfg-path=")
local_nonpersistent_flags+=("--dockercfg-path=")
flags+=("--force-pull")
local_nonpersistent_flags+=("--force-pull")
flags+=("--incremental")
local_nonpersistent_flags+=("--incremental")
flags+=("--incremental-pull-policy=")
Expand Down Expand Up @@ -607,8 +603,6 @@ _s2i_usage()
local_nonpersistent_flags+=("--destination=")
flags+=("--dockercfg-path=")
local_nonpersistent_flags+=("--dockercfg-path=")
flags+=("--force-pull")
local_nonpersistent_flags+=("--force-pull")
flags+=("--incremental")
local_nonpersistent_flags+=("--incremental")
flags+=("--incremental-pull-policy=")
Expand Down
2 changes: 1 addition & 1 deletion hack/test-stirunimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ check_result $? "${WORK_DIR}/s2i-non-repo.log"
test_debug "s2i rebuild"
s2i build https://github.com/openshift/sti-php.git --context-dir=5.5/test/test-app registry.access.redhat.com/openshift3/php-55-rhel7 rack-test-app --incremental=true --loglevel=5 &> "${WORK_DIR}/s2i-pre-rebuild.log"
check_result $? "${WORK_DIR}/s2i-pre-rebuild.log"
s2i rebuild rack-test-app:latest rack-test-app:v1 --force-pull=false -p never --loglevel=5 &> "${WORK_DIR}/s2i-rebuild.log"
s2i rebuild rack-test-app:latest rack-test-app:v1 -p never --loglevel=5 &> "${WORK_DIR}/s2i-rebuild.log"
check_result $? "${WORK_DIR}/s2i-rebuild.log"

test_debug "s2i usage"
Expand Down
6 changes: 0 additions & 6 deletions pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,6 @@ type Config struct {
// when doing incremental build
PreviousImagePullPolicy PullPolicy

// ForcePull defines if the builder image should be always pulled or not.
// This is now deprecated by BuilderPullPolicy and will be removed soon.
// Setting this to 'true' equals setting BuilderPullPolicy to 'PullAlways'.
// Setting this to 'false' equals setting BuilderPullPolicy to 'PullIfNotPresent'
ForcePull bool

// Incremental describes whether to try to perform incremental build.
Incremental bool

Expand Down
2 changes: 1 addition & 1 deletion pkg/build/strategies/sti/sti.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ func (builder *STI) Exists(config *api.Config) bool {
tag := firstNonEmpty(config.IncrementalFromTag, config.Tag)

startTime := time.Now()
result, err := dockerpkg.PullImage(tag, builder.incrementalDocker, policy, false)
result, err := dockerpkg.PullImage(tag, builder.incrementalDocker, policy)
builder.result.BuildInfo.Stages = api.RecordStageAndStepInfo(builder.result.BuildInfo.Stages, api.StagePullImages, api.StepPullPreviousImage, startTime, time.Now())

if err != nil {
Expand Down
2 changes: 0 additions & 2 deletions pkg/cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ func AddCommonFlags(c *cobra.Command, cfg *api.Config) {
"Remove the previous image during incremental builds")
c.Flags().StringVar(&(cfg.CallbackURL), "callback-url", "",
"Specify a URL to invoke via HTTP POST upon build completion")
c.Flags().BoolVar(&(cfg.ForcePull), "force-pull", false,
"DEPRECATED: Always pull the builder image even if it is present locally")
c.Flags().VarP(&(cfg.BuilderPullPolicy), "pull-policy", "p",
"Specify when to pull the builder image (always, never or if-not-present)")
c.Flags().Var(&(cfg.PreviousImagePullPolicy), "incremental-pull-policy",
Expand Down
18 changes: 6 additions & 12 deletions pkg/docker/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,7 @@ func parseRepositoryTag(repos string) (string, string, string) {

// PullImage pulls the Docker image specified by name taking the pull policy
// into the account.
// TODO: The 'force' option will be removed
func PullImage(name string, d Docker, policy api.PullPolicy, force bool) (*PullResult, error) {
// TODO: Remove this after we deprecate --force-pull
if force {
policy = api.PullAlways
}

func PullImage(name string, d Docker, policy api.PullPolicy) (*PullResult, error) {
if len(policy) == 0 {
return nil, errors.New("the policy for pull image must be set")
}
Expand Down Expand Up @@ -305,8 +299,8 @@ func CheckReachable(config *api.Config) error {
return err
}

func pullAndCheck(image string, docker Docker, pullPolicy api.PullPolicy, config *api.Config, forcePull bool) (*PullResult, error) {
r, err := PullImage(image, docker, pullPolicy, forcePull)
func pullAndCheck(image string, docker Docker, pullPolicy api.PullPolicy, config *api.Config) (*PullResult, error) {
r, err := PullImage(image, docker, pullPolicy)
if err != nil {
return nil, err
}
Expand All @@ -329,7 +323,7 @@ func GetBuilderImage(config *api.Config) (*PullResult, error) {
return nil, err
}

return pullAndCheck(config.BuilderImage, d, config.BuilderPullPolicy, config, config.ForcePull)
return pullAndCheck(config.BuilderImage, d, config.BuilderPullPolicy, config)
}

// GetRebuildImage obtains the metadata information for the image specified in
Expand All @@ -341,13 +335,13 @@ func GetRebuildImage(config *api.Config) (*PullResult, error) {
return nil, err
}

return pullAndCheck(config.Tag, d, config.BuilderPullPolicy, config, config.ForcePull)
return pullAndCheck(config.Tag, d, config.BuilderPullPolicy, config)
}

// GetRuntimeImage processes the config and performs operations necessary to
// make the Docker image specified as RuntimeImage available locally.
func GetRuntimeImage(config *api.Config, docker Docker) error {
_, err := pullAndCheck(config.RuntimeImage, docker, config.RuntimeImagePullPolicy, config, false)
_, err := pullAndCheck(config.RuntimeImage, docker, config.RuntimeImagePullPolicy, config)
return err
}

Expand Down

0 comments on commit 2816855

Please sign in to comment.