Skip to content

Commit

Permalink
release-0.6: Add boringcrypto image (#73)
Browse files Browse the repository at this point in the history
* Add boringcrypto image (#71)

---------

Co-authored-by: Arve Knudsen <[email protected]>
Co-authored-by: Andy Asp <[email protected]>

* Update CHANGELOG.md

* Pin go version in CI

---------

Co-authored-by: Arve Knudsen <[email protected]>
Co-authored-by: Andy Asp <[email protected]>
  • Loading branch information
3 people authored Jul 22, 2023
1 parent 1b68a51 commit 9528627
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 11 deletions.
20 changes: 16 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.20.4'
go-version: '1.20.5'
- run: make rollout-operator

test:
Expand All @@ -19,26 +19,38 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.20.4'
go-version: '1.20.5'
- run: make test
- run: make test-boringcrypto

integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.20.4'
go-version: '1.20.5'
- run: make build-image
- run: make integration

integration-boringcrypto:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20.5'
check-latest: true
- run: make build-image-boringcrypto
- run: make integration

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: '^1.20.4'
go-version: '1.20.5'
- uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## main / unreleased

## v0.6.1

* [FEATURE] Publish an additional boringcrypto image for linux/amd64,linux/arm64. #71

## v0.6.0

* [ENHANCEMENT] Update Go to `1.20.4`. #55
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
FROM --platform=$BUILDPLATFORM golang:1.20.4-bullseye AS build
FROM golang:1.20-alpine3.18 AS build

ARG TARGETOS
ARG TARGETARCH
ARG BUILDTARGET=rollout-operator

RUN apk add --no-cache build-base git

COPY . /src/rollout-operator
WORKDIR /src/rollout-operator
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} make
RUN GOOS=${TARGETOS} GOARCH=${TARGETARCH} make ${BUILDTARGET}

FROM alpine:3.18
RUN apk add --no-cache ca-certificates
Expand Down
27 changes: 23 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
GIT_REVISION := $(shell git rev-parse --short HEAD)
IMAGE_PREFIX ?= grafana
IMAGE_TAG ?= $(GIT_BRANCH)-$(GIT_REVISION)
IMAGE_TAG ?= $(subst /,-,$(GIT_BRANCH))-$(GIT_REVISION)

GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
Expand All @@ -13,18 +13,37 @@ GO_FILES := $(shell find . $(DONT_FIND) -o -type f -name '*.go' -print)
rollout-operator: $(GO_FILES)
GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build -ldflags '-extldflags "-static"' ./cmd/rollout-operator

.PHONY: rollout-operator-boringcrypto
rollout-operator-boringcrypto: $(GO_FILES)
GOEXPERIMENT=boringcrypto GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=1 go build -tags netgo ./cmd/rollout-operator

.PHONY: build-image
build-image: clean
docker buildx build --load --platform linux/amd64 --build-arg revision=$(GIT_REVISION) -t rollout-operator:latest -t rollout-operator:$(IMAGE_TAG) .

.PHONY: publish-image
publish-image: clean
docker buildx build --push --platform linux/amd64,linux/arm64 --build-arg revision=$(GIT_REVISION) -t $(IMAGE_PREFIX)/rollout-operator:$(IMAGE_TAG) .
.PHONY: build-image-boringcrypto
build-image-boringcrypto: clean ## Build the rollout-operator image with boringcrypto and tag with the regular image repo, so that it can be used in integration tests.
docker buildx build --load --platform linux/amd64 --build-arg revision=$(GIT_REVISION) --build-arg BUILDTARGET=rollout-operator-boringcrypto -t rollout-operator:latest -t rollout-operator:$(IMAGE_TAG) .

.PHONY: publish-images
publish-images: publish-standard-image publish-boringcrypto-image

.PHONY: publish-standard-image
publish-standard-image: clean
docker buildx build --push --platform linux/amd64,linux/arm64 --build-arg revision=$(GIT_REVISION) --build-arg BUILDTARGET=rollout-operator -t $(IMAGE_PREFIX)/rollout-operator:$(IMAGE_TAG) .

.PHONY: publish-boringcrypto-image
publish-boringcrypto-image: clean
docker buildx build --push --platform linux/amd64,linux/arm64 --build-arg revision=$(GIT_REVISION) --build-arg BUILDTARGET=rollout-operator-boringcrypto -t $(IMAGE_PREFIX)/rollout-operator-boringcrypto:$(IMAGE_TAG) .

.PHONY: test
test:
go test ./...

.PHONY: test-boringcrypto
test-boringcrypto:
GOEXPERIMENT=boringcrypto go test ./...

.PHONY: integration
integration: integration/mock-service/.uptodate
go test -v -tags requires_docker -count 1 -timeout 1h ./integration/...
Expand Down
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@
```
1. Publish the updated Docker image
```bash
$ IMAGE_TAG="${tag}" make publish-image
$ IMAGE_TAG="${tag}" make publish-images
```
6 changes: 6 additions & 0 deletions cmd/rollout-operator/boringcrypto.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
//go:build boringcrypto
// +build boringcrypto

package main

import _ "crypto/tls/fipsonly"

0 comments on commit 9528627

Please sign in to comment.