From 225f92cb7a792cc6a2ec7c72713ea4db4f98eca1 Mon Sep 17 00:00:00 2001 From: Justin Harringa Date: Thu, 6 Jan 2022 17:18:01 -0800 Subject: [PATCH 1/2] Switch to buildpacks instead of Dockerfile Primary thing we lose with this change is our org.opencontainers.image labels. See https://github.com/buildpacks/community/discussions/101 for efforts in the community around this. Perhaps hold on this for now? --- .goreleaser.yml | 11 +---------- Dockerfile | 5 ----- project.toml | 9 +++++++++ 3 files changed, 10 insertions(+), 15 deletions(-) delete mode 100644 Dockerfile create mode 100644 project.toml diff --git a/.goreleaser.yml b/.goreleaser.yml index d300ca1..4fd35bc 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -11,16 +11,7 @@ builds: - arm64 dockers: - image_templates: ["ghcr.io/salesforce/ci-result-to-slack:{{ .Version }}"] - dockerfile: Dockerfile - build_flag_templates: - - --label=org.opencontainers.image.title={{ .ProjectName }} - - --label=org.opencontainers.image.description={{ .ProjectName }} - - --label=org.opencontainers.image.url=https://github.com/salesforce/ci-result-to-slack - - --label=org.opencontainers.image.source=https://github.com/salesforce/ci-result-to-slack - - --label=org.opencontainers.image.version={{ .Version }} - - --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }} - - --label=org.opencontainers.image.revision={{ .FullCommit }} - - --label=org.opencontainers.image.licenses=BSD-3-Clause + use: buildpacks nfpms: - maintainer: Justin Harringa description: Send your CI result to Slack upon pipeline completion diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 2647819..0000000 --- a/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM gcr.io/distroless/base-debian11 - -COPY ./ci-result-to-slack /ci-result-to-slack - -ENTRYPOINT ["/ci-result-to-slack"] diff --git a/project.toml b/project.toml new file mode 100644 index 0000000..f5d6021 --- /dev/null +++ b/project.toml @@ -0,0 +1,9 @@ +[project] +id = "com.salesforce.ci-result-to-slack" +name = "ci-result-to-slack" +authors = ["Justin Harringa"] +documentation-url = "https://github.com/salesforce/ci-result-to-slack#readme" +source-url = "https://github.com/salesforce/ci-result-to-slack" + +[[project.licenses]] +type = "BSD-3-Clause" \ No newline at end of file From d91ae171192dc181223c347009bfab466eb68cc0 Mon Sep 17 00:00:00 2001 From: Justin Harringa Date: Fri, 7 Jan 2022 18:05:50 -0800 Subject: [PATCH 2/2] Use gcr.io/paketo-buildpacks/image-labels to label --- .goreleaser.yml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 4fd35bc..3ca6fc9 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,19 @@ project_name: ci-result-to-slack +env: + - BP_OCI_TITLE={{ .ProjectName }} + - BP_OCI_AUTHORS=Justin Harringa + - BP_OCI_DESCRIPTION=Send your CI result to Slack upon pipeline completion + - BP_OCI_URL=https://github.com/salesforce/ci-result-to-slack + - BP_OCI_SOURCE=https://github.com/salesforce/ci-result-to-slack + - BP_OCI_DOCUMENTATION=https://github.com/salesforce/ci-result-to-slack/blob/main/README.md + - BP_OCI_REVISION={{ .FullCommit }} + - BP_OCI_VERSION={{ .Version }} + - BP_OCI_CREATED={{ time "2006-01-02T15:04:05Z07:00" }} + - BP_OCI_LICENSES=BSD-3-Clause + - BP_OCI_VENDOR=Salesforce.com builds: - - env: [CGO_ENABLED=0] + - env: + - CGO_ENABLED=0 main: ./cmd/ci-result-to-slack goos: - linux @@ -12,6 +25,20 @@ builds: dockers: - image_templates: ["ghcr.io/salesforce/ci-result-to-slack:{{ .Version }}"] use: buildpacks + build_flag_templates: + - --env=BP_OCI_TITLE + - --env=BP_OCI_AUTHORS + - --env=BP_OCI_DESCRIPTION + - --env=BP_OCI_URL + - --env=BP_OCI_SOURCE + - --env=BP_OCI_DOCUMENTATION + - --env=BP_OCI_VERSION + - --env=BP_OCI_VENDOR + - --env=BP_OCI_CREATED + - --env=BP_OCI_REVISION + - --env=BP_OCI_LICENSES + - --env=BP_OCI_URL + - --buildpack=gcr.io/paketo-buildpacks/image-labels nfpms: - maintainer: Justin Harringa description: Send your CI result to Slack upon pipeline completion @@ -20,4 +47,4 @@ nfpms: formats: - deb - rpm - - apk \ No newline at end of file + - apk