Skip to content

Commit c2e1cea

Browse files
committed
CI: collapse publisher into builder pipeline
- rename `<short-name>-builder` => `<short-name>` - simplify ci configure script - relocate pipeline template and vars files to `ci/`
1 parent c12f37d commit c2e1cea

6 files changed

Lines changed: 761 additions & 865 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ Create a `stemcell-builder-integration-${subnet_int}` subnetworks need by BATs t
349349
Each stemcell line should get its own subnet corresponding to its `subnet_int` equal to
350350
the two digit release year. For example release year 2010 would have `subnet_int="10"`.
351351

352-
Example per [ci/pipelines/vars.yml](ci/pipelines/vars.yml):
352+
Example per [ci/pipeline-vars.yml](ci/pipeline-vars.yml):
353353

354354
```yaml
355355
---

ci/configure.sh

Lines changed: 16 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,35 @@
11
#!/usr/bin/env bash
22
set -eu -o pipefail
33

4-
STEMCELL_LINE="ubuntu-jammy"
5-
6-
REPO_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
7-
84
if [[ -n "${DEBUG:-}" ]]; then
95
set -x
106
fi
117

12-
fly="${FLY_CLI:-fly}"
8+
REPO_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
9+
10+
STEMCELL_LINE="ubuntu-jammy"
11+
12+
pipelines_dir="${REPO_ROOT}/ci"
13+
pipeline_name="${STEMCELL_LINE}"
14+
pipeline_template="pipeline-template.yml"
15+
pipeline_vars="pipeline-vars.yml"
16+
1317
concourse_target="${CONCOURSE_TARGET:-stemcell}"
18+
fly="${FLY_CLI:-fly}"
1419

1520
until "${fly}" -t "${concourse_target}" status; do
1621
"${fly}" -t "${concourse_target}" login
1722
sleep 1
1823
done
1924

20-
pipelines_dir="${REPO_ROOT}/ci/pipelines"
21-
vars_file_name="vars.yml"
22-
23-
mapfile -t available_pipelines < \
24-
<( find "${pipelines_dir}" -maxdepth 1 -type f -name '*.yml' | grep -v "${vars_file_name}" | sort )
25-
26-
if (( ${#available_pipelines[@]} == 0 )); then
27-
echo "No pipelines found under '${pipelines_dir}'" >&2
28-
exit 1
29-
fi
30-
31-
i=1
32-
echo "Choose a pipeline to configure:"
33-
for pipeline in "${available_pipelines[@]}"; do
34-
pipeline_choice_label=$(echo "${pipeline#"${pipelines_dir}/"}" | cut -d/ -f 1)
35-
printf "%4s. %s\n" "${i}" "${pipeline_choice_label}"
36-
i=$((i + 1))
37-
done
38-
read -rp "pipeline: " pipeline_index
25+
echo "Rendering..."
26+
rendered_template="$(ytt -f "${pipelines_dir}/${pipeline_template}" -f "${pipelines_dir}/${pipeline_vars}")"
3927
echo ""
4028

41-
if ! [[ "${pipeline_index}" =~ ^[0-9]+$ ]] || (( pipeline_index < 1 || pipeline_index > ${#available_pipelines[@]} )); then
42-
echo "Invalid selection: '${pipeline_index}'" >&2
43-
exit 1
44-
fi
45-
46-
pipeline_file=${available_pipelines[(pipeline_index-1)]}
47-
if [ ! -f "${pipeline_file}" ]; then
48-
echo "No pipeline found: '${pipeline_file}'" >&2
49-
exit 1
50-
fi
51-
52-
pipeline_name=$(basename "${pipeline_file%".yml"}")
53-
54-
echo "Configuring '${pipeline_name}' using '${pipeline_file#"${pipelines_dir}/"}'..."
29+
echo "Validating..."
30+
fly validate-pipeline --strict --config <(echo "${rendered_template}")
5531
echo ""
5632

57-
rendered_template="$(ytt -f "${pipeline_file}" -f "${pipelines_dir}/${vars_file_name}")"
58-
59-
"${fly}" -t "${concourse_target}" set-pipeline \
60-
-p "${STEMCELL_LINE}-${pipeline_name}" \
33+
echo "Configuring..."
34+
"${fly}" -t "${concourse_target}" set-pipeline -p "${pipeline_name}" \
6135
-c <(echo "${rendered_template}")

0 commit comments

Comments
 (0)