Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add boringcrypto image #71

Merged
merged 42 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a24dc0d
Add boringcrypto image
dimitarvdimitrov Jul 13, 2023
88b02c9
Modify to us.gcr.io/kubernetes-dev
dimitarvdimitrov Jul 13, 2023
575d709
Add magic flags
dimitarvdimitrov Jul 13, 2023
a06702f
Add sudo
dimitarvdimitrov Jul 13, 2023
a11f830
Revert "Add sudo"
dimitarvdimitrov Jul 17, 2023
a17fc99
Revert "Add magic flags"
dimitarvdimitrov Jul 17, 2023
6249774
Revert "Modify to us.gcr.io/kubernetes-dev"
dimitarvdimitrov Jul 17, 2023
b6c5d0e
Only build amd64 with boringcrypto
dimitarvdimitrov Jul 17, 2023
d97bd3f
Run tests with boringcrypto as well
dimitarvdimitrov Jul 17, 2023
e5f524d
Add changelog entry
dimitarvdimitrov Jul 17, 2023
45eb9a2
Add integration test for boringcrypto
dimitarvdimitrov Jul 17, 2023
b51c9b8
Add comment to makefile
dimitarvdimitrov Jul 17, 2023
dacac67
Remove linux/arm64 from the correct image
dimitarvdimitrov Jul 17, 2023
7fe60d6
Remove phony
dimitarvdimitrov Jul 17, 2023
514e75b
Enable boringcrypto for integration tests
dimitarvdimitrov Jul 17, 2023
b824de3
Fix phony
dimitarvdimitrov Jul 17, 2023
292e8f9
Apply suggestions from code review
dimitarvdimitrov Jul 17, 2023
c712fe2
Pin go version in integration test
dimitarvdimitrov Jul 17, 2023
9feb4fc
Remove static flag
dimitarvdimitrov Jul 17, 2023
02e8ffe
Add libc
dimitarvdimitrov Jul 17, 2023
828b58b
Undo debugging changes
dimitarvdimitrov Jul 17, 2023
f6dd677
Undo debugging changes
dimitarvdimitrov Jul 17, 2023
8e6d007
Build for arm64 as well
dimitarvdimitrov Jul 17, 2023
e30b2af
Undo image prefix
dimitarvdimitrov Jul 17, 2023
fadf523
Remove unused target
dimitarvdimitrov Jul 17, 2023
7a0770d
Remove platform specification
dimitarvdimitrov Jul 17, 2023
f4ef221
Unpin go version in CI
dimitarvdimitrov Jul 17, 2023
83ce42f
Remove libc6-compat
dimitarvdimitrov Jul 18, 2023
91b79ef
Revert "Unpin go version in CI"
dimitarvdimitrov Jul 18, 2023
876b109
Revert "Revert "Unpin go version in CI""
dimitarvdimitrov Jul 18, 2023
f894913
Revert "Revert "Revert "Unpin go version in CI"""
dimitarvdimitrov Jul 18, 2023
6bfb0cb
Static binaries with musl
dimitarvdimitrov Jul 18, 2023
2e3ef2d
Revert "Revert "Revert "Revert "Unpin go version in CI""""
dimitarvdimitrov Jul 18, 2023
2c7bc12
Actually static binaries
dimitarvdimitrov Jul 18, 2023
1c6fa9b
Pin go version in CI
dimitarvdimitrov Jul 18, 2023
617719f
Remove gcompat
dimitarvdimitrov Jul 18, 2023
688eedc
Revert "Pin go version in CI"
dimitarvdimitrov Jul 18, 2023
45b9863
Apply suggestions from code review
dimitarvdimitrov Jul 18, 2023
70db5c6
Separate push targets
dimitarvdimitrov Jul 18, 2023
1b66e7b
Update Makefile
andyasp Jul 18, 2023
e28dcfb
Add phony targets
dimitarvdimitrov Jul 18, 2023
dcbde86
Too much phony
dimitarvdimitrov Jul 18, 2023
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
12 changes: 12 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
go-version: '1.20'
check-latest: true
- run: make test
- run: make test-boringcrypto

integration:
runs-on: ubuntu-latest
Expand All @@ -35,6 +36,17 @@ jobs:
- 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'
check-latest: true
- run: make build-image-boringcrypto
- run: make integration

dimitarvdimitrov marked this conversation as resolved.
Show resolved Hide resolved
lint:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## main / unreleased

* [FEATURE] Publish boringcrypto image for amd64. #71
dimitarvdimitrov marked this conversation as resolved.
Show resolved Hide resolved
* [ENHANCEMENT] Update the intermediate build container for the Docker image to `golang:1.20-bookworm`. #66 #67
dimitarvdimitrov marked this conversation as resolved.
Show resolved Hide resolved

## v0.6.0
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM --platform=$BUILDPLATFORM golang:1.20-bookworm AS build
aknuds1 marked this conversation as resolved.
Show resolved Hide resolved
FROM golang:1.20-bookworm AS build

ARG TARGETOS
ARG TARGETARCH
ARG BUILDTARGET=rollout-operator

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
RUN apk add --no-cache ca-certificates libc6-compat gcompat
dimitarvdimitrov marked this conversation as resolved.
Show resolved Hide resolved

COPY --from=build /src/rollout-operator/rollout-operator /bin/rollout-operator
ENTRYPOINT [ "/bin/rollout-operator" ]
Expand Down
18 changes: 14 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,28 @@ 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

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) .
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: 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) .
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) .
aknuds1 marked this conversation as resolved.
Show resolved Hide resolved
aknuds1 marked this conversation as resolved.
Show resolved Hide resolved
dimitarvdimitrov marked this conversation as resolved.
Show resolved Hide resolved

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

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"