Skip to content

Commit f509e59

Browse files
cheina97claudiolor
andcommitted
Update build/liqo/build.sh
Co-authored-by: Claudio Lorina <[email protected]>
1 parent 295499a commit f509e59

File tree

2 files changed

+111
-115
lines changed

2 files changed

+111
-115
lines changed

.github/workflows/integration.yml

Lines changed: 110 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Integration Pipeline
22
on:
33
push:
44
tags:
5-
- 'v*'
5+
- "v*"
66
branches:
77
- master
88
- release
@@ -12,6 +12,7 @@ on:
1212
types:
1313
- test-command
1414
- build-command
15+
pull_request:
1516
jobs:
1617
configure:
1718
name: Preliminary configuration
@@ -24,56 +25,56 @@ jobs:
2425
architectures: ${{ steps.configure.outputs.architectures }}
2526
pr-number: ${{ steps.configure.outputs.pr-number }}
2627
steps:
27-
- name: Get the version
28-
id: get_version
29-
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
30-
if: startsWith(github.ref, 'refs/tags/v')
31-
- name: Configure
32-
id: configure
33-
run: |
34-
# The ref of the commit to checkout (do not use the merge commit if repository dispatch)
35-
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
36-
echo "master=false" >> $GITHUB_OUTPUT
37-
echo "architectures=linux/amd64" >> $GITHUB_OUTPUT
38-
echo "commit-ref=${{ github.event.client_payload.pull_request.head.sha }}" >> $GITHUB_OUTPUT
39-
echo "pr-number=${{ github.event.client_payload.github.payload.issue.number }}" >> $GITHUB_OUTPUT
40-
elif [ "${{ steps.get_version.outputs.VERSION }}" != "" ]; then
41-
echo "master=false" >> $GITHUB_OUTPUT
42-
echo "architectures=linux/amd64,linux/arm64,linux/arm/v7" >> $GITHUB_OUTPUT
43-
echo "commit-ref=${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
44-
elif [ "${{ github.ref_name }}" == "master" ]; then
45-
echo "master=true" >> $GITHUB_OUTPUT
46-
echo "architectures=linux/amd64,linux/arm64,linux/arm/v7" >> $GITHUB_OUTPUT
47-
echo "commit-ref=${{ github.sha }}" >> $GITHUB_OUTPUT
48-
else
49-
echo "master=false" >> $GITHUB_OUTPUT
50-
echo "architectures=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
51-
echo "commit-ref=${{ github.sha }}" >> $GITHUB_OUTPUT
52-
fi
53-
54-
# The suffix to append to the repository name if not triggered by a push for a release
55-
([[ "${{ steps.get_version.outputs.VERSION }}" == "" ]] && \
56-
echo "repo-suffix=-ci" ||
57-
echo "repo-suffix=") >> $GITHUB_OUTPUT
58-
59-
if [ "${{ github.event_name }}" != "repository_dispatch" ]; then
60-
echo "repo-name=${{ github.repository }}" >> $GITHUB_OUTPUT
61-
else
62-
echo "repo-name=${{ github.event.client_payload.github.payload.repository.full_name }}" >> $GITHUB_OUTPUT
63-
fi
64-
65-
# Since we are using a repository-dispatch event, we have to explicitly set a run check. We initialize it to a "pending" state.
66-
- uses: octokit/[email protected]
67-
name: "Initialize run check to 'pending (For PR-only)"
68-
with:
69-
route: POST /repos/${{ github.repository }}/statuses/${{ steps.configure.outputs.commit-ref }}
70-
state: "pending"
71-
description: "Component build status"
72-
context: "Components building"
73-
target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
74-
env:
75-
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
76-
if: ${{ github.event_name == 'repository_dispatch' }}
28+
- name: Get the version
29+
id: get_version
30+
run: echo "VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_OUTPUT
31+
if: startsWith(github.ref, 'refs/tags/v')
32+
- name: Configure
33+
id: configure
34+
run: |
35+
# The ref of the commit to checkout (do not use the merge commit if repository dispatch)
36+
if [ "${{ github.event_name }}" == "repository_dispatch" ]; then
37+
echo "master=false" >> $GITHUB_OUTPUT
38+
echo "architectures=linux/amd64" >> $GITHUB_OUTPUT
39+
echo "commit-ref=${{ github.event.client_payload.pull_request.head.sha }}" >> $GITHUB_OUTPUT
40+
echo "pr-number=${{ github.event.client_payload.github.payload.issue.number }}" >> $GITHUB_OUTPUT
41+
elif [ "${{ steps.get_version.outputs.VERSION }}" != "" ]; then
42+
echo "master=false" >> $GITHUB_OUTPUT
43+
echo "architectures=linux/amd64,linux/arm64,linux/arm/v7" >> $GITHUB_OUTPUT
44+
echo "commit-ref=${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_OUTPUT
45+
elif [ "${{ github.ref_name }}" == "master" ]; then
46+
echo "master=true" >> $GITHUB_OUTPUT
47+
echo "architectures=linux/amd64,linux/arm64,linux/arm/v7" >> $GITHUB_OUTPUT
48+
echo "commit-ref=${{ github.sha }}" >> $GITHUB_OUTPUT
49+
else
50+
echo "master=false" >> $GITHUB_OUTPUT
51+
echo "architectures=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
52+
echo "commit-ref=${{ github.sha }}" >> $GITHUB_OUTPUT
53+
fi
54+
55+
# The suffix to append to the repository name if not triggered by a push for a release
56+
([[ "${{ steps.get_version.outputs.VERSION }}" == "" ]] && \
57+
echo "repo-suffix=-ci" ||
58+
echo "repo-suffix=") >> $GITHUB_OUTPUT
59+
60+
if [ "${{ github.event_name }}" != "repository_dispatch" ]; then
61+
echo "repo-name=${{ github.repository }}" >> $GITHUB_OUTPUT
62+
else
63+
echo "repo-name=${{ github.event.client_payload.github.payload.repository.full_name }}" >> $GITHUB_OUTPUT
64+
fi
65+
66+
# Since we are using a repository-dispatch event, we have to explicitly set a run check. We initialize it to a "pending" state.
67+
- uses: octokit/[email protected]
68+
name: "Initialize run check to 'pending (For PR-only)"
69+
with:
70+
route: POST /repos/${{ github.repository }}/statuses/${{ steps.configure.outputs.commit-ref }}
71+
state: "pending"
72+
description: "Component build status"
73+
context: "Components building"
74+
target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
75+
env:
76+
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
77+
if: ${{ github.event_name == 'repository_dispatch' }}
7778

