Skip to content

Commit 2f57ab7

Browse files
committed
Add workflows for running e2e tests on azure & gcp
Disable cron for azure as the account can't be used at present. Signed-off-by: Sunny <[email protected]>
1 parent 4686dd5 commit 2f57ab7

File tree

2 files changed

+158
-0
lines changed

2 files changed

+158
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: integration-azure
2+
3+
on:
4+
workflow_dispatch:
5+
# schedule:
6+
# - cron: "0 6 * * *"
7+
# push:
8+
# branches:
9+
# - main
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
working-directory: ./tests/integration
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
23+
- name: Set up Go
24+
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
25+
with:
26+
go-version: 1.20.x
27+
cache-dependency-path: tests/integration/go.sum
28+
- name: Authenticate to Azure
29+
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.6
30+
with:
31+
creds: '{"clientId":"${{ secrets.IRC_E2E_AZ_ARM_CLIENT_ID }}","clientSecret":"${{ secrets.IRC_E2E_AZ_ARM_CLIENT_SECRET }}","subscriptionId":"${{ secrets.IRC_E2E_AZ_ARM_SUBSCRIPTION_ID }}","tenantId":"${{ secrets.IRC_E2E_AZ_ARM_TENANT_ID }}"}'
32+
- name: Set up QEMU
33+
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
34+
- name: Set up Docker Buildx
35+
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
36+
- name: Cache Docker layers
37+
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
38+
id: cache
39+
with:
40+
path: /tmp/.buildx-cache
41+
key: ${{ runner.os }}-buildx-ghcache-${{ github.sha }}
42+
restore-keys: |
43+
${{ runner.os }}-buildx-ghcache-
44+
- name: Set dynamic variables in .env
45+
run: |
46+
cat > .env <<EOF
47+
export TF_VAR_tags='{"environment"="github", "ci"="true", "repo"="image-reflector-controller", "createdat"="$(date -u +x%Y-%m-%d_%Hh%Mm%Ss)"}'
48+
EOF
49+
- name: Print .env for dynamic tag value reference
50+
run: cat .env
51+
- name: Build controller
52+
run: |
53+
make docker-build IMG=fluxcd/image-reflector-controller:dev \
54+
BUILD_PLATFORMS=linux/amd64 \
55+
BUILD_ARGS="--cache-from=type=local,src=/tmp/.buildx-cache \
56+
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max"
57+
working-directory: ./
58+
- # Temp fix
59+
# https://github.com/docker/build-push-action/issues/252
60+
# https://github.com/moby/buildkit/issues/1896
61+
name: Move cache
62+
run: |
63+
rm -rf /tmp/.buildx-cache
64+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
65+
- name: Run tests
66+
run: . .env && make test-azure TEST_IMG=fluxcd/image-reflector-controller:dev
67+
env:
68+
ARM_CLIENT_ID: ${{ secrets.IRC_E2E_AZ_ARM_CLIENT_ID }}
69+
ARM_CLIENT_SECRET: ${{ secrets.IRC_E2E_AZ_ARM_CLIENT_SECRET }}
70+
ARM_SUBSCRIPTION_ID: ${{ secrets.IRC_E2E_AZ_ARM_SUBSCRIPTION_ID }}
71+
ARM_TENANT_ID: ${{ secrets.IRC_E2E_AZ_ARM_TENANT_ID }}
72+
TF_VAR_azure_location: ${{ vars.TF_VAR_azure_location }}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: integration-gcp
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 6 * * *"
7+
# push:
8+
# branches:
9+
# - main
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
test:
16+
runs-on: ubuntu-latest
17+
defaults:
18+
run:
19+
working-directory: ./tests/integration
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
23+
- name: Set up Go
24+
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
25+
with:
26+
go-version: 1.20.x
27+
cache-dependency-path: tests/integration/go.sum
28+
- name: Authenticate to Google Cloud
29+
uses: google-github-actions/auth@35b0e87d162680511bf346c299f71c9c5c379033 # v1.1.1
30+
id: 'auth'
31+
with:
32+
credentials_json: '${{ secrets.IRC_E2E_GOOGLE_CREDENTIALS }}'
33+
token_format: 'access_token'
34+
- name: Set up gcloud
35+
uses: google-github-actions/setup-gcloud@e30db14379863a8c79331b04a9969f4c1e225e0b # v1.1.1
36+
- name: Set up QEMU
37+
uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18 # v2.1.0
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@4b4e9c3e2d4531116a6f8ba8e71fc6e2cb6e6c8c # v2.5.0
40+
- name: Cache Docker layers
41+
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
42+
id: cache
43+
with:
44+
path: /tmp/.buildx-cache
45+
key: ${{ runner.os }}-buildx-ghcache-${{ github.sha }}
46+
restore-keys: |
47+
${{ runner.os }}-buildx-ghcache-
48+
- name: Log into gcr.io
49+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
50+
with:
51+
registry: gcr.io
52+
username: oauth2accesstoken
53+
password: ${{ steps.auth.outputs.access_token }}
54+
- name: Log into us-central1-docker.pkg.dev
55+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a # v2.1.0
56+
with:
57+
registry: us-central1-docker.pkg.dev
58+
username: oauth2accesstoken
59+
password: ${{ steps.auth.outputs.access_token }}
60+
- name: Set dynamic variables in .env
61+
run: |
62+
cat > .env <<EOF
63+
export TF_VAR_tags='{"environment"="github", "ci"="true", "repo"="image-reflector-controller", "createdat"="$(date -u +x%Y-%m-%d_%Hh%Mm%Ss)"}'
64+
EOF
65+
- name: Print .env for dynamic tag value reference
66+
run: cat .env
67+
- name: Build controller
68+
run: |
69+
make docker-build IMG=fluxcd/image-reflector-controller:dev \
70+
BUILD_PLATFORMS=linux/amd64 \
71+
BUILD_ARGS="--cache-from=type=local,src=/tmp/.buildx-cache \
72+
--cache-to=type=local,dest=/tmp/.buildx-cache-new,mode=max"
73+
working-directory: ./
74+
- # Temp fix
75+
# https://github.com/docker/build-push-action/issues/252
76+
# https://github.com/moby/buildkit/issues/1896
77+
name: Move cache
78+
run: |
79+
rm -rf /tmp/.buildx-cache
80+
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
81+
- name: Run tests
82+
run: . .env && make test-gcp TEST_IMG=fluxcd/image-reflector-controller:dev
83+
env:
84+
TF_VAR_gcp_project_id: ${{ vars.TF_VAR_gcp_project_id }}
85+
TF_VAR_gcp_region: ${{ vars.TF_VAR_gcp_region }}
86+
TF_VAR_gcp_zone: ${{ vars.TF_VAR_gcp_zone }}

0 commit comments

Comments
 (0)