diff --git a/.expeditor/config.yml b/.expeditor/config.yml index 5250fd96..e72f9962 100644 --- a/.expeditor/config.yml +++ b/.expeditor/config.yml @@ -12,6 +12,17 @@ rubygems: artifact_channels: - workstation-build - stable + - LTS-2024 + +pipelines: + - verify: + description: Pull Request validation tests + public: true + - habitat/build: + description: Build the Habitat packages for faixhai + - habitat/test: + definition: .expeditor/habitat-test.pipeline.yml + trigger: default release_branches: - workstation-LTS: @@ -48,29 +59,27 @@ subscriptions: ignore_labels: - "Expeditor: Skip Changelog" - "Expeditor: Skip All" - - built_in:build_gem: - only_if: built_in:bump_version - - trigger_pipeline:habitat/publish: - only_if: built_in:bump_version + - trigger_pipeline:habitat/build: ignore_labels: - "Expeditor: Skip Habitat" - "Expeditor: Skip All" - - trigger_pipeline:habitat/test: only_if: built_in:bump_version - ignore_labels: - - "Expeditor: Skip Habitat" - - "Expeditor: Skip All" + - built_in:build_gem: + only_if: built_in:bump_version + +# this is the only way currently to promote built-in rubygems publish - workload: project_promoted:{{agent_id}}:* actions: - built_in:rollover_changelog + - built_in:promote_habitat_packages - built_in:publish_rubygems - - workload: buildkite_hab_build_group_published:{{agent_id}}:* + + # subscription to fire off any other promotions that you may need for an additional channnel like LTS or something. + - workload: staged_workload_released:{{agent_id}}:hab_unstable_promote:* actions: - # when all of the hab package publish to the unstable channel, test and promote them - - bash:.expeditor/promote-hab-pkg.sh - - built_in:promote_habitat_packages + - bash:.expeditor/scripts/promote-hab-pkgs.sh: + post_commit: true -pipelines: - - verify: - description: Pull Request validation tests - public: true \ No newline at end of file +staging_areas: + - hab_unstable_promote: + workload: hab_package_published:stable:chef/fauxhai/{{version_constraint}} \ No newline at end of file diff --git a/.expeditor/promote-hab-pkg.sh b/.expeditor/promote-hab-pkg.sh index 6b8dddd2..e59b2450 100644 --- a/.expeditor/promote-hab-pkg.sh +++ b/.expeditor/promote-hab-pkg.sh @@ -1,10 +1,51 @@ #!/bin/bash +# +# when using the following workflow, the following env vars are available to us for use. + +# # subscription to fire off any other promotions that you may need for an additional channnel like LTS or something. +# - workload: staged_workload_released:{{agent_id}}:hab_unstable_promote:* +# actions: +# - bash:.expeditor/scripts/promote-hab-pkgs.sh: +# post_commit: true +# +# PROMOTABLE - in promotion artifact actions this is a reference to the +# source channel. +# EXPEDITOR_CHANNEL - Read from the expeditor config, this should be the "lowest" channel in your promotion. IE: unstable +# EXPEDITOR_TARGET_CHANNEL - the channel which we are promoting to +# HAB_AUTH_TOKEN - GitHub Auth token used to communicate with the +# Habitat depot and private repos in Chef's GitHub org +# set -eou pipefail -echo "--> Running the promote-hab-pkg.sh script" +# Export the HAB_AUTH_TOKEN for use of promoting habitat packages to {{EXPEDITOR_TARGET_CHANNEL}} HAB_AUTH_TOKEN=$(vault kv get -field auth_token account/static/habitat/chef-ci) export HAB_AUTH_TOKEN -source_channel="workstation-build" - hab pkg promote "${EXPEDITOR_PKG_IDENT}" "${EXPEDITOR_TARGET_CHANNEL}" "${EXPEDITOR_PKG_TARGET}" \ No newline at end of file + +# when this workflow runs, there are env vars that are available to us in the running pod, we are grabbing the source ENV, then assigning it to our next channel +if [[ "${EXPEDITOR_CHANNEL}" == "unstable" ]]; then + echo "This file does not support actions for artifacts promoted to unstable, that should happen in the /expeditor promote AGENT VERSION command from slack" + exit 1 +elif [[ "${EXPEDITOR_CHANNEL}" == "stable" ]]; then + export EXPEDITOR_TARGET_CHANNEL="LTS-2024" + echo "My current package is in channel: ${EXPEDITOR_CHANNEL}. I am promoting to ${EXPEDITOR_TARGET_CHANNEL}" +# elif [[ "${EXPEDITOR_CHANNEL}" == "acceptance" ]]; then +# export EXPEDITOR_TARGET_CHANNEL="current" +# echo "My current package is in channel: ${EXPEDITOR_CHANNEL}. I am promoting to ${EXPEDITOR_TARGET_CHANNEL}" +# elif [[ "${EXPEDITOR_CHANNEL}" == "current" ]]; then +# export EXPEDITOR_TARGET_CHANNEL="stable" +# echo "My current package is in channel: ${EXPEDITOR_CHANNEL}. I am promoting to ${EXPEDITOR_TARGET_CHANNEL}" +else + echo "Unknown EXPEDITOR_CHANNEL: ${EXPEDITOR_CHANNEL}" + exit 1 +fi + +# Promote the artifacts in Habitat Depot + if [[ "${EXPEDITOR_PKG_ORIGIN}" == "core" ]]; + then + echo "Skipping promotion of core origin package ${EXPEDITOR_PKG_ORIGIN}" + else + echo "Promoting ${EXPEDITOR_PKG_IDENT} to the ${EXPEDITOR_TARGET_CHANNEL} channel" + hab pkg promote "${EXPEDITOR_PKG_IDENT}" "${EXPEDITOR_TARGET_CHANNEL}" + fi