Skip to content
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

OCPBUGS-25461: Add RHEL9 and RHEL8 based oc as new targets in command extraction #1647

Merged
merged 5 commits into from Jan 11, 2024

Conversation

ardaguclu
Copy link
Member

@ardaguclu ardaguclu commented Jan 4, 2024

As explained in the referenced bug, oc compiled in RHEL8 does not work
on FIPS enabled RHEL9 environment. However, we need to provide a way to
users to enable extraction of oc compiled in RHEL9 to work on FIPS enabled clusters.

This PR adds new command targets in oc adm release extract command that
users can extract oc specific to their RHEL versions as a continuation of
#1632

Single command extraction
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel9
# Downloads oc.rhel9
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel8
# Downloads oc.rhel8
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc --command-os=linux/arm64
# Downloads oc compiled in linux/arm64 with whichever RHEL based image is set(currently RHEL8)
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel9 --command-os=linux/arm64
# Downloads oc.rhel9 compiled in RHEL9 arm64 architecture
All tools extraction
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --tools
ccoctl-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-amd64-rhel9-4.16.0-0.nightly-2024-01-03-193825.tar.gz
# There should also be openshift-client-linux-amd64-rhel8-4.16.0-0.nightly-2024-01-03-193825.tar.gz but we haven't added that yet
openshift-install-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
All tools extraction in specific os/arch
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract_arm64 --tools --command-os=linux/arm64
openshift-client-linux-arm64-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-arm64-rhel9-4.16.0-0.nightly-2024-01-03-193825.tar.gz
# There should also be openshift-client-linux-arm64-rhel8-4.16.0-0.nightly-2024-01-03-193825.tar.gz but we haven't added that yet
openshift-install-linux-arm64-4.16.0-0.nightly-2024-01-03-193825.tar.gz

These new targets will stay until the fully migration to RHEL9 is completed and we'll return back to defaults.

@openshift-ci-robot openshift-ci-robot added jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jan 4, 2024
@openshift-ci-robot
Copy link

@ardaguclu: This pull request references Jira Issue OCPBUGS-25461, which is invalid:

  • expected the bug to target the "4.16.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

As explained in the referenced bug, oc compiled in RHEL8 does not work
on FIPS enabled RHEL9 environment. However, we need to provide a way to
users to enable extraction of oc compiled in RHEL9 to work on FIPS enabled clusters.

This PR adds new command targets in oc adm release extract command that
users can extract oc specific to their RHEL versions as a continuation of
#1632

Single command extraction
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel9
# Downloads oc.rhel9
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel8
# Downloads oc.rhel8
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc --command-os=linux/arm64
# Downloads oc compiled in linux/arm64 with whichever RHEL based image is set(currently RHEL8)
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel9 --command-os=linux/arm64
# Downloads oc.rhel9 compiled in RHEL9 arm64 architecture
All tools extraction
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --tools
ccoctl-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-amd64-rhel9-4.16.0-0.nightly-2024-01-03-193825.tar.gz
# There should also be openshift-client-linux-amd64-rhel8-4.16.0-0.nightly-2024-01-03-193825.tar.gz but we haven't add that yet
openshift-install-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
All tools extraction in specific os/arch
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract_arm64 --tools --command-os=linux/arm64
openshift-client-linux-arm64-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-arm64-rhel9-4.16.0-0.nightly-2024-01-03-193825.tar.gz
# There should also be openshift-client-linux-arm64-rhel8-4.16.0-0.nightly-2024-01-03-193825.tar.gz but we haven't add that yet
openshift-install-linux-arm64-4.16.0-0.nightly-2024-01-03-193825.tar.gz

These new targets will stay until the fully migration to RHEL9 is completed and we'll return back to defaults.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot requested review from deads2k and mfojtik January 4, 2024 07:39
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 4, 2024
@ardaguclu
Copy link
Member Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jan 4, 2024
@openshift-ci-robot
Copy link

