Repository navigation
OCPBUGS-109594: Add weekly cached azure-cli base image #9448
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| name: Build and Push Azure CLI Base Image | ||
|
|
||
| on: | ||
| schedule: | ||
| # Run weekly Monday 8am UTC | ||
| - cron: '0 8 * * 1' | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| packages: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- applicable repository guidance ---'
find /tmp/coderabbit-repo-knowledge/openshift-hypershift-f03410fd -maxdepth 2 -type f -name '*.md' -print \
| sort \
| while IFS= read -r f; do
case "$f" in
*/learnings/*|*/architecture/*|*/.github*/*)
printf '\n[%s]\n' "$f"
head -80 "$f"
;;
esac
done
printf '%s\n' '--- workflow ---'
cat -n .github/workflows/build-azure-cli-base.yaml
printf '%s\n' '--- changed-file summary ---'
git diff --stat -- .github/workflows/build-azure-cli-base.yaml
git status --short -- .github/workflows/build-azure-cli-base.yamlRepository: openshift/hypershift Length of output: 32517 Pin all external actions to full commit SHAs. This workflow uses mutable tags for 🧰 Tools🪛 zizmor (1.29.0)[warning] 16-16: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) 🤖 Prompt for AI AgentsSource: Path instructions 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: printf '%s\n' '--- applicable conventions ---'
find /tmp/coderabbit-repo-knowledge/openshift-hypershift-f03410fd -type f -name '*.md' -print
printf '%s\n' '--- workflow ---'
cat -n .github/workflows/build-azure-cli-base.yaml
printf '%s\n' '--- related Docker/build references ---'
rg -n -C 3 'docker build|build-azure-cli-base|checkout|GITHUB_TOKEN|persist-credentials' .github/workflows Makefile Dockerfile* 2>/dev/null || trueRepository: openshift/hypershift Length of output: 31034 🏁 Script executed: printf '%s\n' '--- workflow conventions ---'
cat /tmp/coderabbit-repo-knowledge/openshift-hypershift-f03410fd/conventions/github-workflows.md
printf '%s\n' '--- Docker build inputs ---'
fd -H -i 'dockerignore|Dockerfile.azure-cli-base' .
for f in $(fd -H -i 'dockerignore|Dockerfile.azure-cli-base' .); do
printf '%s\n' "--- $f"
cat -n "$f"
doneRepository: openshift/hypershift Length of output: 2488 🌐 Web query:
💡 Result: In the actions/checkout v4 action, the persist-credentials input defaults to true [1][2]. When set to true, the action configures the authentication token (or SSH key) into the local git configuration of the checked-out repository [3][4]. This allows subsequent steps in your workflow to execute authenticated git commands (e.g., git push) without requiring manual credential setup [3][5]. This configuration is temporary, and the token or key is removed during the action's post-job cleanup [3][4]. Regarding the.git directory and Docker build contexts: 1. Presence: The actions/checkout action checks out your repository into the workspace, which includes the.git directory by default [4][6]. 2. Docker Build Context: If you use a GitHub Action to build a Docker image (e.g., using docker/build-push-action), the build context might not include the.git directory automatically, especially if the action defaults to using a Git reference as the build context instead of the local filesystem [7]. 3. Inclusion: To ensure the.git directory is available inside your Docker build context, you must explicitly set the context input of your build action to the path containing the checked-out code (usually. or $GITHUB_WORKSPACE) rather than relying on the default Git-based context [7]. Using context:. tells Docker to use the current directory—which includes the checked-out files and the.git directory—as the build context [7]. Citations:
Disable checkout credential persistence.
🧰 Tools🪛 zizmor (1.29.0)[warning] 16-16: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@v3 | ||
|
|
||
| - name: Log in to registry.ci.openshift.org | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| registry: registry.ci.openshift.org | ||
| username: ${{ secrets.REGISTRY_CI_USERNAME }} | ||
| password: ${{ secrets.REGISTRY_CI_PASSWORD }} | ||
|
|
||
| - name: Build and push azure-cli-base image | ||
| uses: docker/build-push-action@v5 | ||
|
Comment on lines
+32
to
+33
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🏁 Script executed: printf '%s\n' '--- repository knowledge ---'
find /tmp/coderabbit-repo-knowledge/openshift-hypershift-f03410fd -maxdepth 2 -type f -print | sort
printf '%s\n' '--- applicable knowledge previews ---'
for f in /tmp/coderabbit-repo-knowledge/openshift-hypershift-f03410fd/*/*.md; do
case "$f" in
*/learnings/*|*/architecture/*|*/.github*/*) printf '\n--- %s ---\n' "$f"; sed -n '1,220p' "$f" ;;
esac
done
printf '%s\n' '--- workflow ---'
cat -n .github/workflows/build-azure-cli-base.yamlRepository: openshift/hypershift Length of output: 41824 🏁 Script executed: cat -n /tmp/coderabbit-repo-knowledge/openshift-hypershift-f03410fd/conventions/github-workflows.mdRepository: openshift/hypershift Length of output: 1186 Add SAST/SCA scanning and artifact signing before consumers use the image.
🤖 Prompt for AI AgentsSource: Path instructions |
||
| with: | ||
| context: . | ||
| file: ./Dockerfile.azure-cli-base | ||
| push: true | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major Gate and sign the image before publication.
🤖 Prompt for AI AgentsSource: Path instructions |
||
| tags: | | ||
| registry.ci.openshift.org/openshift/hypershift/azure-cli-base:latest | ||
| registry.ci.openshift.org/openshift/hypershift/azure-cli-base:${{ github.run_number }} | ||
|
Comment on lines
+38
to
+40
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Publish the tag consumed by
🤖 Prompt for AI Agents |
||
| cache-from: type=registry,ref=registry.ci.openshift.org/openshift/hypershift/azure-cli-base:latest | ||
| cache-to: type=inline | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| FROM registry.ci.openshift.org/openshift/release:rhel-9-release-golang-1.26-openshift-5.1 | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
|
|
||
| RUN dnf install -y python3 && \ | ||
| rpm --import https://packages.microsoft.com/keys/microsoft.asc && \ | ||
| dnf install -y https://packages.microsoft.com/config/rhel/9/packages-microsoft-prod.rpm && \ | ||
| sed -i 's/repo_gpgcheck=1/repo_gpgcheck=0/' /etc/yum.repos.d/microsoft-prod.repo && \ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win Keep Microsoft repository metadata verification enabled.
🤖 Prompt for AI Agents |
||
| dnf install -y azure-cli && \ | ||
| dnf clean all | ||
|
|
||
| RUN azure --version | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- repository conventions and learnings ---'
find /tmp/coderabbit-repo-knowledge/openshift-hypershift-f03410fd -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- Dockerfile.azure-cli-base ---'
cat -n Dockerfile.azure-cli-base
printf '%s\n' '--- workflow section ---'
sed -n '1,90p' .github/workflows/build-azure-cli-base.yaml
printf '%s\n' '--- relevant repository references ---'
rg -n --glob '!vendor/**' --glob '!node_modules/**' '\bazure\b|\baz\b|azure-cli' Dockerfile.azure-cli-base .github/workflows README.md .github 2>/dev/null | head -200Repository: openshift/hypershift Length of output: 14361 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- applicable workflow convention ---'
cat /tmp/coderabbit-repo-knowledge/openshift-hypershift-f03410fd/conventions/github-workflows.md
printf '%s\n' '--- Azure CLI executable references in repository documentation ---'
rg -n -i --glob '*.md' --glob '*.yaml' --glob '*.yml' --glob 'Dockerfile*' 'azure --version|az version|/usr/bin/az|azure-cli' . | head -200Repository: openshift/hypershift Length of output: 2973 🌐 Web query:
💡 Result: The Microsoft Azure CLI is distributed on Linux via the azure-cli package [1][2]. The executable command used to interface with the Azure CLI is az [2][3][4]. Regarding your questions: 1. The executable command for the Azure CLI is az [2][3]. You can check the installed version by running the command: az version [2] 2. The string azure is not the standard executable for the current Azure CLI [3][4]. The command az was adopted to distinguish the current CLI from the legacy Azure command-line tool (often referred to as the Azure Classic CLI), which used the azure executable [5]. While some legacy documentation or scripts might still refer to azure, all modern Azure CLI operations utilize the az command [3][6][5]. Citations:
🌐 Web query:
💡 Result: The Azure CLI package, distributed as an RPM, installs the primary executable as /usr/bin/az. It does not install an executable at /usr/bin/azure. To verify the file list of an installed azure-cli RPM package on a Linux system, you can use the following command: rpm -ql azure-cli | grep /usr/bin/ This command will list the files installed by the package that reside in the /usr/bin/ directory, confirming that /usr/bin/az is the correct path for the Azure CLI executable. Citations:
🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- additional Azure CLI validation site ---'
sed -n '1,45p' Dockerfile.e2e
printf '%s\n' '--- exact command occurrences ---'
rg -n -g 'Dockerfile*' -g '*.yaml' -g '*.yml' '(^|[[:space:]])azure --version([[:space:]]|$)' .Repository: openshift/hypershift Length of output: 2016 Use The 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ RUN make e2e hypershift e2ev2-create-guests e2ev2-run-tests e2ev2-destroy-guests | |
|
|
||
| # Reuse the same image as builder because we need go command in ci-test-e2e.sh | ||
| # Multi-stage build lets us drop the source code and build cache from the final image | ||
| FROM registry.ci.openshift.org/openshift/release:rhel-9-release-golang-1.26-openshift-5.1 | ||
| FROM registry.ci.openshift.org/openshift/hypershift/azure-cli-base:latest | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift 🔎 Supported by static analysis🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- repository guidance ---'
find /tmp/coderabbit-repo-knowledge/openshift-hypershift-f03410fd -type f -name '*.md' -print
printf '%s\n' '--- Dockerfile.e2e ---'
cat -n Dockerfile.e2e
printf '%s\n' '--- relevant workflow references ---'
rg -n -C 4 'azure-cli-base|Dockerfile\.e2e|latest|digest' .github/workflows/build-azure-cli-base.yaml .github/workflows 2>/dev/null || true
printf '%s\n' '--- Dockerfile change summary ---'
git diff --stat -- Dockerfile.e2e
git diff -- Dockerfile.e2eRepository: openshift/hypershift Length of output: 16596 Pin the custom base image by digest.
🤖 Prompt for AI AgentsSource: Path instructions |
||
|
|
||
| WORKDIR /hypershift | ||
|
|
||
|
|
@@ -27,9 +27,4 @@ COPY --from=builder /hypershift/bin/dump-guests /hypershift/bin/dump-guests | |
| COPY --from=builder /hypershift/hack/ci-test-e2e.sh /hypershift/hack/ci-test-e2e.sh | ||
| COPY --from=builder /hypershift/hack/run-reqserving-e2e.sh /hypershift/hack/run-reqserving-e2e.sh | ||
|
|
||
| RUN rpm --import https://packages.microsoft.com/keys/microsoft.asc && \ | ||
| dnf install -y https://packages.microsoft.com/config/rhel/9/packages-microsoft-prod.rpm && \ | ||
| mv /etc/yum.repos.d/microsoft-prod.repo /etc/yum.repos.art/ci/ && \ | ||
| sed -i 's/repo_gpgcheck=1/repo_gpgcheck=0/' /etc/yum.repos.art/ci/microsoft-prod.repo && \ | ||
| dnf install -y azure-cli && \ | ||
| dnf clean all | ||
| RUN azure --version | ||
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.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: openshift/hypershift
Length of output: 50377
🏁 Script executed:
Repository: openshift/hypershift
Length of output: 2768
Remove the unused
packages: writepermission.No step uses GitHub Packages. The job pushes to
registry.ci.openshift.orgwithREGISTRY_CI_USERNAMEandREGISTRY_CI_PASSWORD. Removepackages: writeor set it tonone.🤖 Prompt for AI Agents
Source: Path instructions