0

I am an absolute novice in Golang but I want to modify a Go build script to build a file locally only instead of publishing it to GitHub.

https://github.com/dahendel/docker-machine-driver-cloudstack/blob/master/.goreleaser.yml

How to proceed?

I've created a fork with a Dockerfile to capture the release environment I can so far "reverse-engineer" but as I run it I get the following error and don't know how what and how to modify in the .goreleaser.yml.

   • releasing using goreleaser 0.117.1...
   • loading config file       file=.goreleaser.yml
   • RUNNING BEFORE HOOKS     
   • LOADING ENVIRONMENT VARIABLES
      • pipe skipped              error=publishing is disabled
   • GETTING AND VALIDATING GIT STATE
      • releasing v1.0.5, commit d47a87ff8c671ec70b99a125fd6aadc45949905d
      • pipe skipped              error=disabled during snapshot mode
   • PARSING TAG              
   • SETTING DEFAULTS         
      • LOADING ENVIRONMENT VARIABLES
      • SNAPSHOTING              
      • GITHUB/GITLAB/GITEA RELEASES
      • PROJECT NAME             
      • BUILDING BINARIES        
      • ARCHIVES                 
            • DEPRECATED: `archive` should not be used anymore, check https://goreleaser.com/deprecations#archive for more info.
      • LINUX PACKAGES WITH NFPM 
            • DEPRECATED: `nfpm` should not be used anymore, check https://goreleaser.com/deprecations#nfpm for more info.
      • SNAPCRAFT PACKAGES       
      • CALCULATING CHECKSUMS    
      • SIGNING ARTIFACTS        
      • DOCKER IMAGES            
      • ARTIFACTORY              
      • S3                       
      • BLOB                     
      • HOMEBREW TAP FORMULA     
         • optimistically guessing `brew[0].installs`, double check
      • SCOOP MANIFEST           
   • SNAPSHOTING              
   • CHECKING ./DIST          
   • WRITING EFFECTIVE CONFIG FILE
      • writing                   config=dist/config.yaml
   • GENERATING CHANGELOG     
      • pipe skipped              error=not available for snapshots
   • BUILDING BINARIES        
      • running hook              hook=dep ensure
   ⨯ release failed after 0.01s error=pre hook failed: 
Pierre.Vriens
  • 7,205
  • 14
  • 37
  • 84
Ta Mu
  • 6,772
  • 5
  • 39
  • 82

1 Answers1

1

I have cloned your repo and try that in my local machine. Here is the steps :

  1. Git clone

  2. executing Dry run (testing everything before doing a release "for real" :

    $ goreleaser release --skip-publish

  3. show there is no error

     SIGNING ARTIFACTS
      • pipe skipped              error=artifact signing is disabled
    • DOCKER IMAGES
      • pipe skipped              error=docker section is not configured
    • PUBLISHING
      • pipe skipped              error=publishing is disabled
    • release succeeded after 20.75s
    
    
  4. execute goreleaser for release

    $ goreleaser release

  5. goreleaser will created dist folder inside project and this folder will consist of distribution packages (deb, rpm).

I have encounter some issues and here is what I do :

  • error=missing GITHUB_TOKEN, GITLAB_TOKEN and GITEA_TOKEN

create github or gitlab token ( https://github.com/settings/tokens) and put it as environment variabel

export GITHUB_TOKEN=xxxxyyyyyzzzzz

resolve the issue.

  • pre hook failed: xxxx is not within a known GOPATH/src

as I see in your goreleaser.yaml

hooks:
pre: dep ensure

you're using dep ensure, checking $GOPATH and make sure $GOPATH pointing to right path of your Go project.

  • error=dist is not empty, remove it before running goreleaser or use the --rm-dist flag

dist folder has been created before, you can either manually delete the folder or add flags --rm-dist when executing goreleaser command

$ goreleaser release --skip-publish --rm-dist
  • error=nfpm failed: rpmbuild not present in $PATH

this error occured as I was running on mac machine so there is no rpmbuild installed, installing rpm, rpmbuild solve the issue

$brew install rpm
  • error=git is currently in a dirty state, please check in your pipeline what can be changing the following files: M Gopkg.lock

Goreleaser seems to check file diff, so as because running hook (dep ensure) updating the Gopkg.lock and this changes/updates are not pushed to git. The solution is always pushing the changes to git.

  • error=git tag v1.0.5 was not made against commit 3ae83eebd904d33cc549117254e857ebea04df90

reading from GoReleaser documentation which is "GoReleaser enforces semantic versioning and will error on non-compliant tags. Your tag should be a valid semantic version. If it is not, GoReleaser will error."

after pushing to git, make sure you have to update the tags, in this case I updates the tags to v1.0.6 (previously v1.0.5).

make sure release text is there.

  • thank you, @Dimas Pawitra, and welcome to DevOps SE! Now I've tried the test run and I think there is a dep problem; how to check that? What is failing: hook =dep ensure – Ta Mu Sep 06 '19 at 14:02