-
Notifications
You must be signed in to change notification settings - Fork 5
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
Multi-platform cleanup #58
Changes from all commits
6057fce
849d30a
170e574
a10040a
8232353
6c7fcd7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ sopstool | |
c.out | ||
*.cover | ||
.idea | ||
.vscode | ||
.vscode | ||
bin |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
report_sizes: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these get tracked in an output json, this was useful for debugging. |
||
|
||
# Build customization | ||
builds: | ||
- env: | ||
|
@@ -6,32 +8,41 @@ builds: | |
goos: | ||
- darwin | ||
- linux | ||
- windows | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
goarm: | ||
- "" | ||
goamd64: | ||
- "" | ||
Comment on lines
+15
to
+18
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is an empty string meant to clear the defaults? If so, you could set them to:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I have to specificaly set them - the default for goamd64 is |
||
|
||
universal_binaries: | ||
- id: sopstool | ||
# Whether to remove the previous single-arch binaries from the artifact list. | ||
# If left as false, your end release might have both several macOS archives: | ||
# amd64, arm64 and all. | ||
replace: true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. locally, it still produces all 3. i'm not sure what the release will look like |
||
|
||
archives: | ||
- id: newzips | ||
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
Comment on lines
+30
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we use windows? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ibotta doesnt, but I want to on a windows project. |
||
|
||
checksum: | ||
# You can change the name of the checksums file. | ||
# This is parsed with the Go template engine and the following variables | ||
# are available: | ||
# - ProjectName | ||
# - Tag | ||
# - Version (Git tag without `v` prefix) | ||
# - Env (environment variables) | ||
# Default is `{{ .ProjectName }}_{{ .Version }}_checksums.txt`. | ||
name_template: "{{ .ProjectName }}_checksums.txt" | ||
|
||
sboms: | ||
- artifacts: binary | ||
documents: ["{{ .Binary }}_{{ .Os }}_{{ .Arch }}.sbom"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. match format of the binary |
||
|
||
nfpms: | ||
- id: default | ||
# You can change the file name of the package. | ||
# | ||
# Default: `{{ .PackageName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}` | ||
file_name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}" | ||
# file_name_template: "{{ .ProjectName }}_{{ .Os }}" | ||
vendor: Ibotta | ||
homepage: https://github.com/Ibotta/sopstool | ||
maintainer: Ibotta <[email protected]> | ||
|
@@ -41,6 +52,7 @@ nfpms: | |
formats: | ||
- deb | ||
- rpm | ||
- apk | ||
# Packages your package depends on. | ||
dependencies: | ||
- sops | ||
|
@@ -81,73 +93,15 @@ blobs: | |
bucket: oss-pkg.ibotta.com | ||
# AWS Region to use. | ||
region: us-east-1 | ||
# path inside the bucket. | ||
# This is parsed with the Go template engine and the following variables | ||
# are available: | ||
# - ProjectName | ||
# - Tag | ||
# - Version (Git tag without `v` prefix) | ||
# There is also a template function "time" that takes a Go time format | ||
# string to insert a formated timestamp into the release name. | ||
# Default is `{{ .ProjectName }}/{{ .Tag }}` | ||
# folder: | ||
# Default: '{{ .ProjectName }}/{{ .Tag }}' | ||
folder: "{{ .ProjectName }}/{{ .Tag }}" | ||
- provider: s3 | ||
bucket: oss-pkg.ibotta.com | ||
region: us-east-1 | ||
folder: "{{ .ProjectName }}" | ||
|
||
dockers: | ||
- id: amd64image | ||
goos: linux | ||
# GOARCH of the built binary that should be used. | ||
goarch: amd64 | ||
# GOARM of the built binary that should be used. | ||
goarm: "" | ||
# Name templates of the built binaries that should be used. | ||
ids: | ||
- sopstool | ||
# Templates of the Docker image names. | ||
image_templates: | ||
- "ibotta/{{ .ProjectName }}:latest" | ||
- "ibotta/{{ .ProjectName }}:{{ .Version }}" | ||
- "ibotta/{{ .ProjectName }}:{{ .Tag }}" | ||
- "ibotta/{{ .ProjectName }}:v{{ .Major }}" | ||
- "ibotta/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}" | ||
- "ibotta/{{ .ProjectName }}:latest-amd64" | ||
- "ibotta/{{ .ProjectName }}:{{ .Version }}-amd64" | ||
- "ibotta/{{ .ProjectName }}:{{ .Tag }}-amd64" | ||
- "ibotta/{{ .ProjectName }}:v{{ .Major }}-amd64" | ||
- "ibotta/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}-amd64" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:latest" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:{{ .Version }}" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:{{ .Tag }}" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:v{{ .Major }}" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:latest-amd64" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:{{ .Version }}-amd64" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:{{ .Tag }}-amd64" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:v{{ .Major }}-amd64" | ||
- "ghcr.io/ibotta/{{ .ProjectName }}:v{{ .Major }}.{{ .Minor }}-amd64" | ||
# Skips the docker push. Could be useful if you also do draft releases. | ||
# If set to auto, the release will not be pushed to the docker repository | ||
# in case there is an indicator for prerelease in the tag e.g. v1.0.0-rc1 | ||
# Defaults to false. | ||
skip_push: false | ||
# Path to the Dockerfile (from the project root). | ||
dockerfile: Dockerfile | ||
# Template of the docker build flags. | ||
build_flag_templates: | ||
- "--label=org.label-schema.schema-version=1.0" | ||
- "--label=org.label-schema.version={{.Version}}" | ||
- "--label=org.label-schema.name={{.ProjectName}}" | ||
# If your Dockerfile copies files other than the binary itself, | ||
# you should list them here as well. | ||
# Note that goreleaser will create the same structure inside the temporary | ||
# folder, so if you add `foo/bar.json` here, on your Dockerfile you can | ||
# `COPY foo/bar.json /whatever.json`. | ||
# Also note that the paths here are relative to the folder in which | ||
# goreleaser is being run. | ||
# This field does not support wildcards, you can add an entire folder here | ||
# and use wildcards when you `COPY`/`ADD` in your Dockerfile. | ||
extra_files: | ||
- sopsinstall.sh | ||
- glob: ./*install.sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have the deploy upload the installers instead of the extra script |
||
|
||
publishers: | ||
- name: deploy-sops | ||
cmd: ./scripts/deploy-sops |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,14 @@ | ||
FROM alpine:latest as build | ||
ARG TARGETARCH | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gets |
||
|
||
RUN apk --update add ca-certificates | ||
|
||
# download appropriate sops (script gets latest) | ||
COPY sopsinstall.sh /tmp/sopsinstall.sh | ||
RUN sh /tmp/sopsinstall.sh -b /usr/local/bin | ||
RUN sh /tmp/sopsinstall.sh -b /usr/local/bin -a $TARGETARCH | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. decided to continue using a script to get this since sops puts the version number in their github release artifacts, so it still needs to do the tag lookup. |
||
|
||
# grab appropriate sopstool binary from dist | ||
COPY dist/sopstool_linux_$TARGETARCH/sopstool /usr/local/bin/sopstool | ||
Comment on lines
+10
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you mean to copy the dist file from the host machine? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see now that the Dockerfile is just importing the binary anyway. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes - this is the build of the image from the compiled source outputs of goreleaser. |
||
|
||
########## | ||
|
||
|
@@ -13,7 +19,7 @@ COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certifica | |
# get sops | ||
COPY --from=build usr/local/bin/sops /usr/local/bin/sops | ||
# get sopstool | ||
COPY sopstool /usr/local/bin/sopstool | ||
COPY --from=build usr/local/bin/sopstool /usr/local/bin/sopstool | ||
|
||
WORKDIR /work | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is so goreleaser can create SBOMs for the binaries (we also have docker buildx, which uses the same tool, create SBOMs for the containers)