@ardaguclu: This pull request references Jira Issue OCPBUGS-25461, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.16.0) matches configured target version for branch (4.16.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @zhouying7780

In response to this:

/jira refresh

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 openshift-eng/jira-lifecycle-plugin repository.

@ardaguclu
Copy link
Member Author

@ingvagabund Does this patch make sense under the light of our discussions?.

  • First commit fixes a bug to prevent us adding a new target in linux/amd64
  • Second commit enables the extraction of oc.rhel9
  • Third commit adds oc.rhel8 symlinking as well as new target in extraction

@ingvagabund
Copy link
Member

First commit fixes a bug to prevent us adding a new target in linux/amd64

Was this bug introduced with rhel8/rhel9 change? Or, has it been around for some time already?

OS: "linux",
Arch: "amd64",
Command: "oc.rhel8",
Mapping: extract.Mapping{Image: "cli-artifacts", From: "usr/share/openshift/linux_amd64/oc.rhel8"},
Copy link
Member

Choose a reason for hiding this comment

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

How's the symlink processing implemented here? Will the extracted binary be a symlink or the symlink target?

Copy link
Member

Choose a reason for hiding this comment

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

Will the final binary be oc or oc.rhel8? I prefer oc only.

Copy link
Member Author

@ardaguclu ardaguclu Jan 4, 2024

Choose a reason for hiding this comment

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

Thanks a lot for review.

How's the symlink processing implemented here? Will the extracted binary be a symlink or the symlink target?

For which symlink are you asking oc -> kubectl or oc -> oc.rhel8?. If it is for oc -> oc.rhel8, it is the same principle of

ln -sf /usr/share/openshift/linux_$(uname -m | sed 's/aarch64/arm64/;s/x86_64/amd64/')/oc /usr/bin/oc && \
and
{
OS: "linux",
Arch: "amd64",
Command: "oc",
Mapping: extract.Mapping{Image: "cli-artifacts", From: "usr/share/openshift/linux_amd64/oc"},
LinkTo: []string{"kubectl"},
Readme: readmeCLIUnix,
InjectReleaseVersion: true,
ArchiveFormat: "openshift-client-linux-amd64-%s.tar.gz",
},
. Extracted binary is a real binary not a symlink.

Will the final binary be oc or oc.rhel8? I prefer oc only.

Good point and it would be nicer, I can change them to oc.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ingvagabund I've added new optional TargetCommandName field to rename extracted binaries.

@@ -18,6 +18,10 @@ RUN cd /usr/share/openshift && \
ln -sf /usr/share/openshift/linux_$(uname -m | sed 's/aarch64/arm64/;s/x86_64/amd64/')/oc /usr/bin/oc && \
mv windows_amd64 windows && mv darwin_amd64 mac && mv darwin_arm64 mac_arm64

RUN ln -sf /usr/share/openshift/linux_amd64/oc /usr/share/openshift/linux_amd64/oc.rhel8
RUN ln -sf /usr/share/openshift/linux_arm64/oc /usr/share/openshift/linux_arm64/oc.rhel8
RUN ln -sf /usr/share/openshift/linux_ppc64le/oc /usr/share/openshift/linux_ppc64le/oc.rhel8
Copy link
Member

Choose a reason for hiding this comment

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

Is there any extract target for ppc64le?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, I added it just to support when/if there is a demand to extract oc in ppc64le arch type but I can remove, if it creates confusion.

klog.V(2).Infof("Skipping duplicate %s", target.ArchiveFormat)
continue
if _, ok := targetArchCommands[target.Command]; ok {
// Some target commands have release-arch types that defines extracting
Copy link
Member

Choose a reason for hiding this comment

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

Was this corner case introduced with rhel8/rhel9 change? Or, has it been around for some time already?

Copy link
Member Author

Choose a reason for hiding this comment

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

It has existed for a long time (from this commit 3dba61a), but it didn't cause any problem because all the targets have release-arch type until now. oc.rhel9 and oc.rhel8 have their own static arch types.

@ingvagabund
Copy link
Member

/lgtm

@ingvagabund
Copy link
Member

ingvagabund commented Jan 5, 2024

/hold
for pre-merge testing

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Jan 5, 2024
@openshift-ci-robot
Copy link

@ardaguclu: This pull request references Jira Issue OCPBUGS-25461, which is valid.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.16.0) matches configured target version for branch (4.16.0)
  • bug is in the state POST, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @zhouying7780

In response to this:

As explained in the referenced bug, oc compiled in RHEL8 does not work
on FIPS enabled RHEL9 environment. However, we need to provide a way to
users to enable extraction of oc compiled in RHEL9 to work on FIPS enabled clusters.

This PR adds new command targets in oc adm release extract command that
users can extract oc specific to their RHEL versions as a continuation of
#1632

Single command extraction
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel9
# Downloads oc.rhel9
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel8
# Downloads oc.rhel8
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc --command-os=linux/arm64
# Downloads oc compiled in linux/arm64 with whichever RHEL based image is set(currently RHEL8)
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel9 --command-os=linux/arm64
# Downloads oc.rhel9 compiled in RHEL9 arm64 architecture
All tools extraction
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --tools
ccoctl-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-amd64-rhel9-4.16.0-0.nightly-2024-01-03-193825.tar.gz
# There should also be openshift-client-linux-amd64-rhel8-4.16.0-0.nightly-2024-01-03-193825.tar.gz but we haven't added that yet
openshift-install-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
All tools extraction in specific os/arch
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract_arm64 --tools --command-os=linux/arm64
openshift-client-linux-arm64-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-arm64-rhel9-4.16.0-0.nightly-2024-01-03-193825.tar.gz
# There should also be openshift-client-linux-arm64-rhel8-4.16.0-0.nightly-2024-01-03-193825.tar.gz but we haven't added that yet
openshift-install-linux-arm64-4.16.0-0.nightly-2024-01-03-193825.tar.gz

These new targets will stay until the fully migration to RHEL9 is completed and we'll return back to defaults.

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 8, 2024
@ardaguclu
Copy link
Member Author

/retest

@ardaguclu
Copy link
Member Author

Last commit is just for backwards compatibility purposes and unlikely to affect the results of CI jobs;

/retest

@ardaguclu
Copy link
Member Author

/retest

@zhouying7780
Copy link
Contributor

/label qe-approved

@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Jan 8, 2024
@ardaguclu
Copy link
Member Author

@ingvagabund could you please have a look at?. Thanks.

@ingvagabund
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 11, 2024
Copy link
Contributor

openshift-ci bot commented Jan 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ardaguclu, ingvagabund

The full list of commands accepted by this bot can be found here.

The pull request process is described here

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

@ardaguclu
Copy link
Member Author

Since the pre-merge tests have been completed and no issues found;
/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 11, 2024
Copy link
Contributor

openshift-ci bot commented Jan 11, 2024

@ardaguclu: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 0bcda9c into openshift:master Jan 11, 2024
13 checks passed
@openshift-ci-robot
Copy link

@ardaguclu: Jira Issue OCPBUGS-25461: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-25461 has been moved to the MODIFIED state.

In response to this:

As explained in the referenced bug, oc compiled in RHEL8 does not work
on FIPS enabled RHEL9 environment. However, we need to provide a way to
users to enable extraction of oc compiled in RHEL9 to work on FIPS enabled clusters.

This PR adds new command targets in oc adm release extract command that
users can extract oc specific to their RHEL versions as a continuation of
#1632

Single command extraction
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel9
# Downloads oc.rhel9
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel8
# Downloads oc.rhel8
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc --command-os=linux/arm64
# Downloads oc compiled in linux/arm64 with whichever RHEL based image is set(currently RHEL8)
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --command=oc.rhel9 --command-os=linux/arm64
# Downloads oc.rhel9 compiled in RHEL9 arm64 architecture
All tools extraction
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract --tools
ccoctl-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-amd64-rhel9-4.16.0-0.nightly-2024-01-03-193825.tar.gz
# There should also be openshift-client-linux-amd64-rhel8-4.16.0-0.nightly-2024-01-03-193825.tar.gz but we haven't added that yet
openshift-install-linux-4.16.0-0.nightly-2024-01-03-193825.tar.gz
All tools extraction in specific os/arch
$ ./oc adm release extract registry.ci.openshift.org/ocp/release:4.16.0-0.nightly-2024-01-03-193825 --to=/tmp/test_extract_arm64 --tools --command-os=linux/arm64
openshift-client-linux-arm64-4.16.0-0.nightly-2024-01-03-193825.tar.gz
openshift-client-linux-arm64-rhel9-4.16.0-0.nightly-2024-01-03-193825.tar.gz
# There should also be openshift-client-linux-arm64-rhel8-4.16.0-0.nightly-2024-01-03-193825.tar.gz but we haven't added that yet
openshift-install-linux-arm64-4.16.0-0.nightly-2024-01-03-193825.tar.gz

These new targets will stay until the fully migration to RHEL9 is completed and we'll return back to defaults.

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 openshift-eng/jira-lifecycle-plugin repository.

@ardaguclu ardaguclu deleted the ocpbugs-25461 branch January 11, 2024 13:00
@soltysh
Copy link
Member

soltysh commented Jan 25, 2024

/cherry-pick release-4.15

@openshift-cherrypick-robot

@soltysh: #1647 failed to apply on top of branch "release-4.15":

Applying: Skip release-arch and arch type collision per command
Applying: Add RHEL9 oc as linux command in target list
Applying: Generate RHEL8 based oc and add as target to extract
Using index info to reconstruct a base tree...
M	images/cli-artifacts/Dockerfile.rhel
M	pkg/cli/admin/release/extract_tools.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/cli/admin/release/extract_tools.go
Auto-merging images/cli-artifacts/Dockerfile.rhel
CONFLICT (content): Merge conflict in images/cli-artifacts/Dockerfile.rhel
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 Generate RHEL8 based oc and add as target to extract
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-4.15

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.

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. jira/severity-important Referenced Jira bug's severity is important for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. qe-approved Signifies that QE has signed off on this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants