2019-03-14 11:45:49 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2019-03-20 01:18:27 +00:00
|
|
|
# A script for building Linux and Windows nomad release binaries inside Docker
|
|
|
|
#
|
|
|
|
# This is a helper script file that is expected to be invoked
|
|
|
|
# within a docker container with an image created with the Dockerfile present on this directory.
|
|
|
|
#
|
|
|
|
# A sample way of invoking the script is
|
|
|
|
# ```
|
|
|
|
# docker run --rm \
|
|
|
|
# -v $(pwd)/.git:/tmp/nomad-git:ro \
|
|
|
|
# -v /tmp/generated-repo:/tmp/artifacts:rw \
|
|
|
|
# -e "PRERELEASE_TARGET=${PRERELEASE_TARGET}" \
|
|
|
|
# -e "RELEASE_TARGET=${RELEASE_TARGET}" \
|
|
|
|
# -e "NOMAD_VERSION=${NOMAD_VERSION}" \
|
|
|
|
# nomad-builder:latest \
|
|
|
|
# /tmp/scripts/docker-build-all
|
|
|
|
# ```
|
|
|
|
# Namely the script takes the following arguments:
|
|
|
|
# * `/tmp/nomad-git` path being a read-only .git directory with HEAD being the sha to be released
|
|
|
|
# * `NOMAD_VERSION` env-var being the release version to be cut (e.g. `0.9.1-rc1`)
|
|
|
|
# * `PRERELEASE_TARGET` env-var being the prerelease make target, typically `prerelease`. Use `help` to skip `prerelease` step
|
|
|
|
# * `RELEASE_TARGET` env-var being the release make target, typically `release`.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# The script would then run prerelease steps, commits any generated files, and build all binary files
|
|
|
|
# and stores them to `/tmp/artifacts/repo`.
|
|
|
|
|
2019-03-18 18:34:09 +00:00
|
|
|
set -o errexit
|
|
|
|
set -o xtrace
|
2019-03-14 11:45:49 +00:00
|
|
|
|
|
|
|
cp -r /tmp/nomad-git /opt/gopath/src/github.com/hashicorp/nomad/.git
|
|
|
|
|
|
|
|
cd /opt/gopath/src/github.com/hashicorp/nomad
|
2019-03-20 01:18:27 +00:00
|
|
|
|
|
|
|
# checkout directory from .git and ensures a prestine state
|
2019-03-14 11:45:49 +00:00
|
|
|
git checkout .
|
|
|
|
|
|
|
|
make -f ./scripts/release/Makefile.linux \
|
|
|
|
"NOMAD_VERSION=${NOMAD_VERSION}" \
|
|
|
|
"PRERELEASE_TARGET=${PRERELEASE_TARGET}" \
|
|
|
|
"RELEASE_TARGET=${RELEASE_TARGET}" \
|
|
|
|
update_version build_releases
|
|
|
|
|
|
|
|
cp -r /opt/gopath/src/github.com/hashicorp/nomad \
|
|
|
|
/tmp/artifacts/repo
|