7879
build-standard:
7980
runs-on: ubuntu-latest
@@ -82,7 +83,7 @@ jobs:
8283
fail-fast: false
8384
matrix:
8485
component:
85-
- cert-creator
86+
- cert-creator
8687
steps:
8788
- name: Set architectures
8889
id: set-architectures
@@ -165,20 +166,20 @@ jobs:
165166
fail-fast: false
166167
matrix:
167168
component:
168-
- crd-replicator
169-
- ipam
170-
- liqo-controller-manager
171-
- webhook
172-
- uninstaller
173-
- virtual-kubelet
174-
- metric-agent
175-
- telemetry
176-
- proxy
177-
- gateway
178-
- gateway/wireguard
179-
- gateway/geneve
180-
- fabric
181-
steps:
169+
- crd-replicator
170+
- ipam
171+
- liqo-controller-manager
172+
- webhook
173+
- uninstaller
174+
- virtual-kubelet
175+
- metric-agent
176+
- telemetry
177+
- proxy
178+
- gateway
179+
- gateway/wireguard
180+
- gateway/geneve
181+
- fabric
182+
steps:
182183
- name: Check out code
183184
uses: actions/checkout@v4
184185
with:
@@ -208,52 +209,50 @@ jobs:
208209
chmod +x ./build/liqo/build.sh
209210
./build/liqo/build.sh ./cmd/${{ matrix.component }}
210211
post-build:
211-
runs-on: ubuntu-latest
212-
needs: [build-standard, build-go, configure, liqoctl]
213-
steps:
214-
215-
# Since we are using a repository-dispatch event, we have to explicitly set a run check. We update it to the actual status.
216-
- uses: octokit/[email protected]
217-
name: "Set the PR check status (For PR-only)"
218-
with:
219-
route: POST /repos/${{ github.repository }}/statuses/${{ needs.configure.outputs.commit-ref }}
220-
state: "${{ needs.build.result }}"
221-
description: "Component build status"
222-
context: "Components building"
223-
target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
224-
env:
225-
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
226-
if: ${{ !cancelled() && github.event_name == 'repository_dispatch' }}
212+
runs-on: ubuntu-latest
213+
needs: [build-standard, build-go, configure, liqoctl]
214+
steps:
215+
# Since we are using a repository-dispatch event, we have to explicitly set a run check. We update it to the actual status.
216+
- uses: octokit/[email protected]
217+
name: "Set the PR check status (For PR-only)"
218+
with:
219+
route: POST /repos/${{ github.repository }}/statuses/${{ needs.configure.outputs.commit-ref }}
220+
state: "${{ needs.build.result }}"
221+
description: "Component build status"
222+
context: "Components building"
223+
target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
224+
env:
225+
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
226+
if: ${{ !cancelled() && github.event_name == 'repository_dispatch' }}
227227

