-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #196 from ripienaar/dependencies
(misc) update dependencies
- Loading branch information
Showing
3 changed files
with
291 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
name: build_tasks | ||
description: Choria Build Tasks | ||
|
||
commands: | ||
- name: dependencies | ||
type: parent | ||
description: Manage dependencies | ||
aliases: [d] | ||
commands: | ||
- name: update | ||
description: Update dependencies | ||
type: exec | ||
aliases: [up] | ||
flags: | ||
- name: verbose | ||
description: Log verbosely | ||
bool: true | ||
- name: proxy | ||
description: Enable using go proxy | ||
bool: true | ||
default: "true" | ||
banner: | | ||
>>> | ||
>>> Updating all dependencies | ||
>>> | ||
script: | | ||
{{ if eq .Flags.proxy false }} | ||
export GOPROXY=direct | ||
echo ">>>" | ||
echo ">>> Disabling go mod proxy" | ||
echo ">>>" | ||
echo | ||
{{ end }} | ||
|
||
go get -u -n -a -t {{- if .Flags.verbose }} -d -x {{ end }} ./... | ||
|
||
echo ">>> Running go mod tidy" | ||
go mod tidy | ||
|
||
- name: test | ||
type: parent | ||
aliases: [t] | ||
description: Perform various tests | ||
commands: | ||
- name: unit | ||
type: exec | ||
description: Run ginkgo unit tests | ||
aliases: [u] | ||
arguments: | ||
- name: dir | ||
description: Directory to test | ||
default: . | ||
flags: | ||
- name: update | ||
description: Updates the ginkgo runtime | ||
bool: true | ||
script: | | ||
set -e | ||
|
||
{{ if .Flags.update }} | ||
echo ">>> Updating ginkgo binary" | ||
go install github.com/onsi/ginkgo/v2/ginkgo | ||
{{ end }} | ||
|
||
ginkgo -r --skip Integration {{ .Arguments.dir | escape }} | ||
|
||
- name: docs | ||
type: parent | ||
description: Documentation related commands | ||
commands: | ||
- name: serve | ||
description: Serves documentation locally | ||
type: exec | ||
flags: | ||
- name: port | ||
description: The port to listen on | ||
default: "8081" | ||
command: hugo serve -p {{ .Flags.port }} -s docs | ||
|
||
- name: build | ||
type: parent | ||
aliases: [b] | ||
description: Code build steps | ||
commands: | ||
- name: binary | ||
description: Build a basic test binary | ||
type: exec | ||
aliases: [bin] | ||
banner: | | ||
>>> | ||
>>> Building 'go-choria' locally | ||
>>> | ||
>>> Target: {{ if .Flags.target }}{{ .Flags.target }}{{else}}host{{end}} | ||
>>> | ||
flags: | ||
- name: target | ||
description: Target platform to build for | ||
enum: ["linux/amd64"] | ||
short: T | ||
- name: verbose | ||
description: Logs packages being build | ||
bool: true | ||
short: v | ||
script: | | ||
set -e | ||
|
||
{{ if eq .Flags.target "linux/amd64" }} | ||
export GOOS=linux | ||
export GOARCH=amd64 | ||
{{ end }} | ||
|
||
{{ if .Flags.verbose }} | ||
echo ">>> Packages being build" | ||
{{ end }} | ||
|
||
go build \ | ||
{{ if .Flags.verbose }}-v{{ end }} \ | ||
-ldflags="-s -w \ | ||
-X 'github.com/choria-io/provisioner/config.version=0.0.$(date +%s)' \ | ||
" -o provisioner | ||
|
||
echo | ||
ls -l provisioner | ||
echo | ||
file provisioner | ||
echo | ||
|
||
- name: nightly-docker | ||
description: Builds nightly docker container | ||
type: exec | ||
aliases: [nd] | ||
flags: | ||
- name: repo | ||
description: YUM Repository to use | ||
default: https://yum.eu.choria.io/nightly/el/nightly.repo | ||
- name: push | ||
description: Push the built images | ||
default: false | ||
bool: true | ||
banner: | | ||
>>> | ||
>>> Building nightly docker container using {{ .Flags.repo }} | ||
>>> | ||
script: | | ||
set -e | ||
|
||
docker pull almalinux:8 | ||
|
||
DATE=$(date +%Y%m%d) | ||
|
||
docker build \ | ||
--no-cache \ | ||
--build-arg REPO={{ .Flags.repo | escape }} \ | ||
--tag "choria/provisioner:nightly-${DATE}" \ | ||
--tag "choria/provisioner:nightly" \ | ||
--tag "registry.choria.io/choria-nightly/provisioner:nightly-${DATE}" \ | ||
--tag "registry.choria.io/choria-nightly/provisioner:nightly" \ | ||
. | ||
|
||
{{ if .Flags.push }} | ||
echo | ||
echo ">>> Pushing built containers" | ||
echo | ||
docker push "choria/provisioner:nightly" | ||
docker push "choria/provisioner:nightly-${DATE}" | ||
docker push "registry.choria.io/choria-nightly/provisioner:nightly-${DATE}" | ||
docker push "registry.choria.io/choria-nightly/provisioner:nightly" | ||
{{ else }} | ||
echo | ||
echo ">>> Skipping container push" | ||
echo | ||
{{ end }} | ||
|
||
- name: release-docker | ||
description: Builds release docker container | ||
type: exec | ||
aliases: [rd] | ||
flags: | ||
- name: repo | ||
description: YUM Repository to use | ||
default: https://yum.eu.choria.io/release/el/release.repo | ||
- name: push | ||
description: Push the built images | ||
default: false | ||
bool: true | ||
banner: | | ||
>>> | ||
>>> Building release docker container using {{ .Flags.repo }} | ||
>>> | ||
script: | | ||
set -e | ||
|
||
TAG=$(git tag --points-at HEAD|sed -e s/^v//) | ||
if [ -z "${TAG}" ] | ||
then | ||
echo "!!! HEAD is not a tag" | ||
exit 1 | ||
fi | ||
|
||
docker pull almalinux:8 | ||
|
||
docker build \ | ||
--no-cache \ | ||
--build-arg REPO={{ .Flags.repo | escape }} \ | ||
--tag "choria/provisioner:${TAG}" \ | ||
--tag "choria/provisioner:latest" \ | ||
--tag "registry.choria.io/choria/provisioner:${TAG}" \ | ||
--tag "registry.choria.io/choria/provisioner:latest" \ | ||
. | ||
|
||
{{ if .Flags.push }} | ||
echo | ||
echo ">>> Pushing built containers" | ||
echo | ||
docker push "choria/provisioner:${TAG}" | ||
docker push "choria/provisioner:latest" | ||
docker push "registry.choria.io/choria/provisioner:${TAG}" | ||
docker push "registry.choria.io/choria/provisioner:latest" | ||
{{ else }} | ||
echo | ||
echo ">>> Skipping container push" | ||
echo | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.