aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2020-02-21 12:46:55 +0100
committerLoïc Hoguin <[email protected]>2020-02-21 12:46:55 +0100
commitb70babdf6e9c7f50cf7b9351abd01c556d20a665 (patch)
tree8d1fd7f1befc1f090667a9fe7701f82639f9d290
parent164cc2f672ed3d3adb95db0fe062a78b5713c4fe (diff)
downloadci-b70babdf6e9c7f50cf7b9351abd01c556d20a665.tar.gz
ci-b70babdf6e9c7f50cf7b9351abd01c556d20a665.tar.bz2
ci-b70babdf6e9c7f50cf7b9351abd01c556d20a665.zip
Add a post-checkout hook to fetch branches/tags
-rw-r--r--ci.d/buildkite8
-rw-r--r--priv/buildkite-post-checkout-hook7
2 files changed, 14 insertions, 1 deletions
diff --git a/ci.d/buildkite b/ci.d/buildkite
index 670fa0c..bade986 100644
--- a/ci.d/buildkite
+++ b/ci.d/buildkite
@@ -9,11 +9,17 @@ _buildkite_config() {
# Update the configuration.
lxc_do bash -c "echo name=\"$1-%n\" >> $BUILDKITE_PATH/buildkite-agent.cfg"
lxc_do bash -c "echo tags=\"os=$1\" >> $BUILDKITE_PATH/buildkite-agent.cfg"
- # Install hooks.
+ # Generate buildkite-env file.
lxc_do bash -c " \
echo \"export BUILDKITE_API_TOKEN=$BUILDKITE_API_TOKEN\" >> /etc/buildkite-env"
lxc_do bash -c " \
echo \"export BUILDKITE_LOGS_SERVER=$BUILDKITE_LOGS_SERVER\" >> /etc/buildkite-env"
+ # Install post-checkout hook.
+ <$( cd "$( dirname "$0" )" && pwd )/priv/buildkite-post-checkout-hook \
+ lxc_do bash -c "cat > $BUILDKITE_PATH/hooks/post-checkout"
+ lxc_do chmod +x $BUILDKITE_PATH/hooks/post-checkout
+ lxc_do chown buildkite-agent:buildkite-agent $BUILDKITE_PATH/hooks/post-checkout
+ # Install pre-artifact hook.
<$( cd "$( dirname "$0" )" && pwd )/priv/buildkite-pre-artifact-hook \
lxc_do bash -c "cat > $BUILDKITE_PATH/hooks/pre-artifact"
lxc_do chmod +x $BUILDKITE_PATH/hooks/pre-artifact
diff --git a/priv/buildkite-post-checkout-hook b/priv/buildkite-post-checkout-hook
new file mode 100644
index 0000000..6e9646b
--- /dev/null
+++ b/priv/buildkite-post-checkout-hook
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+set -e
+
+# Ensure we are getting the branches and tags should some
+# tests rely on them. For example release upgrade test suites.
+git fetch -v origin +refs/heads/\*:refs/remotes/origin/\* +refs/tags/\*:refs/tags/\*