-
Notifications
You must be signed in to change notification settings - Fork 26
backport: Use P and Z GHA runners (#2215) #2326
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -8,6 +8,7 @@ on: | |||||||||
required: true | ||||||||||
description: | | ||||||||||
The tag used to build the collector image | ||||||||||
|
||||||||||
outputs: | ||||||||||
collector-builder-tag: | ||||||||||
description: The builder tag used by the build | ||||||||||
|
@@ -23,7 +24,11 @@ jobs: | |||||||||
name: Determine if builder image needs to be built | ||||||||||
runs-on: ubuntu-24.04 | ||||||||||
outputs: | ||||||||||
build-image: ${{ steps.changed.outputs.builder-changed }} | ||||||||||
build-image: ${{ steps.builder-tag.outputs.build-image || false }} | ||||||||||
collector-builder-tag: ${{ steps.builder-tag.outputs.collector-builder-tag || 'master'}} | ||||||||||
|
||||||||||
env: | ||||||||||
DEFAULT_BUILDER_TAG: master | ||||||||||
|
||||||||||
steps: | ||||||||||
- uses: actions/checkout@v4 | ||||||||||
|
@@ -38,11 +43,29 @@ jobs: | |||||||||
- builder/Dockerfile | ||||||||||
- .github/workflows/collector-builder.yml | ||||||||||
|
||||||||||
- name: Check labels and define builder tag | ||||||||||
id: builder-tag | ||||||||||
if: | | ||||||||||
steps.changed.outputs.builder-changed == 'true' || | ||||||||||
(github.event_name == 'push' && ( | ||||||||||
github.ref_type == 'tag' || startsWith(github.ref_name, 'release-') | ||||||||||
)) || | ||||||||||
contains(github.event.pull_request.labels.*.name, 'build-builder-image') || | ||||||||||
github.event_name == 'schedule' | ||||||||||
run: | | ||||||||||
COLLECTOR_BUILDER_TAG="${DEFAULT_BUILDER_TAG}" | ||||||||||
if [[ "${{ github.event_name }}" == 'pull_request' || \ | ||||||||||
"${{ github.ref_type }}" == 'tag' || \ | ||||||||||
"${{ github.ref_name }}" =~ ^release- ]]; then | ||||||||||
COLLECTOR_BUILDER_TAG="${{ inputs.collector-tag }}" | ||||||||||
fi | ||||||||||
|
||||||||||
echo "::notice::Rebuild builder image with tag ${COLLECTOR_BUILDER_TAG}" | ||||||||||
echo "collector-builder-tag=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_OUTPUT" | ||||||||||
echo "build-image=true" >> "$GITHUB_OUTPUT" | ||||||||||
|
||||||||||
build-builder-image: | ||||||||||
name: Build the builder image | ||||||||||
runs-on: ubuntu-24.04 | ||||||||||
# Multiarch builds sometimes take for eeeeeeeeeever | ||||||||||
timeout-minutes: 480 | ||||||||||
name: Build builder image | ||||||||||
needs: | ||||||||||
- builder-needs-rebuilding | ||||||||||
if: | | ||||||||||
|
@@ -57,7 +80,15 @@ jobs: | |||||||||
strategy: | ||||||||||
fail-fast: false | ||||||||||
matrix: | ||||||||||
arch: [amd64, ppc64le, s390x, arm64] | ||||||||||
arch: | ||||||||||
- amd64 | ||||||||||
- arm64 | ||||||||||
- ppc64le | ||||||||||
- s390x | ||||||||||
runs-on: ${{ (matrix.arch == 'arm64' && 'ubuntu-24.04-arm') || | ||||||||||
(matrix.arch == 'ppc64le' && 'ubuntu-24.04-ppc64le') || | ||||||||||
(matrix.arch == 's390x' && 'ubuntu-24.04-s390x') || | ||||||||||
'ubuntu-24.04' }} | ||||||||||
|
||||||||||
env: | ||||||||||
PLATFORM: linux/${{ matrix.arch }} | ||||||||||
|
@@ -68,74 +99,27 @@ jobs: | |||||||||
with: | ||||||||||
submodules: true | ||||||||||
|
||||||||||
- name: Set up QEMU | ||||||||||
uses: docker/setup-qemu-action@v3 | ||||||||||
|
||||||||||
- name: Set up Docker Buildx | ||||||||||
uses: docker/setup-buildx-action@v3 | ||||||||||
|
||||||||||
- uses: actions/setup-python@v5 | ||||||||||
with: | ||||||||||
python-version: "3.10" | ||||||||||
|
||||||||||
- uses: 'google-github-actions/auth@v2' | ||||||||||
with: | ||||||||||
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS_COLLECTOR_SVC_ACCT }}' | ||||||||||
|
||||||||||
- uses: 'google-github-actions/setup-gcloud@v2' | ||||||||||
|
||||||||||
- uses: ./.github/actions/setup-vm-creds | ||||||||||
with: | ||||||||||
gcp-ssh-key: ${{ secrets.GCP_SSH_KEY }} | ||||||||||
gcp-ssh-key-pub: ${{ secrets.GCP_SSH_KEY_PUB }} | ||||||||||
s390x-ssh-key: ${{ secrets.IBM_CLOUD_S390X_SSH_PRIVATE_KEY }} | ||||||||||
ppc64le-ssh-key: ${{ secrets.IBM_CLOUD_POWER_SSH_PRIVATE_KEY }} | ||||||||||
ppc64le-ssh-key-pub: ${{ secrets.IBM_CLOUD_POWER_SSH_PUBLIC_KEY }} | ||||||||||
s390x-key: ${{ secrets.IBM_CLOUD_S390x_API_KEY }} | ||||||||||
ppc64le-key: ${{ secrets.IBM_CLOUD_POWER_API_KEY }} | ||||||||||
redhat-username: ${{ secrets.REDHAT_USERNAME }} | ||||||||||
redhat-password: ${{ secrets.REDHAT_PASSWORD }} | ||||||||||
vm-type: all | ||||||||||
job-tag: builder | ||||||||||
|
||||||||||
- name: Create Build VMs | ||||||||||
if: | | ||||||||||
matrix.arch == 's390x' && | ||||||||||
(github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds')) | ||||||||||
- name: Install ansible on P&Z runners | ||||||||||
if: matrix.arch == 'ppc64le' || matrix.arch == 's390x' | ||||||||||
run: | | ||||||||||
make -C "${{ github.workspace }}/ansible" create-build-vms | ||||||||||
|
||||||||||
- name: Define builder tag | ||||||||||
id: builder-tag | ||||||||||
run: | | ||||||||||
COLLECTOR_BUILDER_TAG="${DEFAULT_BUILDER_TAG}" | ||||||||||
if [[ "${{ github.event_name }}" == 'pull_request' || \ | ||||||||||
"${{ github.ref_type }}" == 'tag' || \ | ||||||||||
"${{ github.ref_name }}" =~ ^release- ]]; then | ||||||||||
COLLECTOR_BUILDER_TAG="${{ inputs.collector-tag }}" | ||||||||||
fi | ||||||||||
|
||||||||||
echo "COLLECTOR_BUILDER_TAG=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_ENV" | ||||||||||
echo "collector-builder-tag=${COLLECTOR_BUILDER_TAG}" >> "$GITHUB_OUTPUT" | ||||||||||
sudo apt-get install -y ansible | ||||||||||
|
||||||||||
- name: Create ansible vars | ||||||||||
run: | | ||||||||||
{ | ||||||||||
echo "---" | ||||||||||
echo "stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }}" | ||||||||||
echo "stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }}" | ||||||||||
echo "rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }}" | ||||||||||
echo "rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }}" | ||||||||||
echo "collector_git_ref: ${{ github.ref }}" | ||||||||||
echo "collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }}" | ||||||||||
} > ${{ github.workspace }}/ansible/secrets.yml | ||||||||||
cat << EOF > ${{ github.workspace }}/ansible/secrets.yml | ||||||||||
--- | ||||||||||
stackrox_io_username: ${{ secrets.QUAY_STACKROX_IO_RW_USERNAME }} | ||||||||||
stackrox_io_password: ${{ secrets.QUAY_STACKROX_IO_RW_PASSWORD }} | ||||||||||
rhacs_eng_username: ${{ secrets.QUAY_RHACS_ENG_RW_USERNAME }} | ||||||||||
rhacs_eng_password: ${{ secrets.QUAY_RHACS_ENG_RW_PASSWORD }} | ||||||||||
collector_git_ref: ${{ github.ref }} | ||||||||||
collector_builder_tag: ${{ env.COLLECTOR_BUILDER_TAG }} | ||||||||||
EOF | ||||||||||
|
||||||||||
- name: Build images | ||||||||||
if: | | ||||||||||
(github.event_name != 'pull_request' && matrix.arch != 's390x') || | ||||||||||
matrix.arch == 'amd64' || | ||||||||||
(contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') && matrix.arch != 's390x') | ||||||||||
timeout-minutes: 480 | ||||||||||
run: | | ||||||||||
ansible-galaxy install -r ansible/requirements.yml | ||||||||||
ansible-playbook \ | ||||||||||
|
@@ -146,24 +130,6 @@ jobs: | |||||||||
-e @'${{ github.workspace }}/ansible/secrets.yml' \ | ||||||||||
ansible/ci-build-builder.yml | ||||||||||
|
||||||||||
- name: Build s390x images | ||||||||||
if: | | ||||||||||
(github.event_name != 'pull_request' && matrix.arch == 's390x') || | ||||||||||
(contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') && matrix.arch == 's390x') | ||||||||||
timeout-minutes: 480 | ||||||||||
run: | | ||||||||||
ansible-playbook \ | ||||||||||
-i ansible/ci \ | ||||||||||
-e build_hosts='job_id_${{ env.JOB_ID }}' \ | ||||||||||
-e arch='${{ matrix.arch }}' \ | ||||||||||
-e @'${{ github.workspace }}/ansible/secrets.yml' \ | ||||||||||
ansible/ci-build-builder.yml | ||||||||||
|
||||||||||
- name: Destroy VMs | ||||||||||
if: always() && matrix.arch == 's390x' | ||||||||||
run: | | ||||||||||
make -C ansible destroy-vms | ||||||||||
|
||||||||||
create-multiarch-manifest: | ||||||||||
needs: | ||||||||||
- build-builder-image | ||||||||||
|
@@ -174,8 +140,8 @@ jobs: | |||||||||
(needs.build-builder-image.outputs.collector-builder-tag != 'cache' && | ||||||||||
contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds')) | ||||||||||
env: | ||||||||||
COLLECTOR_BUILDER_TAG: ${{ needs.build-builder-image.outputs.collector-builder-tag }} | ||||||||||
ARCHS: amd64 ppc64le s390x arm64 | ||||||||||
COLLECTOR_BUILDER_TAG: ${{ needs.builder-needs-rebuilding.outputs.collector-builder-tag }} | ||||||||||
ARCHS: amd64 arm64 ppc64le s390x | ||||||||||
|
||||||||||
steps: | ||||||||||
- uses: actions/checkout@v4 | ||||||||||
|
@@ -208,15 +174,8 @@ jobs: | |||||||||
|
||||||||||
retag-x86-image: | ||||||||||
needs: | ||||||||||
- build-builder-image | ||||||||||
name: Retag x86 builder image | ||||||||||
runs-on: ubuntu-24.04 | ||||||||||
if: | | ||||||||||
github.event_name == 'pull_request' && | ||||||||||
needs.build-builder-image.outputs.collector-builder-tag != 'cache' && | ||||||||||
!contains(github.event.pull_request.labels.*.name, 'run-multiarch-builds') | ||||||||||
env: | ||||||||||
COLLECTOR_BUILDER_TAG: ${{ needs.build-builder-image.outputs.collector-builder-tag }} | ||||||||||
- build-builder-image | ||||||||||
- create-multiarch-manifest | ||||||||||
Comment on lines
+177
to
+178
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. I am not sure about the indentation here
Suggested change
|
||||||||||
steps: | ||||||||||
- name: Pull image to retag | ||||||||||
run: | | ||||||||||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Just guessing from the error in the last run