-
Notifications
You must be signed in to change notification settings - Fork 427
Bug 1773257: pkg/cli/admin/release/extract_tools: Inject release version into installer #165
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
Bug 1773257: pkg/cli/admin/release/extract_tools: Inject release version into installer #165
Conversation
d3fd7d1 to
3c1cccf
Compare
|
/assign @soltysh |
/retest |
23e5f4d to
db7b417
Compare
Set a marker for oc to inject the release version to avoid potential confusion from: $ oc adm release extract --command=openshift-install quay.io/openshift-release-dev/ocp-release:4.2.7 $ ./openshift-install version ./openshift-install v4.2.5 built from commit 425e4ff release image quay.io/openshift-release-dev/ocp-release@sha256:bac62983757570b9b8f8bc84c740782984a255c16372b3e30cfc8b52c0a187b9 The actual oc injection logic is in [1]. [1]: openshift/oc#165
|
@wking: This pull request references Bugzilla bug 1773257, which is valid. The bug has been updated to refer to the pull request using the external bug tracker. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@wking, awesome refactor and cleanup, thank you : )
afaict only way to get past the hump w/ this is a release image w/ both installer + this PR baked in. That leaves a backward compatibility issue w/ extracting openshift-install when I build a release w/ this PR installer + this PR oc, I can extract successfully and see: |
Expected until openshift/installer#2682, and harmless noise until then.
More on this in the |
If it's harmless, make a note of it? Or, drop from Warning to Info, and level >1? |
If you want to avoid, wait for the installer PR to land first? I don't think we need two |
…aller We've been injecting the release version into oc since 13215d7 (Bug 1715001: when extracting tools from payload, 'oc version' should report payload version, 2019-09-10, openshift#88), but we want to inject it into the installer to to avoid potential confusion from: $ oc adm release extract --command=openshift-install quay.io/openshift-release-dev/ocp-release:4.2.7 $ ./openshift-install version ./openshift-install v4.2.5 built from commit 425e4ff0037487e32571258640b39f56d5ee5572 release image quay.io/openshift-release-dev/ocp-release@sha256:bac62983757570b9b8f8bc84c740782984a255c16372b3e30cfc8b52c0a187b9
db7b417 to
d1b006a
Compare
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
/approve
/retest
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: soltysh, wking 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 Please review the full test history for this PR and help us cut down flakes. |
|
/cherrypick release-4.3 |
|
@sdodson: new pull request created: #249 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Set a marker for oc to inject the release version to avoid potential confusion from: $ oc adm release extract --command=openshift-install quay.io/openshift-release-dev/ocp-release:4.2.7 $ ./openshift-install version ./openshift-install v4.2.5 built from commit 425e4ff release image quay.io/openshift-release-dev/ocp-release@sha256:bac62983757570b9b8f8bc84c740782984a255c16372b3e30cfc8b52c0a187b9 The actual oc injection logic is in [1]. [1]: openshift/oc#165
We've been injecting the release version into oc since 13215d7 (Bug
1715001: when extracting tools from payload, 'oc version' should
report payload version, 2019-09-10, #88), but we want to inject it
into the installer to to avoid potential confusion from:
This commit refactors the split helpers from f55426f (Bug 1763728:
fix 'oc adm release extract' version injection, 2019-10-17, #131) with
a single helper that takes a replacement slice. I've also pushed the
unmatched warning down into the replacement helper itself so we don't
have to return a slice of replacements that did or did not match.
Now that replacements are no longer baked in, I've made the unit test
a bit more readable by dispensing with the fakeInput helpers and just
hard-coding small input/output strings in the test-case definitions.
There's also the "
ocis overwriting its own...RELEASE_VERSION_LOCATION..." constant issue, previously fixed byded896d (Bug 1768516: fix extracted-oc adm extract oc, 2019-11-08, #155).
In this commit, I've avoidied that by using ! as the leading character
in the marker constants and replacing it with a null byte when
constructing replacements in extractCommand. With a single
replacement per marker, we need our marker constant to never match; I
dunno what the previous doubled constant was about (but see the
len(value) point next for why the previous doubled marker worked at
all).
I've also fixed some additional bugs:
The previous implementation only used len(value) of the marker when
searching the incoming bytes. Especially for short strings like
version replacement, this meant we were only looking for five bytes
for 4.2.7, which is \x00_REL. That's not very specific. It does
not distinquish between \x00_RELEASE_IMAGE_LOCATION_\x00XX... and
\x00_RELEASE_VERSION_LOCATION_\x00XX.... It doesn't even
distinguish between the defaultVersionPadded and
defaultVersionPrefix constants in pkg/version. With this commit, we
search for the full marker, regardless of len(value).
The previous implementation had:
That was problematic for a few reasons:
It didn't write much data. Substituting for
nextOffset, we werewriting to:
It ignored the amound of data written. You can want to write 1k
bytes but only actually write 50 bytes with a given
Writecall.That didn't happen often before; because of the previous list
entry we were only attempting to write a hundred or so bytes at a
time. But now that we are trying to write the bulk of the buffer
size, it happens more often. With this commit, we keep attempting
Writeuntil it errors out on us or we finish pushing all the byteswe no longer need.
Because 13215d7, f55426f, and ded896d all touched the version
marker, this commit will mean that oc build with this commit and later
will not inject version names into oc built before ded896d. But
that's ok, because 4.2 binaries have no version markers (just a
RELEASE_IMAGE_LOCATIONconstant for the installer's marker). And wehaven't cut 4.3 yet. So with this commit and no future changes to the
oc marker, we'll be able to inject the version name into all supported
oc which are prepared to receive injected version names.
In action extracting from 4.3.0-0.nightly-2019-11-13-233341:
CC @sallyom