Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sean Simmons progress/chef 18267 workstation team #43

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 25 additions & 16 deletions .expeditor/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
staging_areas:
- hab_unstable_promote:
workload: hab_package_published:stable:chef/fauxhai/{{version_constraint}}
47 changes: 44 additions & 3 deletions .expeditor/promote-hab-pkg.sh
Original file line number Diff line number Diff line change
@@ -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}"

# 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
Loading