-
Notifications
You must be signed in to change notification settings - Fork 16
154 lines (140 loc) · 5.31 KB
/
docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: docker
on:
pull_request:
paths:
- .github/workflows/docker.yaml
- Dockerfile
- go.*
- api/**
- internal/**
- e2e_test/**
- '!**/*_test.go'
- '!**/*.md'
push:
branches:
- main
tags:
- v*
paths:
- .github/workflows/docker.yaml
- Dockerfile
- go.*
- api/**
- internal/**
- e2e_test/**
- '!**/*_test.go'
- '!**/*.md'
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
packages: write
outputs:
image-uri: ghcr.io/${{ github.repository }}@${{ steps.build.outputs.digest }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: go-version
run: echo "go-version=$(sed -ne '/^go /s/^go //p' go.mod)" >> "$GITHUB_OUTPUT"
- uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
id: metadata
with:
images: ghcr.io/${{ github.repository }}
- uses: int128/docker-build-cache-config-action@622932dfa73db7d3a65e40d5fcc094f2101e659a # v1.37.0
id: cache
with:
image: ghcr.io/${{ github.repository }}/cache
- uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
- uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1
- uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
id: build
with:
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
cache-from: ${{ steps.cache.outputs.cache-from }}
cache-to: ${{ steps.cache.outputs.cache-to }}
build-args: |
go_version=${{ steps.go-version.outputs.go-version }}
platforms: |
linux/amd64
linux/arm64
e2e-test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version-file: go.mod
cache-dependency-path: go.sum
# Set up the test environment
- uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1.11.0
id: e2e-test-token
with:
app-id: ${{ secrets.E2E_SETUP_GITHUB_APP_ID }}
private-key: ${{ secrets.E2E_SETUP_GITHUB_APP_PRIVATE_KEY }}
repositories: argocd-commenter-e2e-test
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
token: ${{ steps.e2e-test-token.outputs.token }}
repository: int128/argocd-commenter-e2e-test
path: e2e_test/argocd-commenter-e2e-test-repository
- run: make -C e2e_test setup-fixture-branch
- run: make -C e2e_test cluster
- run: make -C e2e_test deploy-argocd
- uses: docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5.6.1
id: metadata
with:
images: ghcr.io/${{ github.repository }}
# set outputs.tags to single tag
flavor: latest=false
- uses: int128/wait-for-docker-image-action@4975bd239c55b16ec86bbcca9cab53ac056f8e07 # v1.8.0
with:
tags: ${{ steps.metadata.outputs.tags }}
- run: make -C e2e_test deploy-controller
env:
CONTROLLER_IMAGE: ${{ steps.metadata.outputs.tags }}
GITHUB_APP_ID: ${{ secrets.E2E_GITHUB_APP_ID }}
GITHUB_APP_INSTALLATION_ID: ${{ secrets.E2E_GITHUB_APP_INSTALLATION_ID }}
GITHUB_APP_PRIVATE_KEY: ${{ secrets.E2E_GITHUB_APP_PRIVATE_KEY }}
- run: make -C e2e_test wait-for-apps
# Run the test
- uses: int128/deployment-action@4ce410506a94c733cb26d98f144d2810e499496d # v1.39.0
id: deployment-app1
with:
environment-suffix: /app1
- uses: int128/deployment-action@4ce410506a94c733cb26d98f144d2810e499496d # v1.39.0
id: deployment-app2
with:
environment-suffix: /app2
- uses: int128/deployment-action@4ce410506a94c733cb26d98f144d2810e499496d # v1.39.0
id: deployment-app3
with:
environment-suffix: /app3
- run: make -C e2e_test deploy-app1
env:
DEPLOYMENT_URL: ${{ steps.deployment-app1.outputs.url }}
GITHUB_TOKEN: ${{ steps.e2e-test-token.outputs.token }}
- run: make -C e2e_test restart-app1
- run: make -C e2e_test deploy-app2
env:
DEPLOYMENT_URL: ${{ steps.deployment-app2.outputs.url }}
GITHUB_TOKEN: ${{ steps.e2e-test-token.outputs.token }}
- run: make -C e2e_test deploy-app3
env:
DEPLOYMENT_URL: ${{ steps.deployment-app3.outputs.url }}
GITHUB_TOKEN: ${{ steps.e2e-test-token.outputs.token }}
# Show logs
- run: make -C e2e_test logs-controller
if: always()
- run: make -C e2e_test logs-argocd-application-controller
if: always()
- run: make -C e2e_test logs-argocd-applicationset-controller
if: always()