Skip to content

Commit de2748b

Browse files
feat(ci): enhance Docker workflow and E2E testing integration
- Added output of Docker image information to the GitHub Actions summary after pushing the image to the registry. - Updated E2E test workflow to include a build step that uses the Docker workflow, ensuring the latest image is pulled for testing. - Implemented login to the Docker registry and pulling of the operator image in the E2E test workflow. - Adjusted E2E test dependencies to ensure proper execution order and environment setup.
1 parent 06a8d53 commit de2748b

File tree

3 files changed

+45
-9
lines changed

3 files changed

+45
-9
lines changed

.github/workflows/docker.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,23 @@ jobs:
9999
subject-digest: ${{ steps.build.outputs.digest }}
100100
subject-name: ghcr.io/${{ github.repository }}
101101
push-to-registry: true
102+
103+
- name: Output image info to summary
104+
if: ${{ inputs.push-image }}
105+
run: |
106+
IMAGE_TAG="${{ inputs.version || github.sha }}"
107+
IMAGE_FULL="ghcr.io/${{ github.repository }}:${IMAGE_TAG}"
108+
109+
echo "## Docker Image" >> $GITHUB_STEP_SUMMARY
110+
echo "" >> $GITHUB_STEP_SUMMARY
111+
echo "Image pushed to registry:" >> $GITHUB_STEP_SUMMARY
112+
echo "" >> $GITHUB_STEP_SUMMARY
113+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
114+
echo "${IMAGE_FULL}" >> $GITHUB_STEP_SUMMARY
115+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
116+
echo "" >> $GITHUB_STEP_SUMMARY
117+
echo "Pull command:" >> $GITHUB_STEP_SUMMARY
118+
echo "" >> $GITHUB_STEP_SUMMARY
119+
echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY
120+
echo "docker pull ${IMAGE_FULL}" >> $GITHUB_STEP_SUMMARY
121+
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY

.github/workflows/tests.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,19 @@ jobs:
2929

3030
- name: Run tests
3131
run: make test
32+
33+
build:
34+
uses: ./.github/workflows/docker.yml
35+
with:
36+
push-image: true
37+
secrets:
38+
GH_PAT: ${{ secrets.GH_PAT }}
39+
3240
e2e:
3341
name: E2E Tests
3442
runs-on: ubuntu-latest
35-
needs: [test]
43+
needs: [build]
44+
timeout-minutes: 10
3645

3746
steps:
3847
- name: Checkout code
@@ -44,17 +53,23 @@ jobs:
4453
go-version: ${{ env.GO_VERSION }}
4554
gh-token: ${{ secrets.GH_PAT }}
4655

56+
- name: Login to Registry
57+
uses: docker/login-action@v3
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.repository_owner }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
63+
- name: Pull operator image
64+
run: docker pull ghcr.io/${{ github.repository }}:${{ github.sha }}
65+
4766
- name: Install Kind
4867
uses: helm/kind-action@v1
4968
with:
5069
install_only: true
5170

5271
- name: Run E2E tests
5372
run: make test-e2e
54-
55-
build:
56-
uses: ./.github/workflows/docker.yml
57-
with:
58-
push-image: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
59-
secrets:
60-
GH_PAT: ${{ secrets.GH_PAT }}
73+
env:
74+
E2E_SKIP_BUILD: "true"
75+
E2E_OPERATOR_IMAGE: "ghcr.io/${{ github.repository }}:${{ github.sha }}"

test/e2e/Dockerfile.e2e

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Simplified Dockerfile for e2e testing
1+
# Simplified Dockerfile for local e2e testing
2+
# In CI, the production image from ghcr.io is used instead
23
# Assumes binary is pre-built locally for the correct architecture
34
FROM gcr.io/distroless/static:nonroot
45
WORKDIR /

0 commit comments

Comments
 (0)