Skip to content

Commit c817b82

Browse files
chore: update test timeout and enhance GitHub Actions workflows
- Increased the timeout for e2e tests from 10 minutes to 15 minutes in the Makefile. - Added steps in the GitHub Actions workflow to output Docker image information to the summary after building. - Modified the tests workflow to include a build job that pushes the Docker image and pulls it for e2e tests. - Updated the Dockerfile.e2e comment to clarify its usage for local testing versus CI.
1 parent 06a8d53 commit c817b82

File tree

4 files changed

+49
-10
lines changed

4 files changed

+49
-10
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: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,22 @@ 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: 20
45+
permissions:
46+
contents: read
47+
packages: read
3648

3749
steps:
3850
- name: Checkout code
@@ -44,17 +56,23 @@ jobs:
4456
go-version: ${{ env.GO_VERSION }}
4557
gh-token: ${{ secrets.GH_PAT }}
4658

59+
- name: Login to Registry
60+
uses: docker/login-action@v3
61+
with:
62+
registry: ghcr.io
63+
username: ${{ github.repository_owner }}
64+
password: ${{ secrets.GITHUB_TOKEN }}
65+
66+
- name: Pull operator image
67+
run: docker pull ghcr.io/${{ github.repository }}:${{ github.sha }}
68+
4769
- name: Install Kind
4870
uses: helm/kind-action@v1
4971
with:
5072
install_only: true
5173

5274
- name: Run E2E tests
5375
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 }}
76+
env:
77+
E2E_SKIP_BUILD: "true"
78+
E2E_OPERATOR_IMAGE: "ghcr.io/${{ github.repository }}:${{ github.sha }}"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ test: manifests generate fmt vet envtest ## Run tests.
144144
# Run the e2e tests using e2e-framework (auto-creates Kind cluster)
145145
.PHONY: test-e2e
146146
test-e2e: ## Run e2e tests against a Kind cluster (auto-created)
147-
go test ./test/e2e/... -v -timeout 10m
147+
go test ./test/e2e/... -v -timeout 15m
148148

149149
.PHONY: lint
150150
lint: golangci-lint ## Run golangci-lint linter

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)