Skip to content

Commit 7b55dd6

Browse files
Merge branch 'main' into feature/add-wireguard-sidecar
2 parents 276287e + 5fb1b00 commit 7b55dd6

22 files changed

+1051
-288
lines changed

.github/workflows/.DS_Store

6 KB
Binary file not shown.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Build Docker Images
2+
env:
3+
REGISTRY: ghcr.io
4+
IMAGE_NAME: ${{ github.repository }}
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
ref:
10+
required: true
11+
type: string
12+
repository:
13+
description: 'Repository name with owner.'
14+
required: false
15+
default: ${{ github.repository }}
16+
type: string
17+
tag:
18+
required: false
19+
default: dev-${{ github.sha }}
20+
type: string
21+
push:
22+
required: true
23+
type: boolean
24+
latest:
25+
required: false
26+
default: false
27+
type: boolean
28+
upload_images:
29+
required: false
30+
default: false
31+
type: boolean
32+
platforms:
33+
description: 'Docker image platforms'
34+
required: false
35+
default: 'linux/amd64, linux/arm64'
36+
type: string
37+
38+
39+
permissions:
40+
contents: read
41+
packages: write
42+
43+
jobs:
44+
build-images:
45+
strategy:
46+
matrix:
47+
image:
48+
- manager
49+
- agent
50+
runs-on: ubuntu-latest
51+
52+
steps:
53+
- name: Checkout repository
54+
uses: actions/checkout@v3
55+
with:
56+
repository: ${{ inputs.repository }}
57+
ref: ${{ inputs.ref }}
58+
submodules: true
59+
60+
- name: Set up QEMU
61+
uses: docker/setup-qemu-action@v2
62+
63+
- name: Set up Docker Buildx
64+
id: buildx
65+
uses: docker/setup-buildx-action@v2
66+
with:
67+
install: true
68+
69+
- name: Login to GitHub Container Registry
70+
uses: docker/login-action@v2
71+
with:
72+
registry: ghcr.io
73+
username: ${{ github.repository_owner }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Generate docker metadata
77+
id: image-meta
78+
uses: docker/metadata-action@v4
79+
with:
80+
tags: |
81+
type=raw,value=latest, enable=${{ inputs.latest}}
82+
type=raw,value=${{ inputs.tag }}
83+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}/${{ matrix.image }}
84+
85+
- uses: actions/setup-go@v4
86+
with:
87+
go-version: '^1.20'
88+
89+
- name: Build and push docker images
90+
if: ${{ inputs.push == true }}
91+
uses: docker/build-push-action@v4
92+
with:
93+
context: .
94+
file: images/${{ matrix.image }}/Dockerfile
95+
platforms: ${{ inputs.platforms }}
96+
push: true
97+
tags: ${{ steps.image-meta.outputs.tags }}
98+
labels: ${{ steps.image-meta.outputs.labels }}
99+
100+
- name: Build and upload docker image to job artifact
101+
if: ${{ inputs.upload_images == true }}
102+
uses: docker/build-push-action@v4
103+
with:
104+
context: .
105+
file: images/${{ matrix.image }}/Dockerfile
106+
platforms: ${{ inputs.platforms }}
107+
outputs: type=docker,dest=/tmp/${{matrix.image}}.tar
108+
push: false
109+
tags: ${{ steps.image-meta.outputs.tags }}
110+
labels: ${{ steps.image-meta.outputs.labels }}
111+
112+
- name: Upload artifact
113+
if: ${{ inputs.upload_images == true }}
114+
uses: actions/upload-artifact@v3
115+
with:
116+
name: images
117+
path: /tmp/${{matrix.image}}.tar
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
permissions: write-all
8+
9+
jobs:
10+
generate-next-semantic-version:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
name: Checkout repository
15+
with:
16+
submodules: true
17+
- name: semantic-release extract new version
18+
id: extract
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
run: |
22+
npm install @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/changelog @semantic-release/git semantic-release/exec
23+
echo "version=v$(npx semantic-release --dryRun | grep -oP 'Published release \K.*? ')"
24+
echo "version=v$(npx semantic-release --dryRun | grep -oP 'Published release \K.*? ')" >> "$GITHUB_OUTPUT"
25+
outputs:
26+
version: ${{ steps.extract.outputs.version }}
27+
28+
build-images:
29+
needs: [generate-next-semantic-version]
30+
uses: ./.github/workflows/build-images.yaml
31+
with:
32+
latest: true
33+
push: true
34+
tag: ${{needs.generate-next-semantic-version.outputs.version}}
35+
ref: ${{ github.sha }}
36+
37+
release:
38+
needs: [build-images]
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v3
42+
name: Checkout repository
43+
with:
44+
submodules: true
45+
persist-credentials: false
46+
ref: ${{ github.sha }}
47+
48+
- name: semantic-release
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.ADMIN_SECRET }}
51+
run : |
52+
npm install @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/changelog @semantic-release/git semantic-release/exec
53+
npx semantic-release
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Manual DEV Release
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
repository:
6+
description: 'Repository name with owner.'
7+
required: true
8+
default: 'jodevsa/wireguard-operator'
9+
type: string
10+
branch:
11+
description: 'The branch, tag or SHA to checkout.'
12+
required: true
13+
default: 'main'
14+
type: string
15+
platforms:
16+
description: 'Docker image platforms'
17+
required: true
18+
default: 'linux/amd64, linux/arm64'
19+
type: string
20+
tag:
21+
description: 'Docker image tag'
22+
required: true
23+
default: 'feature-1'
24+
type: string
25+
26+
env:
27+
REGISTRY: ghcr.io
28+
IMAGE_NAME: ${{ github.repository }}
29+
30+
permissions:
31+
contents: read
32+
packages: write
33+
34+
jobs:
35+
build-images:
36+
uses: ./.github/workflows/build-images.yaml
37+
with:
38+
push: true
39+
latest: false
40+
ref: ${{ inputs.branch }}
41+
repository: ${{ inputs.repository }}
42+
tag: dev-${{ inputs.tag }}
43+
44+
save-release:
45+
needs: [build-images]
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Set up Go
49+
uses: actions/setup-go@v4
50+
with:
51+
go-version: 1.20
52+
53+
- name: Checkout repository
54+
uses: actions/checkout@v3
55+
with:
56+
repository: ${{ inputs.repository }}
57+
ref: ${{ inputs.branch }}
58+
submodules: true
59+
60+
- name: prepare new release
61+
env:
62+
MANAGER_IMAGE: ghcr.io/${{ inputs.repository }}/manager:dev-${{ inputs.tag }}
63+
AGENT_IMAGE: ghcr.io/${{ inputs.repository }}/agent:dev-${{ inputs.tag }}
64+
run : |
65+
make generate-release-file AGENT_IMAGE="$AGENT_IMAGE" MANAGER_IMAGE="$MANAGER_IMAGE"
66+
- name: upload release
67+
uses: actions/upload-artifact@v3
68+
with:
69+
name: release.yaml
70+
path: ${{ github.workspace }}/release.yaml
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: PR pipeline
2+
on:
3+
pull_request: {}
4+
5+
permissions:
6+
contents: read
7+
packages: write
8+
9+
jobs:
10+
build-images:
11+
uses: ./.github/workflows/build-images.yaml
12+
with:
13+
push: false
14+
upload_images: true
15+
platforms: "linux/amd64"
16+
ref: ${{ github.ref }}
17+
tag: dev
18+
19+
e2e:
20+
runs-on: ubuntu-latest
21+
needs: build-images
22+
steps:
23+
- name: Set up Docker Buildx
24+
uses: docker/setup-buildx-action@v2
25+
26+
- name: Download artifact
27+
uses: actions/download-artifact@v3
28+
with:
29+
name: images
30+
path: /tmp
31+
32+
- name: Load image
33+
run: |
34+
docker load --input /tmp/agent.tar
35+
docker load --input /tmp/manager.tar
36+
docker image ls -a
37+
38+
- name: Checkout repository
39+
uses: actions/checkout@v3
40+
with:
41+
repository: ${{ inputs.repository }}
42+
ref: ${{ inputs.ref }}
43+
submodules: true
44+
45+
- uses: actions/setup-go@v4
46+
with:
47+
go-version: '^1.20'
48+
49+
- uses: azure/setup-kubectl@v3
50+
51+
- name: run e2e
52+
env:
53+
REGISTRY: ghcr.io
54+
AGENT_IMAGE: ghcr.io/${{ github.repository }}/agent:dev
55+
MANAGER_IMAGE: ghcr.io/${{ github.repository }}/manager:dev
56+
run: |
57+
make kind
58+
make run-e2e AGENT_IMAGE="$AGENT_IMAGE" MANAGER_IMAGE="$MANAGER_IMAGE"

0 commit comments

Comments
 (0)