Skip to content

Conversation

@smarterclayton
Copy link
Contributor

--image-for=TAG lets a user get the exact pull spec out of the payload or
return an error. Allows scripting around a particular payload, for instance
to get the installer or CLI binary out of the image referenced in the
payload.

The --output command acts like oc image info and prints a semi-formal
API output of the info gathered for scripting.

Docker returns 403 if the image isn't found in order to preserve
anonymity. Convey that in a more succinct form to the user. Also
report a more accurate error if the user provides us an image of
the form `x.y`.
`--image-for=TAG` lets a user get the exact pull spec out of the
payload or return an error. Allows scripting around a particular
payload, for instance to get the installer or CLI binary out of
the image referenced in the payload.

The `--output` command acts like `oc image info` and prints a
semi-formal API output of the info gathered for scripting.
@openshift-ci-robot openshift-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 10, 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 Jan 10, 2019
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: smarterclayton

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

@wking parallels the CVO behavior and intended for admin scripting by (for now) ART and QE to let them get the installer binary out of the payload without having to execute the payload.

@vikaslaad @tbielawa you can use this to get the installer binary with:

oc image extract $( oc adm release info registry.svc.ci.openshift.org/openshift/origin-release:v4.0 --image-for=installer ) --file /usr/bin/openshift-installer

or the oc cli with:

oc image extract $( oc adm release info registry.svc.ci.openshift.org/openshift/origin-release:v4.0 --image-for=cli ) --file /usr/bin/oc

@vikaslaad
Copy link

@mffiedler

@smarterclayton
Copy link
Contributor Author

/retest

As a user, if i want a single file out of an image it's annoying. Make
extraction explicit (does not require confirm) if you want to extract
a single file into the current directory.

    oc image extract IMAGE --file /usr/bin/ls

copies ls into the current directory.
@smarterclayton
Copy link
Contributor Author

/retest

1 similar comment
@smarterclayton
Copy link
Contributor Author

/retest

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

/retest

4 similar comments
@smarterclayton
Copy link
Contributor Author

/retest

@smarterclayton
Copy link
Contributor Author

/retest

@smarterclayton
Copy link
Contributor Author

/retest

@smarterclayton
Copy link
Contributor Author

/retest

wking added a commit to wking/openshift-installer that referenced this pull request Mar 15, 2019
…ayload

A number of users have had issues mixing and matching installers and
update payloads.  This script removes a degree of freedom by
extracting the installer from the update payload itself.  You'll need
a fairly new oc for this, since --image-for was only added in
openshift/origin@f1d50464 (Add `--image-for` and `--output` to `oc adm
release info`, 2019-01-10, openshift/origin#21766).

I've taken a fairly conservative approach to pushing host information
into the container.  If you leave off the AWS_* variables, the
installer will prompty you, so that's a bit tedious, but not the end
of the world.  With all the trappings for an AWS cluster, this could
look like:

  $ SSH_PUBKEY=~/.ssh/id_rsa.pub \
  >   AWS_PROFILE=openshift-dev \
  >   AWS_CONFIG_FILE=~/.aws/config \
  >   AWS_SHARED_CREDENTIALS_FILE=~/.aws/credentials \
  >   RELEASE=registry.svc.ci.openshift.org/openshift/origin-release:4.0.0-0.alpha-2019-02-06-200409 \
  >   install-release-image create cluster

which is a bit of a mouthful :p.  We could set defaults for
AWS_SHARED_CREDENTIALS_FILE and mount them into the cluster by
default, but I don't want callers to be concerned about leaking
information they may consider highly sensitive.  I'm less concerned
about SSH public keys or AWS_CONFIG_FILE being considered sensitive,
so the default behavior there is to mount them in from the usual
locations.

I'm setting HOME so I can mount in ~/.ssh, ~/.aws, etc. without
mounting those into the asset directory at /output.  We want the
mounted (semi-)secret data to be reaped with the container, with no
chance of persisting in the asset directory.

The mkdir call avoids:

  $ ASSETS=does-not-exist install-release-image.sh
  realpath: ‘does-not-exist’: No such file or directory
  failed to resolve asset path

since folks are likely to expect the installer's semantics (where it
creates the requested asset directory if it didn't already exist).  We
can't wait on the installer though, because we are using realpath to
convert to an absolute path so we can set up the volume options for
Podman.

The SC2154 disable avoids [2]:

  ./scripts/install-release-image.sh:50:9: note: Don't use variables in the printf format string. Use printf "..%s.." "$foo". [SC2059]

Folks calling 'die' should follow that advice.  This 'die' code that
calls 'printf' is just passing along the value given by the 'die'
caller.

[1]: https://github.com/openshift/machine-config-operator/blob/master/docs/Update-SSHKeys.md
[2]: https://storage.googleapis.com/origin-ci-test/pr-logs/pull/openshift_installer/1221/pull-ci-openshift-installer-shellcheck/3407/build-log.txt
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants