Skip to content

Commit

Permalink
Merge pull request #139 from perftool-incubator/dev-kmr
Browse files Browse the repository at this point in the history
Dev kmr
  • Loading branch information
k-rister authored Aug 23, 2024
2 parents d0bbdad + 9f52cdb commit 8d41d51
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 8 deletions.
7 changes: 5 additions & 2 deletions .github/actions/check-controller-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ inputs:
bypass-controller-build:
description: "Should this action return 'no' no matter what"
required: true
force-controller-build:
description: "Should action return 'yes' no matter what"
required: true
crucible-directory:
description: "Where is the crucible repository to check for controller image related changes"
required: true
Expand All @@ -19,8 +22,8 @@ runs:
steps:
- name: "Validate crucible-directory"
shell: bash
run: ${{ github.action_path }}/validate-inputs.sh ${{ inputs.bypass-controller-build }} ${{ inputs.crucible-directory }} ${{ inputs.workshop-directory }}
run: ${{ github.action_path }}/validate-inputs.sh ${{ inputs.bypass-controller-build }} ${{ inputs.force-controller-build }} ${{ inputs.crucible-directory }} ${{ inputs.workshop-directory }}
- name: "Check for controller build status"
id: check-controller-build
shell: bash
run: ${{ github.action_path }}/check-controller-build.sh ${{ inputs.bypass-controller-build }} ${{ inputs.crucible-directory}} ${{ inputs.workshop-directory }}
run: ${{ github.action_path }}/check-controller-build.sh ${{ inputs.bypass-controller-build }} ${{ inputs.force-controller-build }} ${{ inputs.crucible-directory}} ${{ inputs.workshop-directory }}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
# vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=bash

bypass_controller_build=${1}
crucible_directory=${2}
workshop_directory=${3}
force_controller_build=${2}
crucible_directory=${3}
workshop_directory=${4}

function error() {
echo "ERROR: ${1}"
Expand All @@ -29,6 +30,10 @@ build_controller="no"

if [ "${bypass_controller_build}" == "yes" ]; then
echo "Bypassing controller build"
elif [ "${force_controller_build}" == "yes" ]; then
build_controller="yes"

echo "Forcing controller build"
else
echo "Crucible workshop change analysis:"
if pushd ${crucible_directory}; then
Expand Down
30 changes: 26 additions & 4 deletions .github/actions/check-controller-build/validate-inputs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,36 @@
# vim: autoindent tabstop=4 shiftwidth=4 expandtab softtabstop=4 filetype=bash

bypass_controller_build=${1}
crucible_directory=${2}
workshop_directory=${3}
force_controller_build=${2}
crucible_directory=${3}
workshop_directory=${4}

function error() {
echo "ERROR: ${1}"
exit 1
}

function usage() {
echo "Usage: ${0} <bypass-controller-build> <crucible> <workshop>"
echo "Usage: ${0} <bypass-controller-build> <force-controller-build> <crucible> <workshop>"
echo
echo "<bypass-controller-build> is a yes|no value"
echo "<force-controller-build> is a yes|no value"
echo "<crucible> is a directory where the crucible repository exists."
echo "<workshop> is a directory where the workshop repoistory exists."
echo
echo "If <bypass-controller-build> is 'yes' then the action short circuits and returns 'no'"
echo
echo "If <force-controller-build> is 'yes' then the action short circuits and returns 'yes'"
echo
echo "If <bypass-controller-build> and <force-controller-build> are both set to 'yes' then"
echo "an error is emitted since the two parameters are mutually exclusive"
echo
echo "Both repositories are examined to determine if their changes require"
echo "the building of a new controller image for testing"
exit 1
}

if [ -z "${bypass_controller_build}" -o -z "${crucible_directory}" -o -z "${workshop_directory}" ]; then
if [ -z "${bypass_controller_build}" -o -z "${force_controller_build}" -o -z "${crucible_directory}" -o -z "${workshop_directory}" ]; then
usage
else
# handle <bypass-controller-build>
Expand All @@ -37,6 +44,21 @@ else
error "bypass_controller_build has an invalid value of '${bypass_controller_build}'"
;;
esac

# handle <force-controller-build>
case "${force_controller_build}" in
"yes"|"no")
echo "force_controller_build has a valid value of '${force_controller_build}'"
;;
*)
error "force_controller_build has an invalid value of '${force_controller_build}'"
;;
esac

# handle mutual exclusions
if [ "${bypass_controller_build}" == "yes" -a "${force_controller_build}" == "yes" ]; then
error "You cannot set bypass_controller_build and force_controller_build to 'yes' at the same time"
fi

# handle <crucible>
if [ ! -e "${crucible_directory}" ]; then
Expand Down
21 changes: 21 additions & 0 deletions .github/actions/install-crucible/install-crucible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,27 @@ start_github_group "rickshaw-settings updates"
RICKSHAW_SETTINGS_FILE="/opt/crucible/subprojects/core/rickshaw/rickshaw-settings.json"
UPDATES_REQUIRED=0

if [ "${CI_CONTROLLER}" == "yes" ]; then
UPDATES_REQUIRED=1
FORCE_BUILDS="true"
echo "Updating rickshaw-settings value workshop.force-builds to '${FORCE_BUILDS}' in ${RICKSHAW_SETTINGS_FILE}"

if jq --indent 4 --arg force_builds "${FORCE_BUILDS}" \
'.workshop."force-builds" = $force_builds' \
${RICKSHAW_SETTINGS_FILE} > ${RICKSHAW_SETTINGS_FILE}.tmp; then
if mv ${RICKSHAW_SETTINGS_FILE}.tmp ${RICKSHAW_SETTINGS_FILE}; then
echo "Successfully updated:"
jq --indent 4 . ${RICKSHAW_SETTINGS_FILE}
else
echo "ERROR: Failed to move force-builds"
exit 1
fi
else
echo "ERROR: Failed to update force-builds"
exit 1
fi
fi

if [ "${AUTH_TOKEN_FILE_FOUND}" == 1 -a "${AUTH_TOKEN_TYPE}" == "PRODUCTION" ]; then
UPDATES_REQUIRED=1
EXPIRATION_LENGTH="52w"
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/core-crucible-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ on:
required: false
type: string
default: "no"
force_controller_build:
required: false
type: string
default: "no"
secrets:
registry_auth:
required: false
Expand Down Expand Up @@ -152,6 +156,7 @@ jobs:
uses: ./crucible-ci/.github/actions/check-controller-build
with:
bypass-controller-build: "${{ inputs.bypass_controller_build }}"
force-controller-build: "${{ inputs.force_controller_build }}"
crucible-directory: "./crucible"
workshop-directory: "./workshop"
- name: run get-repo-name
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/test-core-crucible-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ jobs:
subproject_dir: "CommonDataModel"
branch: "master"
userenv_filter: "minimal"
force_controller_build: "no"
- subproject: "rickshaw"
subproject_dir: "rickshaw"
branch: "master"
userenv_filter: "all"
force_controller_build: "no"
- subproject: "crucible"
subproject_dir: "crucible"
branch: "master"
userenv_filter: "unique"
force_controller_build: "yes"
uses: ./.github/workflows/core-crucible-ci.yaml
with:
ci_target: "${{ matrix.repos.subproject }}"
Expand All @@ -40,6 +43,7 @@ jobs:
crucible_ci_test_branch: "${{ github.ref }}"
github_workspace: "$GITHUB_WORKSPACE"
userenv_filter: ${{ matrix.repos.userenv_filter }}
force_controller_build: "${{ matrix.repos.force_controller_build }}"
secrets:
ci_registry_auth: ${{ secrets.CRUCIBLE_CI_ENGINES_REGISTRY_AUTH }}
quay_oauth_token: ${{ secrets.CRUCIBLE_QUAYIO_OAUTH_TOKEN }}
Expand Down

0 comments on commit 8d41d51

Please sign in to comment.