Skip to content

Commit 7b0bf8b

Browse files
authored
Merge pull request #13185 from chrisroberts/build-workflows
build workflows
2 parents 2092df5 + f9c3736 commit 7b0bf8b

File tree

6 files changed

+107
-2
lines changed

6 files changed

+107
-2
lines changed

.ci/dev-build

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
csource="${BASH_SOURCE[0]}"
4+
while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done
5+
root="$( cd -P "$( dirname "$csource" )/../" && pwd )"
6+
7+
. "${root}/.ci/load-ci.sh"
8+
9+
if [ "${#}" -ne 2 ]; then
10+
printf "Usage: %s BRANCH COMMIT_ID\n" "${0}" >&2
11+
exit 1
12+
fi
13+
14+
branch="${1}"
15+
full_sha="${2}"
16+
17+
if [ -z "${branch}" ]; then
18+
failure "Branch variable is unset, required for dev build"
19+
fi
20+
if [ -z "${full_sha}" ]; then
21+
failure "The full_sha variable is unexpectedly missing, cannot trigger dev build"
22+
fi
23+
24+
# Trim the reference prefix if needed
25+
if [[ "${branch}" = *"refs/heads"* ]]; then
26+
debug "trimming branch reference value - %s" "${branch}"
27+
branch="${branch##*refs/heads/}"
28+
debug "trimmed branch value - %s" "${branch}"
29+
fi
30+
31+
info "Triggering development build %s (%s)" "${tag}" "${full_sha}"
32+
github_repository_dispatch "vagrant-builders" "build" "commit_id=${full_sha}" "branch=${branch}"

.ci/nightly-build

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
csource="${BASH_SOURCE[0]}"
4+
while [ -h "$csource" ] ; do csource="$(readlink "$csource")"; done
5+
root="$( cd -P "$( dirname "$csource" )/../" && pwd )"
6+
7+
. "${root}/.ci/load-ci.sh"
8+
9+
if [ "${#}" -ne 1 ]; then
10+
printf "Usage: %s COMMIT_ID\n" "${0}" >&2
11+
exit 1
12+
fi
13+
14+
full_sha="${1}"
15+
16+
if [ -z "${full_sha}" ]; then
17+
failure "The full_sha variable is unexpectedly missing, cannot trigger nightly build"
18+
fi
19+
20+
info "Triggering nightly build %s (%s)" "${tag}" "${full_sha}"
21+
github_repository_dispatch "vagrant-builders" "nightlies" "commit_id=${full_sha}"

.ci/release

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,27 @@ root="$( cd -P "$( dirname "$csource" )/../" && pwd )"
66

77
. "${root}/.ci/load-ci.sh"
88

9+
if [ "${#}" -ne 2 ]; then
10+
printf "Usage: %s TAG COMMIT_ID\n" "${0}" >&2
11+
exit 1
12+
fi
13+
14+
tag="${1}"
15+
full_sha="${2}"
16+
917
if [ -z "${tag}" ]; then
10-
failure "Tag variable is unset (will be automatically set on tag push)"
18+
failure "Tag variable is unset, required for release"
1119
fi
1220
if [ -z "${full_sha}" ]; then
1321
failure "The full_sha variable is unexpectedly missing, cannot trigger release"
1422
fi
1523

24+
# Trim the prefix of the tag if it hasn't been
25+
if [[ "${tag}" = *"refs/tags"* ]]; then
26+
debug "trimming tag reference value - %s" "${tag}"
27+
tag="${tag##*refs/tags/}"
28+
debug "trimmed tag value - %s" "${tag}"
29+
fi
30+
1631
info "Triggering release %s (%s)" "${tag}" "${full_sha}"
1732
github_repository_dispatch "vagrant-builders" "hashicorp-release" "commit_id=${full_sha}" "tag=${tag}"

.github/workflows/dev-build.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
on:
2+
push:
3+
branches: 'build-*'
4+
5+
jobs:
6+
trigger-build:
7+
if: github.repository == 'hashicorp/vagrant'
8+
name: Trigger Development Build
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Code Checkout
12+
uses: actions/checkout@v3
13+
- name: Trigger Development Build
14+
run: ./.ci/dev-build "${BRANCH}" "${COMMIT_ID}"
15+
env:
16+
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
17+
BRANCH: ${{ github.ref_name }}
18+
COMMIT_ID: ${{ github.sha }}

.github/workflows/nightlies.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
on:
2+
schedule:
3+
- cron: 30 22 * * *
4+
5+
jobs:
6+
trigger-nightly:
7+
if: github.repository == 'hashicorp/vagrant'
8+
name: Trigger Nightly Build
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Code Checkout
12+
uses: actions/checkout@v3
13+
- name: Trigger Nightly Build
14+
run: ./.ci/nightly-build "${COMMIT_ID}"
15+
env:
16+
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
17+
COMMIT_ID: ${{ github.sha }}

.github/workflows/release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ jobs:
1111
- name: Code Checkout
1212
uses: actions/checkout@v3
1313
- name: Trigger Build
14-
run: ./.ci/release
14+
run: ./.ci/release "${TAG}" "${COMMIT_ID}"
1515
env:
1616
HASHIBOT_TOKEN: ${{ secrets.HASHIBOT_TOKEN }}
17+
TAG: ${{ github.ref }}
18+
COMMIT_ID: ${{ github.sha }}

0 commit comments

Comments
 (0)