- Notifications
You must be signed in to change notification settings - Fork928
ci: build a multi-arch image on each commit tomain
#11544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from26 commits
cfe0ddc
b13efd7
131a227
88102bd
206a11c
cef4eb7
bcbafce
1332c94
7894508
e9d2421
568560c
30e9470
8dd78cd
29e43e9
3d28596
0d1233b
5caf911
71e8145
65678a7
d3ee831
6816e10
4116e94
8b39c8b
6fbfcb6
9f5725d
7c91a25
ec5cd53
e48d0c9
dc07bef
319ffa1
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -655,7 +655,7 @@ jobs: | ||
# to main branch. We are only building this for amd64 platform. (>95% pulls | ||
# are for amd64) | ||
needs: changes | ||
if: needs.changes.outputs.docs-only == 'false' && !github.event.pull_request.head.repo.fork | ||
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} | ||
env: | ||
DOCKER_CLI_EXPERIMENTAL: "enabled" | ||
@@ -692,46 +692,69 @@ jobs: | ||
go mod download | ||
version="$(./scripts/version.sh)" | ||
tag="main-$(echo "$version" | sed 's/+/-/g')" | ||
echo "tag=$tag" >> $GITHUB_OUTPUT | ||
make gen/mark-fresh | ||
make -j \ | ||
build/coder_linux_{amd64,arm64,armv7} \ | ||
build/coder_"$version"_windows_amd64.zip \ | ||
build/coder_"$version"_linux_amd64.{tar.gz,deb} | ||
- name: Build Linux Dockerimages | ||
id: build-docker | ||
env: | ||
CODER_IMAGE_BASE: ghcr.io/coder/coder-preview | ||
DOCKER_CLI_EXPERIMENTAL: "enabled" | ||
run: | | ||
set -euxo pipefail | ||
# build Docker images for each architecture | ||
version="$(./scripts/version.sh)" | ||
tag="main-$(echo "$version" | sed 's/+/-/g')" | ||
echo "tag=$tag" >> $GITHUB_OUTPUT | ||
# build images for each architecture | ||
make -j build/coder_"$version"_linux_{amd64,arm64,armv7}.tag | ||
matifali marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page.
matifali marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
# only push if we are on main branch | ||
if [ "${{ github.ref }}" == "refs/heads/main" ]; then | ||
# build and push multi-arch manifest, this depends on the other images | ||
# being pushed so will automatically push them | ||
make -j push/build/coder_"$version"_linux_{amd64,arm64,armv7}.tag | ||
matifali marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
# Create and push a multi-arch manifest | ||
./scripts/build_docker_multiarch.sh \ | ||
matifali marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
--push \ | ||
--target "ghcr.io/coder/coder-preview:$tag" \ | ||
--version $version \ | ||
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag) | ||
# Create and push a multi-arch manifest for the latest tag | ||
./scripts/build_docker_multiarch.sh \ | ||
matifali marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
--push \ | ||
--target "ghcr.io/coder/coder-preview:latest" \ | ||
matifali marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
--version $version \ | ||
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag) | ||
fi | ||
- name: Prune old images | ||
if: github.ref == 'refs/heads/main' | ||
uses: vlaurin/action-ghcr-prune@v0.5.0 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
organization: coder | ||
container: coder-preview | ||
keep-younger-than: 7 # days | ||
keep-tags: latest | ||
keep-tags-regexes: ^pr | ||
prune-tags-regexes: | | ||
^main- | ||
^v | ||
prune-untagged: true | ||
- name: Upload build artifacts | ||
if: github.ref == 'refs/heads/main' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: coder | ||