forked from signalfx/signalfx-agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release
executable file
·48 lines (37 loc) · 1.39 KB
/
release
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
version_from_metadata() {
jq -r '.version' $SCRIPT_DIR/metadata.json
}
run_puppet_command() {
docker run \
--rm \
-v $SCRIPT_DIR:/etc/puppetlabs/code/modules/signalfx_agent \
signalfx-agent-puppet-dev \
puppet $@
}
current_version_exists() {
curl https://forgeapi.puppetlabs.com:443/v3/modules/signalfx-signalfx_agent | \
jq -r '.releases[].version' | \
grep $(version_from_metadata) > /dev/null || false
}
if current_version_exists; then
echo "Version $(version_from_metadata) already exists in Puppet Forge. Please update the metadata.json with a new version" >&2
exit 1
fi
tag=puppet-v$(version_from_metadata)
if ! git rev-parse $tag; then
git tag -a $tag
git push origin $tag
fi
make -C $SCRIPT_DIR dev-image
run_puppet_command module build /etc/puppetlabs/code/modules/signalfx_agent
expected_output=$SCRIPT_DIR/pkg/signalfx-signalfx_agent-$(version_from_metadata).tar.gz
if ! test -e $expected_output; then
echo "Module could not be built, expected output at $expected_output" >&2
exit 1
fi
echo "Module was successfully build and is available in ./pkg/$(basename $expected_output)"
echo
echo "You must manually upload this file in the Puppet forge web UI by following the directions at https://puppet.com/docs/puppet/5.4/modules_publishing.html#upload-a-module-to-the-forge"