forked from parca-dev/parca-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
216 lines (178 loc) · 6.49 KB
/
release.yml
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Release
on:
push:
tags:
- v*
permissions:
contents: write
env:
# renovate: datasource=go depName=github.com/goreleaser/goreleaser
GORELEASER_VERSION: v1.9.2
jobs:
dependencies:
name: Build and download dependencies
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923 # tag=v3.2.0
with:
go-version-file: .go-version
cache: true
- name: Set up Rust
run: rustup show
- name: Rust cache
uses: Swatinem/rust-cache@cb2cf0cc7c5198d3364b9630e2c3d457f160790c # tag=v1.4.0
with:
working-directory: ./bpf
- name: Install LLVM (Aya, BPF dependency)
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo -e "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main\n" | sudo tee /etc/apt/sources.list.d/llvm.list
sudo apt-get update -y
sudo apt-get install -yq llvm-14-dev libclang-14-dev
- name: Run eBPF toolchain setup
run: |
make -C bpf setup
cd bpf && cargo check
- name: Build BPF
run: make bpf
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
with:
name: ebpf-object-file
path: pkg/profiler/cpu-profiler.bpf.o
if-no-files-found: error
binaries:
name: Goreleaser release
runs-on: ubuntu-latest
needs: dependencies
if: startsWith(github.ref, 'refs/tags/')
container:
image: docker.io/goreleaser/goreleaser-cross:v1.18.3
options: --privileged
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out the code
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: Initialize and update libbpf submodule
run: git submodule init && git submodule update
- name: Install libbpf dependencies
run: |
apt-get update -y
apt-get install -yq lld libelf-dev zlib1g-dev libelf-dev:arm64 zlib1g-dev:arm64
- uses: actions/download-artifact@v3
with:
name: ebpf-object-file
path: pkg/profiler/cpu-profiler.bpf.o
- name: Run Goreleaser
run: goreleaser release --rm-dist
- name: Archive generated artifacts
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # tag=v3.1.0
with:
name: parca-agent-dist-release
if-no-files-found: error
path: |
dist
!dist/libbpf
!dist/*.txt
manifests:
name: Manifests generate and release
runs-on: ubuntu-latest
needs: binaries
steps:
- name: Check out the code
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: Set up Go
uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923 # tag=v3.2.0
with:
go-version-file: .go-version
- name: Set up Jsonnet
run: ./env.sh
- name: Generate
run: cd deploy && make --always-make vendor manifests
- name: Prepare
run: |
tar -zcvf deploy/manifests.tar.gz deploy/manifests
cp deploy/manifests/kubernetes/manifest.yaml deploy/kubernetes-manifest.yaml
cp deploy/manifests/openshift/manifest.yaml deploy/openshift-manifest.yaml
- name: Release
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5 # tag=v0.1.14
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
deploy/manifests.tar.gz
deploy/kubernetes-manifest.yaml
deploy/openshift-manifest.yaml
docs:
name: Publish Docs
runs-on: ubuntu-latest
needs: manifests
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: Publish Netlify
uses: netlify/actions/build@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
- name: Publish Vercel
run: |
curl -X POST "https://api.vercel.com/v1/integrations/deploy/${{ secrets.VERCEL_WEBHOOK }}"
container:
name: Container build and release
runs-on: ubuntu-latest
needs: binaries
container:
# https://github.com/containers/podman/tree/main/contrib/podmanimage
image: quay.io/containers/podman:v4.1.1@sha256:421ac576cebff98e90c531e7b9ce4482370ecc7cee59abc2341714031bfb5f43
options: >-
--device /dev/fuse:rw
--privileged
--security-opt label=disable
--security-opt seccomp=unconfined
permissions:
id-token: write
packages: write
contents: read
steps:
- name: Install dependencies
run: dnf install --assumeyes --repo fedora git make jq
- name: Check out code into the Go module directory
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2
- name: Set up Go
uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923 # tag=v3.2.0
with:
go-version-file: .go-version
check-latest: true
- name: Get branch name
shell: bash
run: echo "GITHUB_BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- uses: actions/download-artifact@v3
with:
name: parca-agent-dist-release
path: dist
- name: Build container
run: make container
- name: Check images are created
run: podman images | grep 'ghcr.io/parca-dev/parca-agent'
- name: Login to registry
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "${{ secrets.PERSONAL_ACCESS_TOKEN }}" | podman login -u parca-dev --password-stdin ghcr.io
- name: Install cosign
uses: sigstore/cosign-installer@48866aa521d8bf870604709cd43ec2f602d03ff2 # tag=v2.4.1
- name: Install crane
if: ${{ github.event_name != 'pull_request' }}
uses: imjasonh/setup-crane@5146f708a817ea23476677995bf2133943b9be0b # tag=v0.1
- name: Push container
if: ${{ github.event_name != 'pull_request' }}
run: |
make push-container
- name: Sign container
env:
COSIGN_EXPERIMENTAL: true
run: |
make sign-container