Skip to content

Commit afd90a5

Browse files
Karl IsenbergStephanie Bodoff
Karl Isenberg
authored and
Stephanie Bodoff
committed
Change CI scripts to use files to return values
- This allows the CI to read the output (name of docker image:tag)
1 parent 485f091 commit afd90a5

7 files changed

+22
-21
lines changed

.gitignore

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,10 @@ npm-debug.log
99
.DS_Store
1010
./**/*.tmp
1111
.tmp
12-
.revision
12+
.revision
13+
14+
# files used by CI
15+
.site-image
16+
.pdf-image
17+
.pdf-bundle-path
18+
.pdf-bundle-url

ci/pdf/0-commit-hook.sh

+6-10
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,16 @@ DCOS_CRT="${DCOS_CRT}" # ex: docs-us.crt
1818

1919
ci/pdf/1-setup-env.sh
2020

21-
# capture output AND print to stdout
22-
exec 5>&1
23-
function close_file_descriptor() {
24-
exec 5>&-
25-
}
26-
trap 'close_file_descriptor' EXIT
27-
28-
DOCKER_IMAGE="$(ci/pdf/2-build-pdf-image.sh | tee >(cat - >&5) | grep "^Image: " | sed "s/^Image: //")"
21+
ci/pdf/2-build-pdf-image.sh
22+
DOCKER_IMAGE="$(cat ".pdf-image")"
2923
export DOCKER_IMAGE # export separately so errexit works :(
3024

31-
PDF_BUNDLE_PATH="$(ci/pdf/3-extract-pdf-bundle.sh | tee >(cat - >&5) | grep "^PDF Bundle Path: " | sed "s/^PDF Bundle Path: //")"
25+
ci/pdf/3-extract-pdf-bundle.sh
26+
PDF_BUNDLE_PATH="$(cat ".pdf-bundle-path")"
3227
export PDF_BUNDLE_PATH # export separately so errexit works :(
3328

34-
PDF_BUNDLE_URL="$(ci/pdf/4-publish-pdf-bundle.sh | tee >(cat - >&5) | grep "^PDF Bundle URL: " | sed "s/^PDF Bundle URL: //")"
29+
ci/pdf/4-publish-pdf-bundle.sh
30+
PDF_BUNDLE_PATH="$(cat ".pdf-bundle-url")"
3531
export PDF_BUNDLE_URL # export separately so errexit works :(
3632

3733
ci/pdf/5-deploy-site-update.sh

ci/pdf/2-build-pdf-image.sh

+1
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ echo "Image Build Success!"
2424

2525
DOCKER_IMAGE="mesosphere/dcos-docs-pdf:latest"
2626
echo "Image: ${DOCKER_IMAGE}"
27+
echo "${IMAGE_NAME}:${IMAGE_TAG}" > ".pdf-image"

ci/pdf/3-extract-pdf-bundle.sh

+1
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ mv "${PDF_BUNDLE_DIR}/${PDF_BUNDLE_NAME}" "${PDF_BUNDLE_DIR}/${NEW_PDF_BUNDLE_NA
3131

3232
echo "PDF Bundle Tag Success!"
3333
echo "PDF Bundle Path: ${PDF_BUNDLE_DIR}/${NEW_PDF_BUNDLE_NAME}"
34+
echo "${PDF_BUNDLE_DIR}/${NEW_PDF_BUNDLE_NAME}" > ".pdf-bundle-path"

ci/pdf/4-publish-pdf-bundle.sh

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ aws s3 cp "${PDF_BUNDLE_PATH}" "s3://downloads.mesosphere.io/dcos-docs-site/${PD
2323
echo "PDF Bundle Publish Success!"
2424
PDF_BUNDLE_URL="https://downloads.mesosphere.com/dcos-docs-site/${PDF_BUNDLE_NAME}"
2525
echo "PDF Bundle URL: ${PDF_BUNDLE_URL}"
26+
echo "${PDF_BUNDLE_URL}" > ".pdf-bundle-url"

ci/site/0-commit-hook.sh

+5-10
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,12 @@ DCOS_CRT="${DCOS_CRT}" # ex: docs-us.crt
2020

2121
ci/site/1-setup-env.sh
2222

23-
# capture output AND print to stdout
24-
exec 5>&1
25-
function close_file_descriptor() {
26-
exec 5>&-
27-
}
28-
trap 'close_file_descriptor' EXIT
29-
30-
IMAGE=$(ci/site/2-build-site-image.sh | tee >(cat - >&5) | grep "^Image: " | sed "s/^Image: //")
31-
IMAGE_NAME="$(echo "${IMAGE}" | sed 's/^\(.*\):\([^:]*\)/\1/')"
23+
ci/site/2-build-site-image.sh
24+
25+
DOCKER_IMAGE="$(cat ".site-image")"
26+
IMAGE_NAME="$(echo "${DOCKER_IMAGE}" | sed 's/^\(.*\):\([^:]*\)/\1/')"
3227
export IMAGE_NAME # export separately so errexit works :(
33-
IMAGE_TAG="$(echo "${IMAGE}" | sed 's/^\(.*\):\([^:]*\)/\2/')"
28+
IMAGE_TAG="$(echo "${DOCKER_IMAGE}" | sed 's/^\(.*\):\([^:]*\)/\2/')"
3429
export IMAGE_TAG # export separately so errexit works :(
3530

3631
ci/site/3-test-site-image.sh

ci/site/2-build-site-image.sh

+1
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ docker tag ${IMAGE_NAME}:${TEMP_IMAGE_TAG} ${IMAGE_NAME}:${IMAGE_TAG}
3535

3636
echo "Image Tag Success!"
3737
echo "Image: ${IMAGE_NAME}:${IMAGE_TAG}"
38+
echo "${IMAGE_NAME}:${IMAGE_TAG}" > ".site-image"

0 commit comments

Comments
 (0)