Describe the bug
When building a new rpm or deb package with extra files defined in the config, the files are not placed in the package.
To Reproduce
Steps to reproduce the behavior:
project_name: my-login-metrics
release:
prerelease: auto
before:
hooks:
- go mod tidy
builds:
-
id: my-login-metrics
goos:
- linux
goarch:
- amd64
blobs:
- provider: s3
bucket: my-packages
folder: "{{ .ProjectName }}/{{.Tag}}"
nfpms:
-
# ID of the nfpm config, must be unique.
# Defaults to "default".
id: my-login-metrics
# Name of the package.
# Defaults to `ProjectName`.
package_name: my-login-metrics
# You can change the file name of the package.
# Default: `{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ if .Mips }}_{{ .Mips }}{{ end }}`
file_name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
# Build IDs for the builds you want to create NFPM packages for.
# Defaults to all builds.
builds:
- my-login-metrics
# Replacements for GOOS and GOARCH in the package name.
# Keys should be valid GOOSs or GOARCHs.
# Values are the respective replacements.
# Default is empty.
replacements:
amd64: x64
# Your app's description.
# Default is empty.
description: Scrape Metrics from the Login Attempts Database
# Formats to be generated.
formats:
- deb
- rpm
scripts:
postinstall: "scripts/postinstall.sh"
contents:
- src: ./my-login-metrics.service
dst: /etc/systemd/system/my-login-metrics.service
type: config
# Package release.
# Defaults to empty.
release: 1
Make sure your config file is valid by running
goreleaser check -f path-to-config-file.
Expected behavior
A clear and concise description of what you expected to happen.
When the deb and/or the rpm files are created, they only contain the go binary, not the, postinstall.sh script or the .service file
deb package contents:
dpkg -c dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.deb
drwxr-xr-x 0/0 0 2020-12-29 19:20 ./usr/
drwxr-xr-x 0/0 0 2020-12-29 19:20 ./usr/local/
drwxr-xr-x 0/0 0 2020-12-29 19:20 ./usr/local/bin/
-rwxr-xr-x 0/0 11931648 2020-12-29 19:20 ./usr/local/bin/my-login-metrics
rpm package contents:
rpm -qlp dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.rpm
/usr/local/bin/my-login-metrics
Environment (please complete the following information):
goreleaser version 0.150.0Additional context
Add any other context about the problem here. Full output log with debug on
is probably a helpful thing to add here.
Debug Output
• debug logs enabled
• releasing...
• loading config file file=.goreleaser.yml
• loaded config file config={my-login-metrics [] { false false auto [] []} [] [] { { } { } [] [] []} [{my-login-metrics [linux] [amd64] [] [] [] [] [] [] {[] []} [] [] [] false }] [] [{{{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }} my-login-metrics 1 map[amd64:x64] [] [] [] [] [] [] [0xc00019c140] map[] map[] map[] { scripts/postinstall.sh } { map[] [] { }} {{ } {[] [] [] [] [] []} [] { }} {{ }}} map[] my-login-metrics [my-login-metrics] [deb rpm] Scrape Metrics from the Login Attpemts Database false}] [] {} { [] false} [] [] [] [] [{my-packages s3 false {{ .ProjectName }}/{{.Tag}} [] []}] [] {{[]} false} [] { } {[go mod tidy]} { false} { [] [] [] [] [] [] [] [] {[] []} [] [] [] false } { false} { false} { false}}
• parallelism: 4
• loading environment variables
• token type: github
• getting and validating git state
• running git args=[-c log.showSignature=false rev-parse --is-inside-work-tree]
• git result stderr= stdout=true
• running git args=[-c log.showSignature=false rev-parse --is-inside-work-tree]
• git result stderr= stdout=true
• running git args=[-c log.showSignature=false rev-parse --abbrev-ref HEAD --quiet]
• git result stderr= stdout=master
• running git args=[-c log.showSignature=false show --format='%h' HEAD --quiet]
• git result stderr= stdout='2b0cc04'
• running git args=[-c log.showSignature=false show --format='%H' HEAD --quiet]
• git result stderr= stdout='2b0cc04be39f232b52a4d8240a7a95d20d26d968'
• running git args=[-c log.showSignature=false show --format='%ct' HEAD --quiet]
• git result stderr= stdout='1609270872'
• running git args=[-c log.showSignature=false ls-remote --get-url]
• git result stderr= stdout=<git repo here>
• running git args=[-c log.showSignature=false tag --points-at HEAD --sort -version:creatordate]
• git result stderr= stdout=v0.0.6
• releasing v0.0.6, commit 2b0cc04be39f232b52a4d8240a7a95d20d26d968
• pipe skipped error=disabled during snapshot mode
• parsing tag
• running before hooks
• running go mod tidy
• cmd=go mod tidy
• setting defaults
• snapshotting
• github/gitlab/gitea releases
• running git args=[-c log.showSignature=false rev-parse --is-inside-work-tree]
• git result stderr= stdout=true
• running git args=[-c log.showSignature=false config --get remote.origin.url]
• git result stderr= stdout=<git repo here>
• pre-release was detected for tag v0.0.6: false
• pre-release for tag v0.0.6 set to false
• project name
• building binaries
• creating source archive
• archives
• linux packages
• snapcraft packages
• calculating checksums
• signing artifacts
• docker images
• artifactory
• blobs
• homebrew tap formula
• scoop manifests
• milestones
• running git args=[-c log.showSignature=false rev-parse --is-inside-work-tree]
• git result stderr= stdout=true
• running git args=[-c log.showSignature=false config --get remote.origin.url]
• git result stderr= stdout=<git repo here>
• snapshotting
• checking ./dist
• --rm-dist is set, cleaning it up
• writing effective config file
• writing config=dist/config.yaml
• generating changelog
• pipe skipped error=not available for snapshots
• building binaries
• building build={my-login-metrics [linux] [amd64] [6] [] [linux_amd64] [] . . [-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.builtBy=goreleaser] [] my-login-metrics {[] []} [] go [] [] false go}
• building binary=/Users/jwhitcraft/Projects/go-my-login-metrics/dist/my-login-metrics_linux_amd64/my-login-metrics
• running cmd=[go build -ldflags=-s -w -X main.version=v0.0.6-SNAPSHOT-2b0cc04 -X main.commit=2b0cc04be39f232b52a4d8240a7a95d20d26d968 -X main.date=2020-12-30T00:29:18Z -X main.builtBy=goreleaser -o /Users/jwhitcraft/Projects/go-my-login-metrics/dist/my-login-metrics_linux_amd64/my-login-metrics .] env=[TERM_SESSION_ID=w0t1p0:A3AA3127-A8CF-45F0-AE50-FCC9FA9A5C79 LANG=en_US.UTF-8 TERM=xterm-256color LaunchInstanceID=EB8EF4A8-1FAF-4101-967E-75B772DA9D04 LESS=-R RBENV_SHELL=zsh SSH_AUTH_SOCK=/private/tmp/com.apple.launchd.6854s3DRM1/Listeners P9K_SSH=0 NVM_DIR=/Users/jwhitcraft/.nvm ITERM_PROFILE=Default __CFBundleIdentifier=com.googlecode.iterm2 LSCOLORS=Gxfxcxdxbxegedabagacad GITHUB_TOKEN=99dc1f512542a991e218d42d4da7f5bdcb1da154 PWD=/Users/jwhitcraft/Projects/go-my-login-metrics SHELL=/usr/local/bin/zsh OLDPWD=/Users/jwhitcraft COLORFGBG=15;0 TERM_PROGRAM_VERSION=3.4.3beta1 TMPDIR=/var/folders/7_/czhqzt9n62j1vw_1nbr_h39c0000gn/T/ XPC_SERVICE_NAME=0 ASDF_DIR=/usr/local/opt/asdf GOPATH=/Users/jwhitcraft/GoProjects OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES P9K_TTY=old LC_TERMINAL_VERSION=3.4.3beta1 SECURITYSESSIONID=18850 COLORTERM=truecolor __CF_USER_TEXT_ENCODING=0x1F5:0x0:0x0 LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:.tar=01;31:.tgz=01;31:.arc=01;31:.arj=01;31:.taz=01;31:.lha=01;31:.lz4=01;31:.lzh=01;31:.lzma=01;31:.tlz=01;31:.txz=01;31:.tzo=01;31:.t7z=01;31:.zip=01;31:.z=01;31:.dz=01;31:.gz=01;31:.lrz=01;31:.lz=01;31:.lzo=01;31:.xz=01;31:.zst=01;31:.tzst=01;31:.bz2=01;31:.bz=01;31:.tbz=01;31:.tbz2=01;31:.tz=01;31:.deb=01;31:.rpm=01;31:.jar=01;31:.war=01;31:.ear=01;31:.sar=01;31:.rar=01;31:.alz=01;31:.ace=01;31:.zoo=01;31:.cpio=01;31:.7z=01;31:.rz=01;31:.cab=01;31:.wim=01;31:.swm=01;31:.dwm=01;31:.esd=01;31:.jpg=01;35:.jpeg=01;35:.mjpg=01;35:.mjpeg=01;35:.gif=01;35:.bmp=01;35:.pbm=01;35:.pgm=01;35:.ppm=01;35:.tga=01;35:.xbm=01;35:.xpm=01;35:.tif=01;35:.tiff=01;35:.png=01;35:.svg=01;35:.svgz=01;35:.mng=01;35:.pcx=01;35:.mov=01;35:.mpg=01;35:.mpeg=01;35:.m2v=01;35:.mkv=01;35:.webm=01;35:.webp=01;35:.ogm=01;35:.mp4=01;35:.m4v=01;35:.mp4v=01;35:.vob=01;35:.qt=01;35:.nuv=01;35:.wmv=01;35:.asf=01;35:.rm=01;35:.rmvb=01;35:.flc=01;35:.avi=01;35:.fli=01;35:.flv=01;35:.gl=01;35:.dl=01;35:.xcf=01;35:.xwd=01;35:.yuv=01;35:.cgm=01;35:.emf=01;35:.ogv=01;35:.ogx=01;35:.aac=00;36:.au=00;36:.flac=00;36:.m4a=00;36:.mid=00;36:.midi=00;36:.mka=00;36:.mp3=00;36:.mpc=00;36:.ogg=00;36:.ra=00;36:.wav=00;36:.oga=00;36:.opus=00;36:.spx=00;36:.xspf=00;36: MANPAGER=sh -c 'col -bx | bat -l man -p' _=/usr/local/bin/goreleaser TERM_PROGRAM=iTerm.app LC_TERMINAL=iTerm2 ITERM_SESSION_ID=w0t1p0:A3AA3127-A8CF-45F0-AE50-FCC9FA9A5C79 XDG_CONFIG_DIRS=/Users/jwhitcraft/.config SHLVL=1 ZSH=/Users/jwhitcraft/.oh-my-zsh XPC_FLAGS=0x0 PATH=/Users/jwhitcraft/.krew/bin:/Users/jwhitcraft/Library/Python/3.7/bin:/Users/jwhitcraft/GoProjects/bin:/usr/local/sbin:/usr/local/opt/coreutils/libexec/gnubin:/Users/jwhitcraft/bin:/usr/local/bin:/Users/jwhitcraft/.yarn/bin:/Users/jwhitcraft/.rbenv/shims:/Users/jwhitcraft/.asdf/shims:/usr/local/opt/asdf/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/usr/local/opt/fzf/bin COMMAND_MODE=unix2003 HOME=/Users/jwhitcraft USER=jwhitcraft LOGNAME=jwhitcraft PAGER=less _P9K_TTY=/dev/ttys001 GOOS=linux GOARCH=amd64 GOARM= GOMIPS= GOMIPS64=]
• added new artifact name=my-login-metrics path=/Users/jwhitcraft/Projects/go-my-login-metrics/dist/my-login-metrics_linux_amd64/my-login-metrics type=Binary
• archives
• group linuxamd64 has 1 binaries
• creating archive=dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_amd64.tar.gz
• adding file: /Users/jwhitcraft/Projects/go-my-login-metrics/dist/my-login-metrics_linux_amd64/my-login-metrics as my-login-metrics
• added new artifact name=my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_amd64.tar.gz path=dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_amd64.tar.gz type=Archive
• creating source archive
• pipe skipped error=source pipe is disabled
• linux packages
• adding binary to package arch=amd64 dst=/usr/local/bin/my-login-metrics package=my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.deb src=/Users/jwhitcraft/Projects/go-my-login-metrics/dist/my-login-metrics_linux_amd64/my-login-metrics
• all archive files files=[0xc000108050]
• adding binary to package arch=amd64 dst=/usr/local/bin/my-login-metrics package=my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.rpm src=/Users/jwhitcraft/Projects/go-my-login-metrics/dist/my-login-metrics_linux_amd64/my-login-metrics
• all archive files files=[0xc0002fa000]
• creating file=dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.deb
• creating file=dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.rpm
• added new artifact name=my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.deb path=dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.deb type=Linux Package
• added new artifact name=my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.rpm path=dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.rpm type=Linux Package
• snapcraft packages
• calculating checksums
• checksumming file=my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.rpm
• checksumming file=my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.deb
• calculating checksum for dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.deb
• calculating checksum for dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.rpm
• checksumming file=my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_amd64.tar.gz
• calculating checksum for dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_amd64.tar.gz
• added new artifact name=my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_checksums.txt path=dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_checksums.txt type=Checksum
• signing artifacts
• docker images
• pipe skipped error=docker section is not configured
• publishing
• blobs
• upload skipped because skip-publish is set path=my-login-metrics/v0.0.6/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_checksums.txt
• upload skipped because skip-publish is set path=my-login-metrics/v0.0.6/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.rpm
• upload skipped because skip-publish is set path=my-login-metrics/v0.0.6/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_amd64.tar.gz
• upload skipped because skip-publish is set path=my-login-metrics/v0.0.6/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.deb
• http upload
• pipe skipped error=uploads section is not configured
• custom publisher
• pipe skipped error=publishers section is not configured
• artifactory
• pipe skipped error=artifactory section is not configured
• docker images
• pipe skipped error=publishing is disabled
• docker manifests
• pipe skipped error=publishing is disabled
• snapcraft packages
• pipe skipped error=publishing is disabled
• github/gitlab/gitea releases
• pipe skipped error=publishing is disabled
• homebrew tap formula
• token type type=github
• scoop manifests
• pipe skipped error=publishing is disabled
• milestones
• pipe skipped error=publishing is disabled
• release succeeded after 5.76s
Just a quick update on this, I downloaded 0.149.0 and tried the same config file (with converting the contents into config_file) and the deb package ended up with the extra file in it:
dpkg -c dist/my-login-metrics_v0.0.6-SNAPSHOT-2b0cc04_linux_x64.deb
drwxr-xr-x 0/0 0 2020-12-29 21:12 ./usr/
drwxr-xr-x 0/0 0 2020-12-29 21:12 ./usr/local/
drwxr-xr-x 0/0 0 2020-12-29 21:12 ./usr/local/bin/
-rwxr-xr-x 0/0 11931648 2020-12-29 21:12 ./usr/local/bin/my-login-metrics
drwxr-xr-x 0/0 0 2020-12-29 21:12 ./etc/
drwxr-xr-x 0/0 0 2020-12-29 21:12 ./etc/systemd/
drwxr-xr-x 0/0 0 2020-12-29 21:12 ./etc/systemd/system/
-rw-r--r-- 0/0 238 2020-12-29 21:12 ./etc/systemd/system/my-login-metrics.service
It is also not working with 0.150.0 with the old notation:
files:
"packaging/rpm/scripts/*": "/etc/package/scripts/"
config_files:
"packaging/rpm/config/*": "/etc/package/config/"
With 0.149.0:
rpm -qlp dist/package-0.0.2-1.x86_64.rpm
/etc/package/config/config.yaml
/etc/package/scripts/dummy.sh
/usr/bin/package
Change the goreleaser binary to 0.150.0:
rpm -qlp dist/package-0.0.2-1.x86_64.rpm
/usr/bin/package
Thanks for reporting, found the issue! Added a test for it as well.
Will release a patch soon :)
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Thanks for reporting, found the issue! Added a test for it as well.
Will release a patch soon :)