-
Notifications
You must be signed in to change notification settings - Fork 45
146 lines (140 loc) · 4.59 KB
/
build.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
name: "Build"
on:
workflow_call:
inputs:
ref:
description: "the git revision to checkout"
default: ${{github.ref}}
required: false
type: string
outputs:
artifact-name:
description: "artifacts name"
value: ${{ jobs.build.outputs.artifact-name }}
artifact-link:
description: "artifacts link"
value: ${{ jobs.build.outputs.artifact-link }}
secrets:
ARTIFACTS_USER:
required: true
ARTIFACTS_PASSWORD:
required: true
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
outputs:
artifact-name: ${{ steps.upload.outputs.name }}
artifact-link: ${{ steps.upload.outputs.link }}
steps:
- name: Cleanup some unused ressources
# Because of the large number of images we embed in the ISO
# the disk space available start to be a problem.
# Let's remove some unused ressources to free some space.
run: |-
sudo rm -rf /usr/local/lib/android
sudo rm -rf /usr/share/dotnet
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_LOGIN }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
# NOTE: We fetch depth so that we can put the right `GIT` reference
# in the product.txt
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Install Python 3
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: setup cache for pip
uses: actions/cache@v4
env:
cache-name: pip-packages
with:
path: ~/.cache/pip/
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('buildchain/requirements.txt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install deps
run: |
export DEBIAN_FRONTEND=noninteractive
sudo apt-get update
sudo apt-get install --no-install-recommends -y \
genisoimage \
isomd5sum \
hardlink \
libgpgme-dev libassuan-dev libbtrfs-dev pkg-config libdevmapper-dev
- name: Install skopeo
# NOTE: We install skopeo from sources since the version available in "classic"
# repositories is too old and not compatible with docker > 1.25 (which is the one embedded
# in the image we use here)
env:
SKOPEO_VERSION: 1.15.1
run: |
curl -Lo skopeo.tar.gz https://github.com/containers/skopeo/archive/refs/tags/v${SKOPEO_VERSION}.tar.gz && \
tar -zxf skopeo.tar.gz && \
cd skopeo-${SKOPEO_VERSION} && \
make bin/skopeo && \
sudo mv bin/skopeo /usr/local/bin/ && \
cd .. && rm -rf skopeo.tar.gz skopeo-${SKOPEO_VERSION}
- name: Build everything
run: ./doit.sh -n 4 --verbosity 2 --failure-verbosity 2
- name: Prepare artifacts
env:
DEST_DIR: "artifacts"
ARTIFACTS: >-
build.log
_build/metalk8s.iso
_build/SHA256SUM
_build/root/product.txt
run: |
mkdir -p "$DEST_DIR"
for artifact in $ARTIFACTS; do
cp -r "$artifact" "$DEST_DIR"
done
- name: Upload artifacts
id: upload
uses: scality/action-artifacts@v4
with:
method: upload
url: https://artifacts.scality.net
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: artifacts
- name: Cleanup build tree
run: ./doit.sh clean && test ! -d _build
build-shell-ui:
uses: ./.github/workflows/build-shell-ui.yaml
secrets: inherit
with:
ref: ${{ inputs.ref }}
build-docs:
uses: ./.github/workflows/build-docs.yaml
secrets: inherit
with:
ref: ${{ inputs.ref }}
write-final-status:
runs-on: ubuntu-20.04
needs:
- build
- build-shell-ui
- build-docs
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Upload final status
if: always()
uses: scality/actions/[email protected]
with:
ARTIFACTS_USER: ${{ secrets.ARTIFACTS_USER }}
ARTIFACTS_PASSWORD: ${{ secrets.ARTIFACTS_PASSWORD }}
JOBS_RESULTS: ${{ join(needs.*.result) }}