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

ci: Fix goreleaser deprecation #5270

Merged
merged 3 commits into from
Dec 28, 2022
Merged

Conversation

francislavoie
Copy link
Member

@francislavoie francislavoie commented Dec 28, 2022

See https://goreleaser.com/deprecations/#archivesreplacements

I took the default for name_template documented at https://goreleaser.com/customization/archive/?h=archive#archives, turned it into a multi-line string using the "After" tab from https://goreleaser.com/deprecations/#archivesreplacements, then changed {{ .Os }} to be wrapped by an if darwin outputting mac instead.

Technically untested, the goreleaser_check seems to pass now but I didn't run it to see if the template has the expected result. I don't have it installed locally etc so would appreciate if you could test it out @mohammed90 😊

Copy link
Member

@mohammed90 mohammed90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the prompt fix! Here's the output of TAG=v2.6.2 goreleaser release --snapshot --skip-announce --skip-docker --skip-publish --skip-sbom --skip-sign --rm-dist:

dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_amd64.deb
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_amd64.tar.gz
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_arm64.deb
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_arm64.tar.gz
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_armv5.deb
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_armv5.tar.gz
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_armv6.deb
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_armv6.tar.gz
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_armv7.deb
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_armv7.tar.gz
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_ppc64le.deb
dist/caddy_2.6.2-SNAPSHOT-b1814345_linux_ppc64le.tar.gz
dist/caddy_2.6.2-SNAPSHOT-b1814345_mac_amd64.tar.gz
dist/caddy_2.6.2-SNAPSHOT-b1814345_mac_arm64.tar.gz

That output was possible after fixing the {{ - thing 🙂

.goreleaser.yml Outdated Show resolved Hide resolved
@emilylange
Copy link
Member

List of archives using the command @mohammed90 shared:

caddy_2.6.2-SNAPSHOT-580ccb84_freebsd_amd64.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_freebsd_arm64.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_freebsd_armv6.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_freebsd_armv7.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_linux_amd64.deb
caddy_2.6.2-SNAPSHOT-580ccb84_linux_amd64.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_linux_arm64.deb
caddy_2.6.2-SNAPSHOT-580ccb84_linux_arm64.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_linux_armv5.deb
caddy_2.6.2-SNAPSHOT-580ccb84_linux_armv5.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_linux_armv6.deb
caddy_2.6.2-SNAPSHOT-580ccb84_linux_armv6.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_linux_armv7.deb
caddy_2.6.2-SNAPSHOT-580ccb84_linux_armv7.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_linux_ppc64le.deb
caddy_2.6.2-SNAPSHOT-580ccb84_linux_ppc64le.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_linux_s390x.deb
caddy_2.6.2-SNAPSHOT-580ccb84_linux_s390x.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_mac_amd64.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_mac_arm64.tar.gz
caddy_2.6.2-SNAPSHOT-580ccb84_windows_amd64.zip
caddy_2.6.2-SNAPSHOT-580ccb84_windows_arm64.zip
caddy_2.6.2-SNAPSHOT-580ccb84_windows_armv5.zip
caddy_2.6.2-SNAPSHOT-580ccb84_windows_armv6.zip
caddy_2.6.2-SNAPSHOT-580ccb84_windows_armv7.zip

Copy link
Member

@emilylange emilylange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed that the .sboms for darwin/mac use _darwin_ instead of _mac_1.

- '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{if .Arm}}v{{ .Arm }}{{end}}.sbom'

I couldn't find a way to use a variable instead of copy pasting the templating, but

    documents:
    - >-
      {{ .ProjectName }}_
      {{- .Version }}_
      {{- if eq .Os "darwin" }}mac{{ else }}{{ .Os }}{{ end }}_
      {{- .Arch }}
      {{- with .Arm }}v{{ . }}{{ end }}
      {{- with .Mips }}_{{ . }}{{ end }}
      {{- if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}.sbom
    cmd: syft

works and makes the .sboms follow the archives' names.

Footnotes

  1. Can be seen in https://github.com/caddyserver/caddy/releases/tag/v2.6.2

@mohammed90
Copy link
Member

I just noticed that the .sboms for darwin/mac use _darwin_ instead of _mac_1.

- '{{ .Binary }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{if .Arm}}v{{ .Arm }}{{end}}.sbom'

I couldn't find a way to use a variable instead of copy pasting the templating, but

    documents:
    - >-
      {{ .ProjectName }}_
      {{- .Version }}_
      {{- if eq .Os "darwin" }}mac{{ else }}{{ .Os }}{{ end }}_
      {{- .Arch }}
      {{- with .Arm }}v{{ . }}{{ end }}
      {{- with .Mips }}_{{ . }}{{ end }}
      {{- if not (eq .Amd64 "v1") }}{{ .Amd64 }}{{ end }}.sbom
    cmd: syft

works and makes the .sboms follow the archives' names.

Footnotes

1. Can be seen in https://github.com/caddyserver/caddy/releases/tag/v2.6.2 [↩](#user-content-fnref-1-cc6ad68b02163209145680033a5e8148)

Good catch!

@francislavoie
Copy link
Member Author

Thanks guys.

Final 👍 before I merge?

Copy link
Member

@emilylange emilylange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good 👍

Outputs:

caddy_2.6.2-SNAPSHOT-91554ed7_freebsd_amd64.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_freebsd_amd64.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_freebsd_arm64.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_freebsd_arm64.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_freebsd_armv6.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_freebsd_armv6.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_freebsd_armv7.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_freebsd_armv7.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_linux_amd64.deb
caddy_2.6.2-SNAPSHOT-91554ed7_linux_amd64.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_linux_amd64.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_linux_arm64.deb
caddy_2.6.2-SNAPSHOT-91554ed7_linux_arm64.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_linux_arm64.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_linux_armv5.deb
caddy_2.6.2-SNAPSHOT-91554ed7_linux_armv5.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_linux_armv5.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_linux_armv6.deb
caddy_2.6.2-SNAPSHOT-91554ed7_linux_armv6.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_linux_armv6.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_linux_armv7.deb
caddy_2.6.2-SNAPSHOT-91554ed7_linux_armv7.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_linux_armv7.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_linux_ppc64le.deb
caddy_2.6.2-SNAPSHOT-91554ed7_linux_ppc64le.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_linux_ppc64le.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_linux_s390x.deb
caddy_2.6.2-SNAPSHOT-91554ed7_linux_s390x.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_linux_s390x.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_mac_amd64.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_mac_amd64.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_mac_arm64.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_mac_arm64.tar.gz
caddy_2.6.2-SNAPSHOT-91554ed7_windows_amd64.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_windows_amd64.zip
caddy_2.6.2-SNAPSHOT-91554ed7_windows_arm64.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_windows_arm64.zip
caddy_2.6.2-SNAPSHOT-91554ed7_windows_armv5.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_windows_armv5.zip
caddy_2.6.2-SNAPSHOT-91554ed7_windows_armv6.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_windows_armv6.zip
caddy_2.6.2-SNAPSHOT-91554ed7_windows_armv7.sbom
caddy_2.6.2-SNAPSHOT-91554ed7_windows_armv7.zip

@francislavoie francislavoie merged commit b40548f into master Dec 28, 2022
@francislavoie francislavoie deleted the goreleaser-deprecation-fix branch December 28, 2022 18:11
@mholt
Copy link
Member

mholt commented Dec 28, 2022

You guys are incredible. Thanks for this and everything else you do!

francislavoie added a commit to caddyserver/xcaddy that referenced this pull request Jan 21, 2023
See caddyserver/caddy#5270 where we made this change for Caddy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI/CD 🔩 Automated tests, releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants