Skip to content

Commit

Permalink
docs: improve deb fields var expansion example (#693)
Browse files Browse the repository at this point in the history
`$CI_REPOSITORY_URL` is not quite appropriate for `Vcs-Git`,
use `$CI_PROJECT_URL` with `Vcs-Browser` instead.

https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
https://www.debian.org/doc/debian-policy/ch-controlfields.html#version-control-system-vcs-fields
  • Loading branch information
scop authored Jul 14, 2023
1 parent a70fafc commit c37d2ea
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions nfpm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ func TestOptionsFromEnvironment(t *testing.T) {
packager = "nope"
maintainerEmail = "nope@example.com"
homepage = "https://nfpm.goreleaser.com"
vcsURL = "https://github.com/goreleaser/nfpm.git"
vcsBrowser = "https://github.com/goreleaser/nfpm"
)

t.Run("platform", func(t *testing.T) {
Expand Down Expand Up @@ -497,15 +497,15 @@ overrides:
})

t.Run("deb fields", func(t *testing.T) {
t.Setenv("CI_REPOSITORY_URL", vcsURL)
t.Setenv("CI_PROJECT_URL", vcsBrowser)
info, err := nfpm.Parse(strings.NewReader(`
name: foo
deb:
fields:
Vcs-Git: ${CI_REPOSITORY_URL}
Vcs-Browser: ${CI_PROJECT_URL}
`))
require.NoError(t, err)
require.Equal(t, vcsURL, info.Deb.Fields["Vcs-Git"])
require.Equal(t, vcsBrowser, info.Deb.Fields["Vcs-Browser"])
})
}

Expand Down
2 changes: 1 addition & 1 deletion www/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ deb:
key_id: bc8acdd415bd80b3

# Additional fields for the control file. Empty fields are ignored.
# This will expand any env vars you set in the field values, e.g. Vcs-Git: ${CI_REPOSITORY_URL}
# This will expand any env vars you set in the field values, e.g. Vcs-Browser: ${CI_PROJECT_URL}
fields:
Bugs: https://github.com/goreleaser/nfpm/issues

Expand Down

0 comments on commit c37d2ea

Please sign in to comment.