Only promote for Expeditor-triggered pipeline runs
@@ -35,6 +35,17 @@ export HAB_BLDR_URL="${ACCEPTANCE_HAB_BLDR_URL}"
source .expeditor/scripts/shared.sh
+# This allows people to e.g. trigger end-to-end pipeline runs manually
+# when iterating on tests, but without having to fear that they'll
+# inadvertently promote a set of artifacts accidentally.
+#
+# Only Chef Expeditor should be triggering "real" runs of pipelines
+# that use this script.
+valid_build_creator="Chef Expeditor"
+
+if [[ "${BUILDKITE_BUILD_CREATOR}" == "${valid_build_creator}" ]]; then
+ # We're in a real pipeline run; let's promote!
+
# Take advantage of the fact that we're just promoting and we can run
# 100% on linux
declare -g hab_binary
@@ -53,3 +64,7 @@ promote_packages_to_builder_channel manifest.json "${destination_channel}"
version="$(jq -r '.version' < manifest.json)"
echo "--- Promoting binary packages and manifest to the ${destination_channel} channel in S3"
promote_version_in_s3 "${version}" "${destination_channel}"
+
+else
+ echo "--- NOT PROMOTING: Build triggered by ${BUILDKITE_BUILD_CREATOR} and *not* ${valid_build_creator}"
+fi
