@@ -53,33 +53,27 @@ jobs:
5353 runs-on : ${{ matrix.os }}
5454 needs : [check]
5555 timeout-minutes : 10
56-
5756 strategy :
5857 matrix :
59- os : [ubuntu-18.04, windows-2019]
60-
58+ os : [ubuntu-18.04]
59+ platform :
60+ - linux/amd64
61+ - linux/arm64
62+ - windows/amd64
6163 steps :
6264 - name : Install Go
6365 uses : actions/setup-go@v2
6466 with :
6567 go-version : ' 1.17.3'
66-
6768 - name : Set env
6869 shell : bash
6970 env :
7071 MOS : ${{ matrix.os }}
7172 run : |
7273 releasever=${{ github.ref }}
7374 releasever="${releasever#refs/tags/}"
74- os=linux
75- [[ "${MOS}" =~ "windows" ]] && {
76- os=windows
77- }
7875 echo "RELEASE_VER=${releasever}" >> $GITHUB_ENV
7976 echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV
80- echo "OS=${os}" >> $GITHUB_ENV
81- echo "${{ github.workspace }}/bin" >> $GITHUB_PATH
82-
8377 - name : Checkout containerd
8478 uses : actions/checkout@v2
8579 with :
@@ -90,169 +84,54 @@ jobs:
9084 ref : ${{ github.ref }}
9185 path : src/github.com/containerd/containerd
9286
93- - name : HCS Shim commit
94- id : hcsshim_commit
95- if : startsWith(matrix.os, 'windows')
96- shell : bash
97- run : echo "::set-output name=sha::$(grep 'Microsoft/hcsshim ' go.mod | awk '{print $2}')"
98- working-directory : src/github.com/containerd/containerd
99-
100- - name : Checkout hcsshim source
101- if : startsWith(matrix.os, 'windows')
102- uses : actions/checkout@v2
87+ - name : Setup buildx instance
88+ uses : docker/setup-buildx-action@v1
10389 with :
104- repository : Microsoft/hcsshim
105- ref : ${{ steps.hcsshim_commit.outputs.sha }}
106- path : src/github.com/Microsoft/hcsshim
107-
90+ use : true
91+ - uses : crazy-max/ghaction-github-runtime@v1 # sets up needed vars for caching to github
10892 - name : Make
10993 shell : bash
11094 run : |
111- make build
112- make binaries
113- rm bin/containerd-stress*
114- [[ "${OS}" == "windows" ]] && {
115- (
116- bindir="$(pwd)/bin"
117- cd ../../Microsoft/hcsshim
118- GO111MODULE=on go build -mod=vendor -o "${bindir}/containerd-shim-runhcs-v1.exe" ./cmd/containerd-shim-runhcs-v1
119- )
120- }
121- TARFILE="containerd-${RELEASE_VER#v}-${OS}-amd64.tar.gz"
122- tar czf ${TARFILE} bin/
123- sha256sum ${TARFILE} >${TARFILE}.sha256sum
124- working-directory : src/github.com/containerd/containerd
125-
126- - name : Save build binaries
127- uses : actions/upload-artifact@v2
128- with :
129- name : containerd-binaries-${{ matrix.os }}
130- path : src/github.com/containerd/containerd/*.tar.gz*
131-
132- - name : Make cri-containerd tar
133- shell : bash
134- env :
135- RUNC_FLAVOR : runc
136- run : |
137- if [[ "${OS}" == "linux" ]]; then
138- sudo apt-get update
139- sudo apt-get install -y gperf
140- sudo -E PATH=$PATH script/setup/install-seccomp
95+ cache="--cache-from=type=gha,scope=containerd-release --cache-to=type=gha,scope=containerd-release"
96+ if [[ "${PLATFORM}" =~ "windows" ]]; then
97+ # For Windows the cni build script generates a config but shells out to powershell (and also assume it is running on windows) to get a gateway and subnet.
98+ # The values provided here are taken from packages that we previously generated.
99+ export GATEWAY=172.21.16.1
100+ export PREFIX_LEN=12
101+ BUILD_ARGS="--build-arg GATEWAY --build-arg PREFIX_LEN"
141102 fi
142- make cri-release cri-cni- release
143- working-directory : src/github.com/containerd/containerd
103+ docker buildx build ${cache} --build-arg RELEASE_VER --build-arg GO_VERSION ${BUILD_ARGS} -f .github/workflows/ release/Dockerfile.${{matrix.os}} --platform=${PLATFORM} -o releases/ .
104+ echo PLATFORM_CLEAN=${PLATFORM/\//-} >> $GITHUB_ENV
144105
145- - name : Save cri-containerd binaries
106+ # Remove symlinks since we don't want these in the release Artifacts
107+ find ./releases/ -maxdepth 1 -type l | xargs rm
108+ working-directory : src/github.com/containerd/containerd
109+ env :
110+ GO_VERSION : ' 1.17.2'
111+ PLATFORM : ${{ matrix.platform }}
112+ - name : Save Artifacts
146113 uses : actions/upload-artifact@v2
147114 with :
148- name : cri-containerd-binaries- ${{ matrix.os }}
149- path : src/github.com/containerd/containerd/releases/cri-containerd- *.tar.gz*
115+ name : release-tars- ${{env.PLATFORM_CLEAN }}
116+ path : src/github.com/containerd/containerd/releases/*.tar.gz*
150117
151118 release :
152119 name : Create containerd Release
153120 runs-on : ubuntu-18.04
154121 timeout-minutes : 10
155122 needs : [build, check]
156- outputs :
157- upload_url : ${{ steps.create_release.outputs.upload_url }}
158-
159123 steps :
160124 - name : Download builds and release notes
161125 uses : actions/download-artifact@v2
162126 with :
163127 path : builds
164128 - name : Create Release
165- id : create_release
166- 167- env :
168- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
129+ uses : softprops/action-gh-release@v1
169130 with :
170- tag_name : ${{ github.ref }}
171- release_name : containerd ${{ needs.check.outputs.stringver }}
172- body_path : ./builds/containerd-release-notes/release-notes.md
131+ token : ${{ secrets.GITHUB_TOKEN }}
132+ fail_on_unmatched_files : true
173133 draft : false
174134 prerelease : ${{ contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
175-
176- release-upload :
177- name : Upload containerd tarballs
178- runs-on : ubuntu-18.04
179- timeout-minutes : 10
180- needs : [release]
181-
182- strategy :
183- matrix :
184- os : [ubuntu-18.04, windows-2019]
185-
186- steps :
187- - name : Download builds and release notes
188- uses : actions/download-artifact@v2
189- with :
190- path : builds
191- - name : Catalog build assets for upload
192- id : catalog
193- env :
194- OS : ${{ matrix.os }}
195- run : |
196- _filenum=1
197- for f in `ls "builds/containerd-binaries-${OS}"`; do
198- echo "::set-output name=file${_filenum}::${f}"
199- let "_filenum+=1"
200- done
201- for f in `ls builds/cri-containerd-binaries-${OS}`; do
202- echo "::set-output name=file${_filenum}::${f}"
203- let "_filenum+=1"
204- done
205- - name : Upload containerd tarball
206- uses : actions/upload-release-asset@v1
207- env :
208- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
209- with :
210- upload_url : ${{ needs.release.outputs.upload_url }}
211- asset_path : ./builds/containerd-binaries-${{ matrix.os }}/${{ steps.catalog.outputs.file1 }}
212- asset_name : ${{ steps.catalog.outputs.file1 }}
213- asset_content_type : application/gzip
214- - name : Upload sha256 sum
215- uses : actions/upload-release-asset@v1
216- env :
217- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
218- with :
219- upload_url : ${{ needs.release.outputs.upload_url }}
220- asset_path : ./builds/containerd-binaries-${{ matrix.os }}/${{ steps.catalog.outputs.file2 }}
221- asset_name : ${{ steps.catalog.outputs.file2 }}
222- asset_content_type : text/plain
223- - name : Upload cri containerd tarball
224- uses : actions/upload-release-asset@v1
225- env :
226- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
227- with :
228- upload_url : ${{ needs.release.outputs.upload_url }}
229- asset_path : ./builds/cri-containerd-binaries-${{ matrix.os }}/${{ steps.catalog.outputs.file3 }}
230- asset_name : ${{ steps.catalog.outputs.file3 }}
231- asset_content_type : application/gzip
232- - name : Upload cri sha256 sum
233- uses : actions/upload-release-asset@v1
234- env :
235- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
236- with :
237- upload_url : ${{ needs.release.outputs.upload_url }}
238- asset_path : ./builds/cri-containerd-binaries-${{ matrix.os }}/${{ steps.catalog.outputs.file4 }}
239- asset_name : ${{ steps.catalog.outputs.file4 }}
240- asset_content_type : text/plain
241- - name : Upload cri/cni containerd tarball
242- uses : actions/upload-release-asset@v1
243- env :
244- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
245- with :
246- upload_url : ${{ needs.release.outputs.upload_url }}
247- asset_path : ./builds/cri-containerd-binaries-${{ matrix.os }}/${{ steps.catalog.outputs.file5 }}
248- asset_name : ${{ steps.catalog.outputs.file5 }}
249- asset_content_type : application/gzip
250- - name : Upload cri/cni sha256 sum
251- uses : actions/upload-release-asset@v1
252- env :
253- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
254- with :
255- upload_url : ${{ needs.release.outputs.upload_url }}
256- asset_path : ./builds/cri-containerd-binaries-${{ matrix.os }}/${{ steps.catalog.outputs.file6 }}
257- asset_name : ${{ steps.catalog.outputs.file6 }}
258- asset_content_type : text/plain
135+ body_path : ./builds/containerd-release-notes/release-notes.md
136+ files : |
137+ builds/release-tars-**/*
0 commit comments