-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #248 from carverauto/fix/ko_container_builds_cicd
Fix/ko container builds cicd
- Loading branch information
Showing
2 changed files
with
7 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
# .github/workflows/container-build.yml | ||
name: Build and Push Containers | ||
on: | ||
push: | ||
|
@@ -32,31 +31,9 @@ jobs: | |
with: | ||
go-version: '1.24' | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
cache: 'npm' | ||
cache-dependency-path: 'web/package-lock.json' | ||
|
||
- name: Install build dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y libsqlite3-dev gcc | ||
- name: Setup ko | ||
uses: ko-build/[email protected] | ||
|
||
- name: Build web UI | ||
run: ./scripts/build-web.sh | ||
|
||
- name: Move web artifacts | ||
run: | | ||
mkdir -p pkg/cloud/api/web/ | ||
cp -r web/dist pkg/cloud/api/web/ | ||
mkdir -p cmd/cloud/.kodata | ||
cp -r web/dist cmd/cloud/.kodata/web | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
|
@@ -66,44 +43,15 @@ jobs: | |
|
||
- name: Build and push container images | ||
run: | | ||
# Common tag variables | ||
SHA_TAG=sha-${{ steps.vars.outputs.sha_short }} | ||
# Build agent | ||
echo "Pushing to ${{ env.BASE_REPO }}/serviceradar-agent" | ||
cd cmd/agent | ||
KO_DOCKER_REPO=${{ env.BASE_REPO }}/serviceradar-agent GOFLAGS="-tags=containers" ko build \ | ||
--platform=linux/amd64,linux/arm64 \ | ||
--tags=${SHA_TAG},latest \ | ||
--bare . | ||
cd ../.. | ||
# Build poller | ||
cd cmd/poller | ||
KO_DOCKER_REPO=${{ env.BASE_REPO }}/serviceradar-poller GOFLAGS="-tags=containers" ko build \ | ||
--platform=linux/amd64,linux/arm64 \ | ||
--tags=${SHA_TAG},latest \ | ||
--bare . | ||
cd ../.. | ||
# Build cloud (with CGO enabled) | ||
cd cmd/cloud | ||
CGO_ENABLED=1 KO_DOCKER_REPO=${{ env.BASE_REPO }}/serviceradar-cloud GOFLAGS="-tags=containers" ko build \ | ||
--platform=linux/amd64 \ | ||
--tags=${SHA_TAG},latest \ | ||
--bare . | ||
--bare --verbose . | ||
cd ../.. | ||
# Build dusk checker | ||
cd cmd/checkers/dusk | ||
KO_DOCKER_REPO=${{ env.BASE_REPO }}/serviceradar-dusk-checker GOFLAGS="-tags=containers" ko build \ | ||
--platform=linux/amd64,linux/arm64 \ | ||
--tags=${SHA_TAG},latest \ | ||
--bare . | ||
cd ../../.. | ||
# Build snmp checker | ||
cd cmd/checkers/snmp | ||
KO_DOCKER_REPO=${{ env.BASE_REPO }}/serviceradar-snmp-checker GOFLAGS="-tags=containers" ko build \ | ||
--platform=linux/amd64,linux/arm64 \ | ||
--tags=${SHA_TAG},latest \ | ||
--bare . | ||
# Uncomment after agent works | ||
# cd cmd/cloud | ||
# KO_DOCKER_REPO=${{ env.BASE_REPO }}/serviceradar-cloud CGO_ENABLED=1 GOFLAGS="-tags=containers" ko build ... | ||
# (add other components) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
defaultBaseImage: cgr.dev/chainguard/ko |