Skip to content

ci: build a multi-arch image on each commit to main #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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 30 commits into from
Jan 18, 2024
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
cfe0ddc
wip
matifali Jan 10, 2024
b13efd7
`fmt`
matifali Jan 10, 2024
131a227
wip
matifali Jan 10, 2024
88102bd
Merge branch 'main' into multi-arch-main
matifali Jan 10, 2024
206a11c
wip
matifali Jan 10, 2024
cef4eb7
add condition to not push
matifali Jan 10, 2024
bcbafce
enable push and pull for base image
matifali Jan 10, 2024
1332c94
update project
matifali Jan 10, 2024
7894508
Tagged Docker image as main
matifali Jan 10, 2024
e9d2421
use free runner
matifali Jan 10, 2024
568560c
do not push
matifali Jan 10, 2024
30e9470
use larger runner
matifali Jan 10, 2024
8dd78cd
wip
matifali Jan 10, 2024
29e43e9
do not build base
matifali Jan 10, 2024
3d28596
remove excess permission
matifali Jan 10, 2024
0d1233b
cleanup
matifali Jan 10, 2024
5caf911
wip
matifali Jan 10, 2024
71e8145
test
matifali Jan 10, 2024
65678a7
test
matifali Jan 10, 2024
d3ee831
test
matifali Jan 10, 2024
6816e10
Update Docker image tags and retention policy
matifali Jan 10, 2024
4116e94
cleanup
matifali Jan 10, 2024
8b39c8b
Add prune-tags-regexes to CI workflow
matifali Jan 10, 2024
6fbfcb6
prune intermediate images for each arch.
matifali Jan 11, 2024
9f5725d
Merge branch 'main' into multi-arch-main
matifali Jan 11, 2024
7c91a25
prevent tags cleanup and artifact upload on PR branches
matifali Jan 11, 2024
ec5cd53
Merge branch 'main' into multi-arch-main
matifali Jan 17, 2024
e48d0c9
pr suggestions
matifali Jan 17, 2024
dc07bef
Merge branch 'main' into multi-arch-main
matifali Jan 17, 2024
319ffa1
PR commnets
matifali Jan 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test
  • Loading branch information
matifali committed Jan 10, 2024
commit 71e81458b4cbf5f94dfe8947efb80f64dca5ffdc
26 changes: 9 additions & 17 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -697,32 +697,31 @@ jobs:

make gen/mark-fresh
make -j \
build/coder_linux_amd64 \
build/coder_linux_{amd64,arm64,armv7} \
build/coder_"$version"_windows_amd64.zip \
build/coder_"$version"_linux_amd64.{tar.gz,deb}

- name: Build Linux Docker images
id: build-docker
env:
CODER_IMAGE_BASE: ghcr.io/coder/coder-preview
run: |
set -euxo pipefail

# build Docker images for each architecture
version="$(./scripts/version.sh)"
tag="main-$(echo "$version" | sed 's/+/-/g')"

export CODER_IMAGE_BUILD_BASE_TAG="ghcr.io/coder/coder-base:latest"

echo "ghcr.io/coder/coder-preview:$tag-amd64" > build/coder_"$version"_linux_amd64.tag
echo "ghcr.io/coder/coder-preview:$tag-arm64" > build/coder_"$version"_linux_arm64.tag
echo "ghcr.io/coder/coder-preview:$tag-armv7" > build/coder_"$version"_linux_armv7.tag
echo "tag=$tag" >> $GITHUB_OUTPUT

make -j build/coder_"$version"_linux_{amd64,arm64,armv7}.tag

# build and push multi-arch manifest, this depends on the other images
# being pushed so will automatically push them

# only push if we are on main branch
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
export DOCKER_CLI_EXPERIMENTAL=enabled
# 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

./scripts/build_docker_multiarch.sh \
--push \
--target "ghcr.io/coder/coder-preview:$tag" \
Expand All @@ -732,15 +731,8 @@ jobs:
# Tag as main
docker tag "ghcr.io/coder/coder-preview:$tag" ghcr.io/coder/coder-preview:main
docker push ghcr.io/coder/coder-preview:main
else
./scripts/build_docker_multiarch.sh \
--target "ghcr.io/coder/coder-preview:$tag" \
--version $version \
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
fi

echo "tag=$tag" >> $GITHUB_OUTPUT

- name: Prune old images
uses: vlaurin/action-ghcr-prune@v0.5.0
with:
Expand Down