228228
e2e-test-trigger:
229229
runs-on: ubuntu-latest
230230
needs: [build, configure, liqoctl]
231231
if: github.event.client_payload.slash_command.command == 'test'
232232
steps:
233-
234-
- name: Notify Event to E2E Tests
235-
uses: peter-evans/repository-dispatch@v3
236-
with:
237-
token: ${{ secrets.CI_TOKEN }}
238-
repository: liqotech/liqops
239-
event-type: "dev-event"
240-
client-payload: |
241-
{
242-
"master": "${{ needs.configure.outputs.master }}",
243-
"commit": "${{ needs.configure.outputs.commit-ref }}",
244-
"repo-name": "${{ needs.configure.outputs.repo-name }}",
245-
"base-repo": "${{ github.repository }}",
246-
"run-id": "${{ github.run_id }}",
247-
"pr-number" : "${{ needs.configure.outputs.pr-number }}"
248-
}
233+
- name: Notify Event to E2E Tests
234+
uses: peter-evans/repository-dispatch@v3
235+
with:
236+
token: ${{ secrets.CI_TOKEN }}
237+
repository: liqotech/liqops
238+
event-type: "dev-event"
239+
client-payload: |
240+
{
241+
"master": "${{ needs.configure.outputs.master }}",
242+
"commit": "${{ needs.configure.outputs.commit-ref }}",
243+
"repo-name": "${{ needs.configure.outputs.repo-name }}",
244+
"base-repo": "${{ github.repository }}",
245+
"run-id": "${{ github.run_id }}",
246+
"pr-number" : "${{ needs.configure.outputs.pr-number }}"
247+
}
249248
250249
liqoctl:
251250
runs-on: ubuntu-latest
252-
needs: [ configure ]
251+
needs: [configure]
253252
strategy:
254253
matrix:
255-
goos: [ linux, windows, darwin ]
256-
goarch: [ arm64, amd64, arm ]
254+
goos: [linux, windows, darwin]
255+
goarch: [arm64, amd64, arm]
257256
exclude:
258257
- goarch: arm64
259258
goos: windows
@@ -262,15 +261,13 @@ jobs:
262261
- goarch: arm
263262
goos: darwin
264263

265-
266264
steps:
267-
268265
- uses: actions/checkout@v4
269266
with:
270267
ref: "${{ needs.configure.outputs.commit-ref }}"
271268
repository: "${{ needs.configure.outputs.repo-name }}"
272269
persist-credentials: false
273-
270+
274271
- name: Setup Go
275272
uses: actions/setup-go@v5
276273
with:
@@ -294,23 +291,22 @@ jobs:
294291
- name: Upload Liqoctl
295292
uses: actions/upload-artifact@v4
296293
with:
297-
name: liqoctl-${{ matrix.goos }}-${{ matrix.goarch }}
298-
path: ./liqoctl-${{ matrix.goos }}-${{ matrix.goarch }}
299-
retention-days: 1
294+
name: liqoctl-${{ matrix.goos }}-${{ matrix.goarch }}
295+
path: ./liqoctl-${{ matrix.goos }}-${{ matrix.goarch }}
296+
retention-days: 1
300297

301298
- name: Upload Liqoctl Archive
302299
uses: actions/upload-artifact@v4
303300
with:
304-
name: liqoctl-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
305-
path: ./liqoctl-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
306-
retention-days: 1
301+
name: liqoctl-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
302+
path: ./liqoctl-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
303+
retention-days: 1
307304

308305
release:
309306
runs-on: ubuntu-latest
310307
needs: [build, configure, liqoctl]
311308
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
312309
steps:
313-
314310
- name: Checkout
315311
uses: actions/checkout@v4
316312
with:
@@ -341,8 +337,8 @@ jobs:
341337
id: semver_parser
342338
uses: booxmedialtd/ws-action-parse-semver@v1
343339
with:
344-
input_string: '${{ needs.configure.outputs.commit-ref }}'
345-
version_extractor_regex: 'v(.*)$'
340+
input_string: "${{ needs.configure.outputs.commit-ref }}"
341+
version_extractor_regex: "v(.*)$"
346342

347343
# we cannot use the official chart-releaser-action since it does not support releases on tags
348344
# https://github.com/helm/chart-releaser-action/issues/60, and it is not possible to add the
@@ -358,7 +354,7 @@ jobs:
358354
359355
- uses: actions/download-artifact@v4
360356
with:
361-
path: ./liqoctl/
357+
path: ./liqoctl/
362358

363359
# we need to upload only helm artifacts first, to make the index updater to work
364360
- uses: ncipollo/release-action@v1

build/liqo/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [ $# -ne 1 ]; then
1515
exit 1
1616
fi
1717

18-
targetdir="$1"
18+
componentdir="$1"
1919
if [ ! -d "$targetdir" ]; then
2020
echo "Error: $targetdir is not a directory" >&2
2121
exit 1

0 commit comments

Comments
 (0)