-
Notifications
You must be signed in to change notification settings - Fork 4.8k
release: Support extracting the 'oc' and 'openshift-install' binaries #22439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release: Support extracting the 'oc' and 'openshift-install' binaries #22439
Conversation
|
/assign @wking I'm still iterating on this a bit but it "works" (at least, the substitution looks right to me). |
20f7cd4 to
84c7a83
Compare
| flags.StringSliceVarP(&o.Filenames, "filename", "f", o.Filenames, "A file defining a mapping of input images to use to build the release") | ||
| flags.StringSliceVar(&o.Filenames, "filename", o.Filenames, "A file defining a mapping of input images to use to build the release") | ||
| flags.StringVar(&o.FromImageStream, "from-image-stream", o.FromImageStream, "Look at all tags in the provided image stream and build a release payload from them.") | ||
| flags.StringVarP(&o.FromImageStreamFile, "from-image-stream-file", "f", o.FromImageStreamFile, "Take the provided image stream on disk and build a release payload from it.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be confusing with all the commands which use -f for --filename. I'd strongly recommend we either don't have a shorthand or have a different one. Also how --from-image-stream-file differs from --from-image-stream is it only for the fact that one points to IS on disk and another to on server, what's the story behind that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens when I specify both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have any arguments that take both a file and a name on the server. -f is the filename shorthand - you're creating a release from a file. I suppose I could rename --filename to be something else, but this would still probably need to indicate it's a stream.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed --filenames to be --mapping-file but I want to leave --from-image-stream-file to be consistent with the other sources. -f is the right shortcut for that though.
| return fmt.Errorf("unable to read input image stream file: %v", err) | ||
| } | ||
| is := &imageapi.ImageStream{} | ||
| if err := yaml.Unmarshal(data, &is); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why doing this manually when you have resource builder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Release commands don't use resource builder at all. There is no "magic loading", there are only image stream sources.
721621c to
2fac71f
Compare
|
This will go in after the rebase so we can start publishing the correct binaries. Will address the current comments, if there are others please look soon. |
2fac71f to
f1ade98
Compare
|
/retest |
It should be possible to snapshot a release stream with `oc get is ... -o yaml` and then build a release from it later for archival and historical backup. Support providing an image stream file instead of requiring a live lookup. Refactor the reference loading code to allow spec tags with image IDs to not require a successful import recorded in status, and specifically error when we encounter that condition.
f1ade98 to
efdfa99
Compare
The payload is the authoritative source of tools. To support the
openshift-install binary being transformed to lock against a particular
version, add support for:
oc adm release extract --command=oc|openshift-install ...
The command attempts to extract the binary appropriate for the current
os or respects --command-os=mac|windows|linux. We do not support
alternative architectures yet but those will be handled by extending
the os field if necessary. We hardcode the lookup locations for now,
assuming that a future release may make this more generic.
The 'cli-artifacts' and 'installer-artifacts' images will descend
from 'cli' and 'installer' and offer the mac/windows and mac variants
of their respective commands.
A more general purpose variant of this command is:
oc adm release extract --tools ... --to=DIR
which creates in DIR an archive for each tool+OS combination
(right now, oc win/mac/linux and openshift-install mac/linux) as
well as a sha256sum.txt.asc file that can be used to verify the
output.
efdfa99 to
a63351b
Compare
|
updated ptal |
|
/retest |
|
/retest |
|
Talked with @soltysh, will take more feedback after this so I can start integrating with release tooling. |
|
/retest |
1 similar comment
|
/retest |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
soltysh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
/retest
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: smarterclayton, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest |
2 similar comments
|
/retest |
|
/retest |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
1 similar comment
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
/retest from hells heart I stab at thee unit test flakes |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
…or openshift-install Stop warning: $ oc adm release extract --command=openshift-install registry.svc.ci.openshift.org/openshift/origin-release:v4.0 error: image did not contain usr/bin/openshift-install despite successfully extracting the binary. The bug was from a63351b (release: Support extracting the 'oc' and 'openshift-install' binaries, 2019-03-30, openshift#22439).
…hen not hashing Stop warning: $ oc adm release extract --command=openshift-install registry.svc.ci.openshift.org/openshift/origin-release:v4.0 error: image did not contain usr/bin/openshift-install despite successfully extracting the binary. The bug was from a63351b (release: Support extracting the 'oc' and 'openshift-install' binaries, 2019-03-30, openshift#22439).
This function was a hold-over from the refactor in openshift/origin@a63351b9bb (release: Support extracting the 'oc' and 'openshift-install' binaries, 2019-03-30, openshift/origin#22439) that added extractCommand. Doesn't seem to be worth keeping a separate function for this when we could just call extractCommand directly.
This is a per-extraction-call setting, not a per-extracted-target setting. Targets for a given extraction call are either going to be all archives or never archives. AsArchive landed in openshift/origin@a63351b9bb (release: Support extracting the 'oc' and 'openshift-install' binaries, 2019-03-30, openshift/origin#22439). Dropping the AsZip bit of the loop is fine because we are hard-coding AsZip true for the windows oc in the initial availableTargets declaration.
The payload is the authoritative source of tools. To support retrieving the CLI from a payload and also the openshift-install binary being transformed to lock against a particular version (openshift/installer#1422), add support for:
The command attempts to extract the binary appropriate for the current os
or respects --command-os=mac|windows|linux. We do not support alternative
architectures yet but those will be handled by extending the os field if
necessary. We hardcode the lookup locations for now, assuming that a future
release may make this more generic.
On extracting the
openshift-installbinary we perform the transformation described in openshift/installer#1422A more general command intended to be used by tooling is
which creates 5 archives in DIR for each binary+os combo. It also creates a
sha256sum.txt.ascfile to allow verification.The 'cli-artifacts' and 'installer-artifacts' images will descend from
'cli' and 'installer' and offer the mac/windows and mac variants of their
respective commands.
This complements but does not replace the "serve CLI tools from console operator via HTTP" story Trevor and Ben were iterating on.