Skip to content

Conversation

@smarterclayton
Copy link
Contributor

@smarterclayton smarterclayton commented Mar 30, 2019

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:

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.

On extracting the openshift-install binary we perform the transformation described in openshift/installer#1422

A more general command intended to be used by tooling is

oc adm release extract --tools ... --to=DIR

which creates 5 archives in DIR for each binary+os combo. It also creates a sha256sum.txt.asc file 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.

@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 30, 2019
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 30, 2019
@smarterclayton smarterclayton changed the title release: Support extracting the 'oc' and 'openshift-install' binaries WIP: release: Support extracting the 'oc' and 'openshift-install' binaries Mar 30, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 30, 2019
@smarterclayton
Copy link
Contributor Author

/assign @wking

I'm still iterating on this a bit but it "works" (at least, the substitution looks right to me).

@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 1, 2019
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.")
Copy link
Contributor

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?

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

@smarterclayton smarterclayton Apr 2, 2019

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.

@smarterclayton smarterclayton force-pushed the release_extract branch 2 times, most recently from 721621c to 2fac71f Compare April 2, 2019 01:33
@smarterclayton smarterclayton changed the title WIP: release: Support extracting the 'oc' and 'openshift-install' binaries release: Support extracting the 'oc' and 'openshift-install' binaries Apr 2, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 2, 2019
@smarterclayton
Copy link
Contributor Author

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.

@smarterclayton
Copy link
Contributor Author

/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.
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.
@smarterclayton
Copy link
Contributor Author

updated ptal

@smarterclayton
Copy link
Contributor Author

/retest

@smarterclayton
Copy link
Contributor Author

/retest

@smarterclayton
Copy link
Contributor Author

Talked with @soltysh, will take more feedback after this so I can start integrating with release tooling.

@smarterclayton smarterclayton added the lgtm Indicates that a PR is ready to be merged. label Apr 3, 2019
@smarterclayton
Copy link
Contributor Author

/retest

1 similar comment
@smarterclayton
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm
/retest

@openshift-ci-robot
Copy link

[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

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@smarterclayton
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@smarterclayton
Copy link
Contributor Author

/retest

2 similar comments
@smarterclayton
Copy link
Contributor Author

/retest

@smarterclayton
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@smarterclayton
Copy link
Contributor Author

/retest

from hells heart I stab at thee unit test flakes

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@soltysh
Copy link
Contributor

soltysh commented Apr 5, 2019

from hells heart I stab at thee unit test flakes

You're unit flake attractor, I think you inherited that from @mfojtik 😉 On a more serious note, another flake fix is in #22490 and it looks like HPA has yet another one 🤦‍♂️

wking added a commit to wking/origin that referenced this pull request Apr 13, 2019
…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).
wking added a commit to wking/origin that referenced this pull request Apr 13, 2019
…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).
wking added a commit to wking/oc that referenced this pull request Nov 20, 2019
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.
wking added a commit to wking/oc that referenced this pull request Nov 20, 2019
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants