Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .github/composite/build-image/internal/standup-bot/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ inputs:
description: "Boolean indicating whether the image should be uploaded to Docker registry or not."
required: false
default: true
ARCH:
description: "Target architecture to build natively (amd64 or arm64). Each arch pushes to its own Docker repository (codebloom-standup-bot / codebloom-standup-bot-arm)."
required: false
default: amd64

outputs:
tag:
Expand Down Expand Up @@ -44,5 +48,6 @@ runs:
--docker-upload="${{ inputs.DOCKER_UPLOAD }}" \
--getGhaOutput=true \
--type="standup-bot" \
--arch="${{ inputs.ARCH }}" \
--environment="${{ inputs.ENVIRONMENT }}" \
--prId="${{ github.event.pull_request.number }}"
26 changes: 22 additions & 4 deletions .github/scripts/build-image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const {
getGhaOutput,
githubOutputFile,
type,
arch,
prId,
} = await yargs(hideBin(process.argv))
.option("environment", {
Expand Down Expand Up @@ -45,6 +46,12 @@ const {
demandOption: true,
default: "web" as Type,
})
.option("arch", {
choices: ["amd64", "arm64"] as const,
describe:
"Target architecture for type=standup-bot (built natively per-arch, one repo per arch); ignored for type=web, which always builds both in one multi-platform job",
default: "amd64" as const,
})
.option("prId", {
type: "string",
default: "",
Expand All @@ -55,6 +62,17 @@ const {

const tagPrefix = environment === "staging" ? "staging-" : "";

// `web` always builds both platforms in one multi-platform buildx job.
// `standup-bot` builds natively per-arch (no QEMU) to a separate repo per
// arch instead, since it has a large enough dependency tree that emulated
// compiles are impractically slow.
const dockerRepository =
type === "web" ? "codebloom"
: arch === "arm64" ? "codebloom-standup-bot-arm"
: "codebloom-standup-bot";
const platforms =
type === "web" ? ["linux/amd64", "linux/arm64"] : [`linux/${arch}`];

async function main() {
const {
dockerHubPat,
Expand Down Expand Up @@ -122,13 +140,13 @@ async function main() {
};

await dockerClient.buildImage({
dockerRepository: type === "web" ? "codebloom" : "codebloom-standup-bot",
dockerRepository,
dockerFileLocation:
type === "web" ? "infra/Dockerfile" : "internal/standup-bot/Dockerfile",
tags,
shouldUpload: dockerUpload,
buildArgs,
platforms: ["linux/amd64", "linux/arm64"],
platforms,
});

console.log("Image pushed successfully.");
Expand All @@ -151,9 +169,9 @@ async function main() {
prId,
owner: "Patina-Network",
repository: "codebloom",
message: `The image has been uploaded to https://hub.docker.com/r/patinanetwork/${type === "web" ? "codebloom" : "codebloom-standup-bot"}/tags under the following tags:
message: `The image has been uploaded to https://hub.docker.com/r/patinanetwork/${dockerRepository}/tags under the following tags:

${tags.map((t) => `- \`${type === "web" ? "codebloom" : "codebloom-standup-bot"}:${t}\``).join("\n")}
${tags.map((t) => `- \`${dockerRepository}:${t}\``).join("\n")}
`,
});
}
Expand Down
26 changes: 22 additions & 4 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,19 @@ jobs:
DOCKER_UPLOAD: "true"

buildStagingStandupBotImage:
name: Build staging image for codebloom-standup-bot
runs-on: ubuntu-latest
name: Build staging image for codebloom-standup-bot (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}

if: github.ref_name != 'main'

strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm

steps:
- name: Checkout repository
uses: actions/checkout@v6
Expand All @@ -140,6 +148,7 @@ jobs:
SECRETS: ${{ toJSON(secrets) }}
ENVIRONMENT: staging
DOCKER_UPLOAD: "true"
ARCH: ${{ matrix.arch }}

validateDBSchema:
name: Validate DB Schema on Prod DB
Expand Down Expand Up @@ -176,11 +185,19 @@ jobs:
SECRETS: ${{ toJSON(secrets) }}

buildStandupBotImage:
name: Build codebloom-standup-bot Docker Image & Upload to Registry
runs-on: ubuntu-latest
name: Build codebloom-standup-bot Docker Image & Upload to Registry (${{ matrix.arch }})
runs-on: ${{ matrix.runner }}

if: github.ref_name == 'main'

strategy:
matrix:
include:
- arch: amd64
runner: ubuntu-latest
- arch: arm64
runner: ubuntu-24.04-arm

steps:
- name: Checkout repository
uses: actions/checkout@v6
Expand All @@ -189,6 +206,7 @@ jobs:
uses: ./.github/composite/build-image/internal/standup-bot
with:
SECRETS: ${{ toJSON(secrets) }}
ARCH: ${{ matrix.arch }}

deploy:
name: deploy codebloom to K8S
Expand Down
Loading