Skip to content

Commit c411b5f

Browse files
authored
Ensure packages are installed on images (#7991)
1 parent e0c5250 commit c411b5f

File tree

6 files changed

+916
-3
lines changed

6 files changed

+916
-3
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,66 @@ jobs:
377377
secrets: inherit
378378
if: ${{ inputs.force || (needs.checks.outputs.forked_workflow == 'true' && needs.checks.outputs.docs_only == 'false') || (needs.checks.outputs.forked_workflow == 'false' && needs.checks.outputs.stable_image_exists != 'true' && needs.checks.outputs.docs_only == 'false') }}
379379

380+
package-tests:
381+
if: ${{ needs.checks.outputs.docs_only != 'true' && (inputs.run_tests && inputs.run_tests || true) }}
382+
name: Package Tests
383+
runs-on: ubuntu-22.04
384+
needs: [checks, binaries, build-docker, build-docker-plus, build-docker-nap]
385+
permissions:
386+
contents: read
387+
pull-requests: write # for package report
388+
id-token: write
389+
steps:
390+
- name: Checkout Repository
391+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
392+
393+
- name: Setup QEMU
394+
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0
395+
with:
396+
platforms: arm64
397+
if: ${{ needs.checks.outputs.forked_workflow == 'false' || needs.checks.outputs.docs_only == 'false' }}
398+
399+
- name: Authenticate to Google Cloud
400+
id: auth
401+
uses: google-github-actions/auth@ba79af03959ebeac9769e648f473a284504d9193 # v2.1.10
402+
with:
403+
token_format: access_token
404+
workload_identity_provider: ${{ secrets.GCR_WORKLOAD_IDENTITY }}
405+
service_account: ${{ secrets.GCR_SERVICE_ACCOUNT }}
406+
if: ${{ needs.checks.outputs.forked_workflow == 'false' || needs.checks.outputs.docs_only == 'false' }}
407+
408+
- name: Login to GCR
409+
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
410+
with:
411+
registry: gcr.io
412+
username: oauth2accesstoken
413+
password: ${{ steps.auth.outputs.access_token }}
414+
if: ${{ needs.checks.outputs.forked_workflow == 'false' || needs.checks.outputs.docs_only == 'false' }}
415+
416+
- name: Install Python dependencies
417+
run: |
418+
make -f tests/Makefile setup-venv
419+
if: ${{ needs.checks.outputs.forked_workflow == 'false' || needs.checks.outputs.docs_only == 'false' }}
420+
421+
- name: Run tests
422+
id: packages
423+
run: |
424+
source tests/venv/bin/activate
425+
python tests/scripts/check_container_packages.py --tag ${{ needs.checks.outputs.build_tag }} --log package_output.txt
426+
if: ${{ needs.checks.outputs.forked_workflow == 'false' || needs.checks.outputs.docs_only == 'false' }}
427+
428+
- name: Add comment
429+
run: |
430+
# make sure the comment is formatted correctly, as a code block
431+
echo '### Package Report' > output.txt
432+
echo '```' >> output.txt
433+
cat package_output.txt >> output.txt
434+
echo '```' >> output.txt
435+
gh pr comment --edit-last --create-if-none ${{ github.event.pull_request.number }} -F output.txt
436+
env:
437+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
438+
if: ${{ ( needs.checks.outputs.forked_workflow == 'false' || needs.checks.outputs.docs_only == 'false' ) && github.event.pull_request }}
439+
380440
helm-tests:
381441
if: ${{ needs.checks.outputs.docs_only != 'true' && (inputs.run_tests && inputs.run_tests || true) }}
382442
name: Helm Tests ${{ matrix.base-os }}
@@ -677,10 +737,12 @@ jobs:
677737
if: ${{ !cancelled() }}
678738
runs-on: ubuntu-22.04
679739
name: Final CI Results
680-
needs: [tag-stable, build-docker, build-docker-plus, build-docker-nap, smoke-tests-oss, smoke-tests-plus, smoke-tests-nap]
740+
needs: [tag-stable, build-docker, build-docker-plus, build-docker-nap, smoke-tests-oss, smoke-tests-plus, smoke-tests-nap, package-tests, helm-tests]
681741
steps:
682742
- run: |
683743
tagResult="${{ needs.tag-stable.result }}"
744+
packageResult="${{ needs.package-tests.result }}"
745+
helmResult="${{ needs.helm-tests.result }}"
684746
smokeOSSResult="${{ needs.smoke-tests-oss.result }}"
685747
smokePlusResult="${{ needs.smoke-tests-plus.result }}"
686748
smokeNAPResult="${{ needs.smoke-tests-nap.result }}"
@@ -708,6 +770,12 @@ jobs:
708770
if [[ $buildNAPResult != "success" && $buildNAPResult != "skipped" ]]; then
709771
exit 1
710772
fi
773+
if [[ $helmResult != "success" && $helmResult != "skipped" ]]; then
774+
exit 1
775+
fi
776+
if [[ $packageResult != "success" && $packageResult != "skipped" ]]; then
777+
exit 1
778+
fi
711779
712780
trigger-image-promotion:
713781
name: Promote images on Force Run

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ repos:
2727
args: [--fix=lf]
2828
- id: name-tests-test
2929
args: [--pytest-test-first]
30-
exclude: ^(tests/suite/utils|tests/suite/fixtures|tests/suite/grpc|tests/settings.py)
30+
exclude: ^(tests/suite/utils|tests/suite/fixtures|tests/suite/grpc|tests/settings.py|tests/scripts)
3131
- id: no-commit-to-branch
3232
- id: requirements-txt-fixer
3333
- id: fix-byte-order-marker

tests/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ $(MINIKUBE_KUBE_CONFIG_FOLDER): $(KUBE_CONFIG_FOLDER)
5656
setup-venv:
5757
$(PYTHON) -m venv $(ROOT_DIR)/tests/venv;
5858
source $(ROOT_DIR)/tests/venv/bin/activate \
59-
&& pip install --require-hashes -r requirements.txt --no-deps \
59+
&& pip install --require-hashes -r $(ROOT_DIR)/tests/requirements.txt --no-deps \
6060
&& playwright install --with-deps chromium
6161

6262

0 commit comments

Comments
 (0)