Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
matifali merged 30 commits intomainfrommulti-arch-main
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
30 commits
Select commitHold shift + click to select a range
cfe0ddc
wip
matifaliJan 10, 2024
b13efd7
`fmt`
matifaliJan 10, 2024
131a227
wip
matifaliJan 10, 2024
88102bd
Merge branch 'main' into multi-arch-main
matifaliJan 10, 2024
206a11c
wip
matifaliJan 10, 2024
cef4eb7
add condition to not push
matifaliJan 10, 2024
bcbafce
enable push and pull for base image
matifaliJan 10, 2024
1332c94
update project
matifaliJan 10, 2024
7894508
Tagged Docker image as main
matifaliJan 10, 2024
e9d2421
use free runner
matifaliJan 10, 2024
568560c
do not push
matifaliJan 10, 2024
30e9470
use larger runner
matifaliJan 10, 2024
8dd78cd
wip
matifaliJan 10, 2024
29e43e9
do not build base
matifaliJan 10, 2024
3d28596
remove excess permission
matifaliJan 10, 2024
0d1233b
cleanup
matifaliJan 10, 2024
5caf911
wip
matifaliJan 10, 2024
71e8145
test
matifaliJan 10, 2024
65678a7
test
matifaliJan 10, 2024
d3ee831
test
matifaliJan 10, 2024
6816e10
Update Docker image tags and retention policy
matifaliJan 10, 2024
4116e94
cleanup
matifaliJan 10, 2024
8b39c8b
Add prune-tags-regexes to CI workflow
matifaliJan 10, 2024
6fbfcb6
prune intermediate images for each arch.
matifaliJan 11, 2024
9f5725d
Merge branch 'main' into multi-arch-main
matifaliJan 11, 2024
7c91a25
prevent tags cleanup and artifact upload on PR branches
matifaliJan 11, 2024
ec5cd53
Merge branch 'main' into multi-arch-main
matifaliJan 17, 2024
e48d0c9
pr suggestions
matifaliJan 17, 2024
dc07bef
Merge branch 'main' into multi-arch-main
matifaliJan 17, 2024
319ffa1
PR commnets
matifaliJan 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
60 changes: 42 additions & 18 deletions.github/workflows/ci.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -655,7 +655,7 @@ jobs:
# to main branch. We are only building this for amd64 platform. (>95% pulls
# are for amd64)
needs: changes
if:github.ref == 'refs/heads/main' &&needs.changes.outputs.docs-only == 'false'
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"
Expand DownExpand Up@@ -692,46 +692,70 @@ 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 \
build/coder_linux_{amd64,arm64,armv7} \
build/coder_"$version"_windows_amd64.zip \
build/coder_"$version"_linux_amd64.{tar.gz,deb}

- name: Buildand PushLinuxamd64DockerImage
- name: Build Linux Dockerimages
id: build-docker
env:
CODER_IMAGE_BASE: ghcr.io/coder/coder-preview
CODER_IMAGE_TAG_PREFIX: main
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')"

export CODER_IMAGE_BUILD_BASE_TAG="$(CODER_IMAGE_BASE=coder-base ./scripts/image_tag.sh --version "$version")"
./scripts/build_docker.sh \
--arch amd64 \
--target "ghcr.io/coder/coder-preview:$tag" \
--version $version \
--push \
build/coder_linux_amd64

# 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

# Store the tag in an output variable so we can use it in other jobs
echo "tag=$tag" >> $GITHUB_OUTPUT

# build images for each architecture
make -j build/coder_"$version"_linux_{amd64,arm64,armv7}.tag

# 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

# Define specific tags
tags=("$tag" "main" "latest")

# Create and push a multi-arch manifest for each tag
# we are adding `latest` tag and keeping `main` for backward
# compatibality
for t in "${tags[@]}"; do
./scripts/build_docker_multiarch.sh \
--push \
--target "ghcr.io/coder/coder-preview:$t" \
--version $version \
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
done
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-
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
Expand Down
8 changes: 7 additions & 1 deletionscripts/image_tag.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -50,10 +50,16 @@ if [[ "$version" == "" ]]; then
fi

image="${CODER_IMAGE_BASE:-ghcr.io/coder/coder}"
tag="v$version"

# use CODER_IMAGE_TAG_PREFIX if set as a prefix for the tag
tag_prefix="${CODER_IMAGE_TAG_PREFIX:-}"

tag="${tag_prefix:+$tag_prefix-}v$version"

if [[ "$version" == "latest" ]]; then
tag="latest"
fi

if [[ "$arch" != "" ]]; then
tag+="-$arch"
fi
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp