From 3706a7c1614de520856052cb5e162bf3837cf17f Mon Sep 17 00:00:00 2001 From: Alex Joedt <84435160+alexjoedt@users.noreply.github.com> Date: Fri, 4 Sep 2026 10:46:21 +0200 Subject: [PATCH 1/3] ci: replace buildkite pipeline with github actions Run the existing ci_test, ci_build and ci_lint make targets as three jobs in a GitHub workflow on pull requests and pushes to master. The targets still run inside the gridx dev image, so the test environment stays the same. Remove the buildkite pipeline and the unused BRANCH variable in the Makefile. Claude-Session: https://claude.ai/code/session_01ABvNB1a6JTYe68AJYjduQ5 --- .buildkite/pipeline.yaml | 16 ---------------- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ Makefile | 2 -- 3 files changed, 35 insertions(+), 18 deletions(-) delete mode 100644 .buildkite/pipeline.yaml create mode 100644 .github/workflows/ci.yml diff --git a/.buildkite/pipeline.yaml b/.buildkite/pipeline.yaml deleted file mode 100644 index 9cd6169..0000000 --- a/.buildkite/pipeline.yaml +++ /dev/null @@ -1,16 +0,0 @@ -steps: -- command: - - "make ci_test" - label: ":llama: Tests" - agents: - - "queue=default" -- command: - - "make ci_build" - label: ":golang: Build" - agents: - - "queue=default" -- command: - - "make ci_lint" - label: ":llama: Linting" - agents: - - "queue=default" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0315bec --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: CI + +on: + pull_request: + push: + branches: [master] + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: make ci_test + + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: make ci_build + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: make ci_lint diff --git a/Makefile b/Makefile index 09f4279..03a4737 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,6 @@ GO_TOOLS := public.ecr.aws/gridx/base-images:modbus-dev-1.21.latest DOCKER_RUN := docker run --init --rm -v $$PWD:/go/src/github.com/grid-x/modbus -w /go/src/github.com/grid-x/modbus GO_RUN := ${DOCKER_RUN} ${GO_TOOLS} bash -c -BRANCH := $(shell echo ${BUILDKITE_BRANCH} | sed 's/\//_/g') - all: bin/ .PHONY: test From b846cd85ffab0b359a6d77e678b71d5674997022 Mon Sep 17 00:00:00 2001 From: Alex Joedt <84435160+alexjoedt@users.noreply.github.com> Date: Fri, 4 Sep 2026 10:48:49 +0200 Subject: [PATCH 2/3] ci: pull the dev image from ghcr instead of public ecr Anonymous pulls from public ECR are rate limited per IP, which makes the shared GitHub runners fail with "toomanyrequests". Add a manual workflow that mirrors the gridx dev image to ghcr.io/grid-x/modbus-dev and point the Makefile at that copy. Claude-Session: https://claude.ai/code/session_01ABvNB1a6JTYe68AJYjduQ5 --- .github/workflows/ci.yml | 6 ++-- .github/workflows/mirror-ci-image.yml | 42 +++++++++++++++++++++++++++ Makefile | 2 +- 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/mirror-ci-image.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0315bec..0dd0975 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,19 +17,19 @@ jobs: name: Tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - run: make ci_test build: name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - run: make ci_build lint: name: Lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 - run: make ci_lint diff --git a/.github/workflows/mirror-ci-image.yml b/.github/workflows/mirror-ci-image.yml new file mode 100644 index 0000000..a9910cb --- /dev/null +++ b/.github/workflows/mirror-ci-image.yml @@ -0,0 +1,42 @@ +name: Mirror CI image + +# Anonymous pulls from public ECR hit a rate limit on GitHub runners. +# This copies the gridx dev image to GHCR, where CI pulls it from. +on: + workflow_dispatch: + inputs: + source_tag: + description: Tag of public.ecr.aws/gridx/base-images to mirror + default: modbus-dev-1.21.latest + target_tag: + description: Tag to publish under ghcr.io/grid-x/modbus-dev + default: go1.21 + +jobs: + mirror: + runs-on: ubuntu-latest + permissions: + packages: write + env: + SOURCE: public.ecr.aws/gridx/base-images:${{ inputs.source_tag }} + TARGET: ghcr.io/grid-x/modbus-dev:${{ inputs.target_tag }} + steps: + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Pull source image + run: | + for attempt in 1 2 3 4 5 6; do + docker pull "$SOURCE" && exit 0 + echo "pull failed, retry $attempt in 30s" + sleep 30 + done + exit 1 + + - name: Push to GHCR + run: | + docker tag "$SOURCE" "$TARGET" + docker push "$TARGET" diff --git a/Makefile b/Makefile index 03a4737..0df2007 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ GO_FILES := $(shell find . -type f -name "*.go") GO_BUILD := CGO_ENABLED=0 go build -ldflags "-w -s" -GO_TOOLS := public.ecr.aws/gridx/base-images:modbus-dev-1.21.latest +GO_TOOLS := ghcr.io/grid-x/modbus-dev:go1.21 DOCKER_RUN := docker run --init --rm -v $$PWD:/go/src/github.com/grid-x/modbus -w /go/src/github.com/grid-x/modbus GO_RUN := ${DOCKER_RUN} ${GO_TOOLS} bash -c From 4567a786670c410f98f50e7787eac5907776a865 Mon Sep 17 00:00:00 2001 From: Alex Joedt <84435160+alexjoedt@users.noreply.github.com> Date: Fri, 4 Sep 2026 10:49:19 +0200 Subject: [PATCH 3/3] ci: run the image mirror when its workflow file changes workflow_dispatch only works once the file is on the default branch. Claude-Session: https://claude.ai/code/session_01ABvNB1a6JTYe68AJYjduQ5 --- .github/workflows/mirror-ci-image.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/mirror-ci-image.yml b/.github/workflows/mirror-ci-image.yml index a9910cb..327022b 100644 --- a/.github/workflows/mirror-ci-image.yml +++ b/.github/workflows/mirror-ci-image.yml @@ -2,7 +2,11 @@ name: Mirror CI image # Anonymous pulls from public ECR hit a rate limit on GitHub runners. # This copies the gridx dev image to GHCR, where CI pulls it from. +# Runs on every change to this file and on manual dispatch. on: + push: + paths: + - .github/workflows/mirror-ci-image.yml workflow_dispatch: inputs: source_tag: @@ -18,8 +22,8 @@ jobs: permissions: packages: write env: - SOURCE: public.ecr.aws/gridx/base-images:${{ inputs.source_tag }} - TARGET: ghcr.io/grid-x/modbus-dev:${{ inputs.target_tag }} + SOURCE: public.ecr.aws/gridx/base-images:${{ inputs.source_tag || 'modbus-dev-1.21.latest' }} + TARGET: ghcr.io/grid-x/modbus-dev:${{ inputs.target_tag || 'go1.21' }} steps: - uses: docker/login-action@v3 with: