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

Update trust manager #1384

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ jobs:
container-image: "trust-manager"
- dir: "./trust-packages"
container-image: "trust-packages"
make-targets: "download-certificates"
- dir: "./ttypdb"
container-image: "ttypdb-controller"
target: "controller"
Expand Down
14 changes: 5 additions & 9 deletions maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -882,24 +882,20 @@ Only the base image and module dependency should be updated.
![Regular Update](./regular_update.svg)

1. Check the [release page](https://github.com/cert-manager/trust-manager/releases).
2. Check the upstream Dockerfile. If there are any updates, update our `Dockerfile`.
- https://github.com/cert-manager/trust-manager/blob/vX.Y.Z/Dockerfile
3. Update `BRANCH` and `TAG` files.
2. Update `BRANCH` and `TAG` files.

## trust-packages

![Regular Update](./regular_update.svg)

1. Check the [release page](https://github.com/cert-manager/trust-manager/releases).
2. Check the upstream Containerfile. If there are any updates, update our `Dockerfile`.
- https://github.com/cert-manager/trust-manager/blob/vX.Y.Z/trust-packages/debian/Containerfile
3. Update `TRUST_MANAGER_VERSION` in `Dockerfile`.
4. Update `EXPECTED_VERSION` in `Dockerfile` as needed. You can check it to run docker command as follows.
2. Update `TRUST_MANAGER_VERSION` in `Dockerfile`.
3. Update `EXPECTED_VERSION` in `Dockerfile` as needed. You can check it to run docker command as follows.
```bash
$ docker run --rm ghcr.io/cybozu/ubuntu:22.04 dpkg-query --show ca-certificates
```
5. Check the [tini release page](https://github.com/krallin/tini/releases) and update `TINI_VERSION` in `Dockerfile` as needed.
6. Update `TAG` file. The TAG format is `<ca-certificates version>.<patch version>`.
4. Check the [tini release page](https://github.com/krallin/tini/releases) and update `TINI_VERSION` in `Dockerfile` as needed.
5. Update `TAG` file. The TAG format is `<ca-certificates version>.<patch version>`.

## ttypdb

Expand Down
2 changes: 1 addition & 1 deletion trust-manager/BRANCH
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9
0.11
5 changes: 4 additions & 1 deletion trust-manager/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ RUN VERSION=$(cut -d \. -f 1,2,3 < /TAG ) \
&& curl -fsSL https://github.com/cert-manager/trust-manager/archive/v${VERSION}.tar.gz | \
tar --strip-components=1 -xzf -

RUN make build
# Parameters retrieved from:
# $ make ko-config-manager
# $ cat _bin/scratch/image/oci-layout-manager.v0.11.1.ko_config.yaml
RUN CGO_ENABLED=0 GO_EXPERIMENT= go build -ldflags '-w -s' -o bin/trust-manager ./cmd/trust-manager

# Stage2: setup runtime container
FROM scratch
Expand Down
2 changes: 1 addition & 1 deletion trust-manager/TAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.2.1
0.11.1.1
1 change: 1 addition & 0 deletions trust-packages/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*
!trust-manager-source
1 change: 1 addition & 0 deletions trust-packages/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/trust-manager-source
35 changes: 9 additions & 26 deletions trust-packages/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,24 @@
# Stage1: build from source
FROM ghcr.io/cybozu/golang:1.22-jammy AS build

ARG TRUST_MANAGER_VERSION=0.9.2
ARG TRUST_MANAGER_VERSION=0.11.1
ARG TINI_VERSION=0.19.0
WORKDIR /work
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl -fsSL https://github.com/cert-manager/trust-manager/archive/v${TRUST_MANAGER_VERSION}.tar.gz | \
tar --strip-components=1 -xzf -
RUN CGO_ENABLED=0 go build -o debian-bundle-static ./trust-packages/debian/main.go

WORKDIR /work/trust-packages/debian
RUN CGO_ENABLED=0 go build -o copyandmaybepause main.go
RUN CGO_ENABLED=0 go install github.com/cert-manager/trust-manager/cmd/validate-trust-package@main

# Stage2: copy ca-certificates from ubuntu
FROM quay.io/cybozu/ubuntu:22.04 as debbase

ARG EXPECTED_VERSION=20230311ubuntu0.22.04.1
ARG VERSION_SUFFIX=.0
ARG TINI_VERSION=0.19.0
WORKDIR /work

COPY --from=build /work/trust-packages/debian/build.sh /work/build.sh
COPY --from=build /go/bin/validate-trust-package /usr/bin/validate-trust-package

RUN /work/build.sh $EXPECTED_VERSION $VERSION_SUFFIX /work/package.json
RUN curl -fsSL -o /usr/bin/tini-static https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static

# Stage3: setup runtime container
# Stage2: setup runtime container
FROM scratch
LABEL org.opencontainers.image.source="https://github.com/cybozu/neco-containers"
LABEL description="cert-manager trust package based on Debian"

COPY --from=debbase /usr/bin/tini-static /tini
COPY --from=debbase /work/package.json /debian-package/cert-manager-package-debian.json
COPY --from=build /work/trust-packages/debian/copyandmaybepause /copyandmaybepause
COPY --from=build /work/debian-bundle-static /debian-bundle-static
COPY --from=build /work/LICENSE /LICENSE

ENTRYPOINT ["/tini", "--"]
COPY trust-manager-source/package.json /debian-package/cert-manager-package-debian.json

USER 10000:10000
CMD ["/copyandmaybepause", "/debian-package", "/packages"]

ENTRYPOINT ["/debian-bundle-static"]
CMD ["/debian-package", "/packages"]
23 changes: 23 additions & 0 deletions trust-packages/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
TRUST_MANAGER_VERSION := $(shell cat ../trust-manager/TAG | cut -d'.' -f1-3)
TRUST_MANAGER_SOURCE := trust-manager-source

.PHONY: clean
clean:
rm -rf ./$(TRUST_MANAGER_SOURCE)

$(TRUST_MANAGER_SOURCE):
mkdir $@
cd $@; \
curl -fsSL https://github.com/cert-manager/trust-manager/archive/v$(TRUST_MANAGER_VERSION).tar.gz | \
tar --strip-components=1 -xzf -

$(TRUST_MANAGER_SOURCE)/validate-trust-package: | $(TRUST_MANAGER_SOURCE)
cd $(TRUST_MANAGER_SOURCE); go build -o validate-trust-package ./cmd/validate-trust-package/main.go

$(TRUST_MANAGER_SOURCE)/package.json: | $(TRUST_MANAGER_SOURCE) $(TRUST_MANAGER_SOURCE)/validate-trust-package
BIN_VALIDATE_TRUST_PACKAGE=$(TRUST_MANAGER_SOURCE)/validate-trust-package \
$(TRUST_MANAGER_SOURCE)/make/debian-trust-package-fetch.sh latest ghcr.io/cybozu/ubuntu:22.04 \
$(TRUST_MANAGER_SOURCE)/package.json latest

.PHONY: download-certificates
download-certificates: | $(TRUST_MANAGER_SOURCE)/package.json
2 changes: 1 addition & 1 deletion trust-packages/TAG
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20230311ubuntu0.22.04.1.2
20230311ubuntu0.22.04.1.3
Loading