-
Notifications
You must be signed in to change notification settings - Fork 2
141 lines (129 loc) · 4.05 KB
/
main.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
name: CI
on:
push:
branches:
- "**"
env:
REGISTRY: "quay.io"
IMAGE_BASE_NAME: "quay.io/travelping/fpp-vpp"
IMAGE_EXPIRES_AFTER: 7d
jobs:
build:
runs-on:
- ubuntu-22.04
strategy:
matrix:
build_type: [debug, release]
env:
QUAY_USER_ID: ${{ secrets.QUAY_USER_ID }}
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
driver-opts: |
image=moby/buildkit:latest
- name: Prepare repo
run: |
git config --global user.email "[email protected]"
git config --global user.name "dummy user"
hack/update-vpp.sh
- name: Get image tags
id: tags
run: |
. vpp.spec
VPP_VERSION=$(vpp/build-root/scripts/version | sed 's/~.*//')
GIT_SHA=$(git rev-parse HEAD | cut -c1-9)
BASE_TAG="${VPP_VERSION}-${GIT_SHA}"
echo "base_tag=${BASE_TAG}" >> $GITHUB_OUTPUT
echo "dev_tag=${BASE_TAG}_dev_${{ matrix.build_type }}" >> $GITHUB_OUTPUT
echo "final_tag=${BASE_TAG}_${{ matrix.build_type }}" >> $GITHUB_OUTPUT
echo "vpp_release=${VPP_RELEASE}" >> $GITHUB_OUTPUT
echo "vpp_commit=${VPP_COMMIT}" >> $GITHUB_OUTPUT
- name: Login to quay.io
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USER_ID }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build base artifacts
uses: docker/build-push-action@v6
with:
context: .
push: false
target: artifacts
outputs: type=local,dest=/tmp/_out
build-args: |
BUILD_TYPE=${{ matrix.build_type }}
cache-from: |
type=gha
type=gha,scope=ccache
cache-to: |
type=gha,mode=max
type=gha,mode=max,scope=ccache
- name: Build dev image
uses: docker/build-push-action@v6
with:
context: .
push: true
target: dev-stage
tags: ${{ env.IMAGE_BASE_NAME }}:${{ steps.tags.outputs.dev_tag }}
build-args: |
BUILD_TYPE=${{ matrix.build_type }}
labels: |
vpp.release=${{ steps.tags.outputs.vpp_release }}
vpp.commit=${{ steps.tags.outputs.vpp_commit }}
quay.expires-after=${{ env.IMAGE_EXPIRES_AFTER }}
cache-from: |
type=gha
type=gha,scope=ccache
cache-to: |
type=gha,mode=max
type=gha,mode=max,scope=ccache
- name: Build final image
uses: docker/build-push-action@v6
with:
context: .
push: true
target: final-stage
tags: ${{ env.IMAGE_BASE_NAME }}:${{ steps.tags.outputs.final_tag }}
build-args: |
BUILD_TYPE=${{ matrix.build_type }}
labels: |
vpp.release=${{ steps.tags.outputs.vpp_release }}
vpp.commit=${{ steps.tags.outputs.vpp_commit }}
quay.expires-after=${{ env.IMAGE_EXPIRES_AFTER }}
cache-from: |
type=gha
type=gha,scope=ccache
- name: Save image names
run: |
echo "${{ env.IMAGE_BASE_NAME }}:${{ steps.tags.outputs.dev_tag }}" > "image-dev-${{ matrix.build_type }}.txt"
echo "${{ env.IMAGE_BASE_NAME }}:${{ steps.tags.outputs.final_tag }}" > "image-${{ matrix.build_type }}.txt"
- name: Upload debs
uses: actions/upload-artifact@v4
with:
name: debs-${{ matrix.build_type }}
path: /tmp/_out/*
- name: Upload image.txt
uses: actions/upload-artifact@v4
with:
name: image-${{ matrix.build_type }}
path: image-${{ matrix.build_type }}.txt
- name: Upload image.txt for the dev image
uses: actions/upload-artifact@v4
with:
name: image-dev-${{ matrix.build_type }}
path: image-dev-${{ matrix.build_type }}.txt
# dummy job for release.yaml to wait on
conclude:
runs-on:
- ubuntu-22.04
needs:
- build
steps:
- name: Dummy step
run: echo ok