Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

run/prepare/fetch: replace --no-store and --store-only with --pull-policy #3554

Merged
merged 1 commit into from
Jan 31, 2017

Conversation

cgonyeo
Copy link
Member

@cgonyeo cgonyeo commented Jan 20, 2017

This replaces the --no-store and --store-only flags with a singular
flag --pull-policy that can accept one of three things, never,
new, and update. This is purely a cli change, there are no under the
hood impacts. --no-store has been aliased to --pull-policy=update
and --store-only has been aliased to --pull-policy=never for
compatibility reasons.

These changes come from a discussion in #2937.

@cgonyeo cgonyeo force-pushed the pull-policy branch 2 times, most recently from b8704b4 to de68eb9 Compare January 23, 2017 23:25
@cgonyeo
Copy link
Member Author

cgonyeo commented Jan 24, 2017

Looking at the semaphore output, only the kvm run through of the tests failed, and the failing tests aren't things I would expect to be impacted by this. Anyone know if this is just flaky tests, or is there a problem with my PR?

@lucab
Copy link
Member

lucab commented Jan 25, 2017

Except for one weird kvm output, I think most other failures are real regressions introduce in this PR. For example, looking at Jenkins output shows several fetch and render failures.

@lucab lucab added this to the v1.24.0 milestone Jan 25, 2017
@cgonyeo cgonyeo force-pushed the pull-policy branch 2 times, most recently from 5059a0a to 487eb2a Compare January 25, 2017 21:30
@cgonyeo
Copy link
Member Author

cgonyeo commented Jan 25, 2017

Looks like things are passing now. The problem appears to have been that the default behavior has changed for rkt fetch. It now defaults to --pull-policy=update, which is equivalent to --no-store, which I believe has different output when it determines that an image doesn't need to be fetched, meaning that the regex's used by the tests weren't matching. I added in a --pull-policy=new to all of the failing tests in the appropriate places, and this appears to have fixed things.

Copy link
Contributor

@s-urbaniak s-urbaniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a nit regarding the deprecation policy, else LGTM.


## General Behavior

The following table describes the meaning of the `--store-only` and `--no-store` flags.
The following table describes the meaning of the `--pull-poloicy` flag.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--pull-policy

This behavior can be changed by using the `--store-only` and `--no-store` flags.
Their meanings are detailed in the [image fetching behavior][img-fetch] documentation.
This behavior can be changed by using the `--pull-policy` flag.
Usage of this flag is details in the [image fetching behavior][img-fetch] documentation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is detailed"?

| `--signature` | `` | A file path | Local signature file to use in validating the preceding image |
| `--store-only` | `false` | `true` or `false` | Use only available images in the store (do not discover or download from remote URLs). See [image fetching behavior][img-fetch] |
| `--pull-policy` | `new` | `never`, `new`, or `update` | Sets the policy for when to fetch an image over the internet. See [image fetching behavior][img-fetch] |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd remove "over the internet" here and below.

@@ -54,6 +57,7 @@ func init() {
cmdFetch.Flags().BoolVar(&flagStoreOnly, "store-only", false, "use only available images in the store (do not discover or download from remote URLs)")
cmdFetch.Flags().BoolVar(&flagNoStore, "no-store", false, "fetch images ignoring the local store")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should mark store-only and no-store explicitly as deprecated here and elsewhere.

@cgonyeo cgonyeo force-pushed the pull-policy branch 2 times, most recently from dd1bba0 to 50b88bd Compare January 26, 2017 17:34
@cgonyeo
Copy link
Member Author

cgonyeo commented Jan 26, 2017

Nits should be fixed now. Changed the description of --no-store and --store-only to (deprecated) alias for --pull-policy=<policy>.

@lucab lucab self-requested a review January 30, 2017 10:17
@lucab
Copy link
Member

lucab commented Jan 30, 2017

Code looks fine, but I'll take a second pass today or tomorrow regarding behavioral changes introduced in here.

@lucab
Copy link
Member

lucab commented Jan 30, 2017

It defaults to new, unless the command being called is rkt fetch, in which case it will default to update.

Just to double-check: this is to retain compatibility with previous behavior, and test failure were not strictly due to changed behavior, correct?

@cgonyeo
Copy link
Member Author

cgonyeo commented Jan 30, 2017

rkt fetch defaulting to update is a different behavior than before, this PR changes it. The behavior before this PR was (with the new terminology) rkt fetch defaulting to new. This caused some tests to fail, because due to this change in behavior they needed to now pass --pull-policy=new to have the same behavior as when they were written.

@cgonyeo
Copy link
Member Author

cgonyeo commented Jan 30, 2017

This behavioral change was to address half of #2937, with the other half being the recent docker2aci changes here: appc/docker2aci#237.

@lucab
Copy link
Member

lucab commented Jan 30, 2017

Thanks for the answers and sorry for the confusion, I was focused on the rework too much and actually forgot the initial request in the original ticket.

@@ -51,9 +54,10 @@ func init() {
cmdFetch.Flags().SetInterspersed(false)

cmdFetch.Flags().Var((*appAsc)(&rktApps), "signature", "local signature file to use in validating the preceding image")
cmdFetch.Flags().BoolVar(&flagStoreOnly, "store-only", false, "use only available images in the store (do not discover or download from remote URLs)")
cmdFetch.Flags().BoolVar(&flagNoStore, "no-store", false, "fetch images ignoring the local store")
cmdFetch.Flags().BoolVar(&flagStoreOnly, "store-only", false, "(deprecated) alias for --pull-policy=never")
Copy link
Member

@lucab lucab Jan 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI you may directly mark this as deprecated via pflags MarkDeprecated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh that's super cool, I didn't know cobra had that. Changing it now.

Copy link
Member

@lucab lucab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except for a very minor UI nit.

…licy

This replaces the `--no-store` and `--store-only` flags with a singular
flag `--pull-policy` that can accept one of three things, `never`,
`new`, and `update`. This is purely a cli change, there are no under the
hood impacts. `--no-store` has been aliased to `--pull-policy=update`
and `--store-only` has been aliased to `--pull-policy=never` for
compatibility reasons.
@cgonyeo
Copy link
Member Author

cgonyeo commented Jan 30, 2017

I've gotten LGTMs from @s-urbaniak and @lucab, and I'm happy with this, so I'll merge when the tests are green.

Copy link
Contributor

@s-urbaniak s-urbaniak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@s-urbaniak s-urbaniak merged commit 548c7d0 into rkt:master Jan 31, 2017
@cgonyeo cgonyeo deleted the pull-policy branch January 31, 2017 18:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants