Skip to content

Commit

Permalink
Update pipeline + goreleaser to create draft release
Browse files Browse the repository at this point in the history
  • Loading branch information
doodlesbykumbi committed Mar 16, 2021
1 parent 8b2b349 commit 5cab1e4
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 13 deletions.
16 changes: 13 additions & 3 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ checksum:
brews:
- description: Conjur provider for Summon
homepage: https://github.com/cyberark/summon-conjur
url_template: https://github.com/cyberark/summon-conjur/releases/download/v{{.Version}}/summon-conjur-darwin-amd64.tar.gz
url_template: https://github.com/cyberark/summon-conjur/releases/download/{{.Version}}/summon-conjur-darwin-amd64.tar.gz
install: |
target = lib/"summon"
target.install "summon-conjur"
Expand All @@ -61,6 +61,16 @@ nfpms:
- rpm
bindir: /usr/local/lib/summon # where the binary is placed, default summon provider dir

dist: ./dist/goreleaser

release:
disable: true
prerelease: auto
disable: false
draft: true
extra_files:
- glob: NOTICES.txt
- glob: LICENSE
- glob: CHANGELOG.md
- glob: dist/goreleaser/summon-conjur-linux-amd64
- glob: dist/goreleaser/summon-conjur-darwin-amd64
- glob: dist/goreleaser/summon-conjur-windows-amd64
- glob: dist/goreleaser/summon-conjur-solaris-amd64
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ should be officially marked as a `pre-release` (eg "non-production ready")
- summon-conjur-darwin-amd64.tar.gz
- summon-conjur-linux-amd64.tar.gz
- summon-conjur-windows-amd64.zip
- summon-conjur-solaris-amd64.tar.gz
- summon-conjur.deb
- summon-conjur.rpm
- summon-conjur-solaris-amd64.tar.gz
- SHA256SUMS.txt

1. Copy the `summon-conjur.rb` homebrew formula output by goreleaser
Expand Down
37 changes: 30 additions & 7 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ pipeline {
}
}

stage('Build artifacts') {
steps {
sh './build.sh'
archiveArtifacts artifacts: "dist/*.tar.gz,dist/*.zip,dist/*.rb,dist/*.deb,dist/*.rpm,dist/*.txt", fingerprint: true
}
}

stage('Run unit tests') {
steps {
sh './bin/test.sh'
Expand All @@ -37,6 +30,36 @@ pipeline {
ccCoverage("gocov", "--prefix github.com/cyberark/summon-conjur")
}
}

stage('Build Release Artifacts') {
when {
not {
tag "v*"
}
}

steps {
sh './build.sh --snapshot'
archiveArtifacts 'dist/goreleaser/'
}
}

stage('Build Release Artifacts and Create Pre Release') {
// Only run this stage when triggered by a tag
when { tag "v*" }

steps {
dir('./pristine-checkout') {
// Go releaser requires a pristine checkout
checkout scm

// Create draft release
sh "summon --yaml 'GITHUB_TOKEN: !var github/users/conjur-jenkins/api-token' ./build.sh"
archiveArtifacts 'dist/goreleaser/'
}
}
}

}

post {
Expand Down
9 changes: 7 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
#!/bin/bash -e

CURRENT_DIR=$(pwd)

echo "Current dir: $CURRENT_DIR"

MOUNT_DIR="/summon-conjur"

GORELEASER_IMAGE="goreleaser/goreleaser:latest"
GORELEASER_ARGS="--rm-dist --snapshot"

git fetch --tags # jenkins does not do this automatically yet

docker pull "${GORELEASER_IMAGE}"
docker run --rm -t \
--env GITHUB_TOKEN \
-v "$CURRENT_DIR:$MOUNT_DIR" \
-w "$MOUNT_DIR" \
"${GORELEASER_IMAGE}" ${GORELEASER_ARGS}
"${GORELEASER_IMAGE}" --rm-dist "$@"

echo "Releases built. Archives can be found in dist/goreleaser"

0 comments on commit 5cab1e4

Please sign in to comment.