From d01c4c30551b2dcd6a27426e30babaea104f6f89 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 1 Aug 2023 12:52:42 +0000 Subject: [PATCH 1/6] build edge docker image --- .github/workflows/ci.yaml | 43 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ac099410cbdc0..833ae4595ce1b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -695,3 +695,46 @@ jobs: fi echo "Required checks have passed" + + build: + if: github.ref == 'refs/heads/main' + runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} + env: + DOCKER_CLI_EXPERIMENTAL: "enabled" + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Node + uses: ./.github/actions/setup-node + + - name: Setup Go + uses: ./.github/actions/setup-go + + - name: Setup sqlc + uses: ./.github/actions/setup-sqlc + + - name: GHCR Login + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Linux amd64 Docker image + run: | + set -euxo pipefail + go mod download + make gen/mark-fresh + export DOCKER_IMAGE_NO_PREREQUISITES=true + version="$(./scripts/version.sh)" + export CODER_IMAGE_BUILD_BASE_TAG="$(CODER_IMAGE_BASE=coder-base ./scripts/image_tag.sh --version "$version")" + make -j build/coder_linux_amd64 + ./scripts/build_docker.sh \ + --arch amd64 \ + --target ghcr.io/coder/coder:latest \ + --version $version \ + --push \ + build/coder_linux_amd64 From a37775dab9ea7dfc9f74f7b95c8e56d43eb7cf66 Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Tue, 1 Aug 2023 12:56:32 +0000 Subject: [PATCH 2/6] skip building if only docs change. --- .github/workflows/ci.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 833ae4595ce1b..8969f0b58a99f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -697,7 +697,8 @@ jobs: echo "Required checks have passed" build: - if: github.ref == 'refs/heads/main' + needs: changes + if: github.ref == 'refs/heads/main' && needs.changes.outputs.docs-only == 'false' runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} env: DOCKER_CLI_EXPERIMENTAL: "enabled" From e5bb7aa4d55d760df9856bbe5ad78ef9767b04c0 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Tue, 1 Aug 2023 18:14:47 +0300 Subject: [PATCH 3/6] Update .github/workflows/ci.yaml --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8969f0b58a99f..13ffb338abc34 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -735,7 +735,7 @@ jobs: make -j build/coder_linux_amd64 ./scripts/build_docker.sh \ --arch amd64 \ - --target ghcr.io/coder/coder:latest \ + --target ghcr.io/coder/coder:edge \ --version $version \ --push \ build/coder_linux_amd64 From 01ce271b8a8e87f4262fbbf71bfcb21ae599afa1 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 2 Aug 2023 08:36:58 +0300 Subject: [PATCH 4/6] Update .github/workflows/ci.yaml Co-authored-by: Dean Sheather --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 13ffb338abc34..1b136bc2e0f06 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -696,7 +696,7 @@ jobs: echo "Required checks have passed" - build: + build-edge: needs: changes if: github.ref == 'refs/heads/main' && needs.changes.outputs.docs-only == 'false' runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }} From 6d76af431338c3489fb0c62eb2857e3da574f3e2 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 2 Aug 2023 13:40:53 +0300 Subject: [PATCH 5/6] move package to `ghcr.io/coder/coder-preview:main` move pkg from `ghcr.io/coder/coder:edge` to `ghcr.io/coder/coder-preview:main` --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d60eb50eba853..e884ca5575187 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -754,7 +754,7 @@ jobs: make -j build/coder_linux_amd64 ./scripts/build_docker.sh \ --arch amd64 \ - --target ghcr.io/coder/coder:edge \ + --target ghcr.io/coder/coder-preview:main \ --version $version \ --push \ build/coder_linux_amd64 From 698aec1f55e013a9fe2224c68197021c917a3d72 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 2 Aug 2023 13:44:47 +0300 Subject: [PATCH 6/6] add comment --- .github/workflows/ci.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e884ca5575187..8b7710a779946 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -715,7 +715,9 @@ jobs: echo "Required checks have passed" - build-edge: + build-main-image: + # This build and publihes ghcr.io/coder/coder-preview:main for each merge commit to main branch. + # We are only building this for amd64 plateform. (>95% pulls are for amd64) needs: changes if: github.ref == 'refs/heads/main' && needs.changes.outputs.docs-only == 'false' runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}