Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Moss committed Jun 9, 2022
1 parent 7d87930 commit afe07c7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
FROM golang:1.18.3 AS deps
FROM --platform=$BUILDPLATFORM golang:1.18.3 AS deps

ARG KCTRL_VER=development
ARG TARGETOS TARGETARCH KCTRL_VER=development
WORKDIR /workspace

# dependencies
COPY ./hack/dependencies.* ./hack/
COPY go.* ./
COPY vendor vendor
RUN mkdir out
RUN go run ./hack/dependencies.go install -d out
RUN go run ./hack/dependencies.go install -d out --arch ${TARGETARCH} --os ${TARGETOS}

# kapp-controller
COPY . .
# helpful ldflags reference: https://www.digitalocean.com/community/tutorials/using-ldflags-to-set-version-information-for-go-applications
RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor -ldflags="-X 'main.Version=$KCTRL_VER'" -trimpath -o out/kapp-controller ./cmd/controller/...
RUN CGO_ENABLED=0 GOOS=linux go build -mod=vendor -ldflags="-X 'main.Version=$KCTRL_VER'" -trimpath -o out/kapp-controller-sidecarexec ./cmd/sidecarexec/main.go
RUN CGO_ENABLED=0 GOOS=linux GOOS=${TARGETOS} GOSARCH=${TARGETARCH} go build -mod=vendor -ldflags="-X 'main.Version=$KCTRL_VER'" -trimpath -o out/kapp-controller ./cmd/controller
RUN CGO_ENABLED=0 GOOS=linux GOOS=${TARGETOS} GOSARCH=${TARGETARCH} go build -mod=vendor -ldflags="-X 'main.Version=$KCTRL_VER'" -trimpath -o out/kapp-controller-sidecarexec ./cmd/sidecarexec

# --- run image ---
FROM photon:4.0
Expand Down
1 change: 1 addition & 0 deletions config-release/values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
push_images: true
image_cache: false
image_repo: ghcr.io/vmware-tanzu/carvel-kapp-controller
platform: "linux/amd64,linux/arm64"
13 changes: 8 additions & 5 deletions config/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ kind: Sources
sources:
- image: kapp-controller
path: .
#@ if/end not data.values.image_cache:
docker:
build:
#! Always rebuild image
buildx:
pull: true
noCache: true
noCache: #@ not data.values.image_cache
#! pass kapp_controller_version into Dockerfile.
rawOptions: #@ ["--build-arg", "KCTRL_VER="+data.values.kapp_controller_version]
rawOptions:
- #@ "--build-arg=KCTRL_VER="+data.values.kapp_controller_version
#@ if/end data.values.push_secret != "":
- #@ "--registry-secret="+data.values.push_secret
#@ if/end data.values.platform != "":
- #@ "--platform="+data.values.platform

#@ if/end data.values.push_images:
---
Expand Down
2 changes: 2 additions & 0 deletions config/values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ dangerous_enable_pprof: false
push_images: false
image_cache: true
image_repo: docker.io/k14stest/kapp-controller-test
push_secret: ""
platform: ""

api_port: 10350
kapp_controller_version: "develop"
2 changes: 1 addition & 1 deletion hack/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mkdir -p tmp/
# makes the get_kappctrl_ver function available (scrapes version from git tag)
source $(dirname "$0")/version-util.sh

ytt -f config/ -f config-release -v kapp_controller_version="$(get_kappctrl_ver)" | kbld -f- > ./tmp/release.yml
ytt -f config/ -f config-release -v kapp_controller_version="$(get_kappctrl_ver)" --data-values-env=KCTRL | kbld -f- > ./tmp/release.yml

shasum -a 256 ./tmp/release*.yml | tee ./tmp/checksums.txt

Expand Down

0 comments on commit afe07c7

Please sign in to comment.