Skip to content

Commit

Permalink
small fixes to workflow test runs (rancher#12676)
Browse files Browse the repository at this point in the history
* small fixes to workflow test runs

* move retrieve-versions script to better location

* update paths for retrieve-versions script

* fix slack messages

* fix slack messages

* fix parse-tag-name to allow for release of both catalog and charts for extensions

* add mising type definitions
  • Loading branch information
aalves08 authored Nov 26, 2024
1 parent d413605 commit df7e954
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions .github/workflows/test-extension-workflows-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
ref: master

- name: Retrieve Shell and Creators versions
run: source ./shell/scripts/retrieve-versions.sh
run: source ./.github/workflows/scripts/retrieve-versions.sh
id: retrieve-data
shell: bash
test-build-extension-charts-master:
Expand Down Expand Up @@ -112,4 +112,4 @@ jobs:
echo "message sent: $MSG"
curl -X POST -H 'Content-type: application/json; charset=utf-8' \
--data '{ branch: "master", message: $MSG }' $SLACK_WEBHOOK
--data '{ "branch": "master", "message": $MSG, "workflow_run": ${{ github.run_id }} }' $SLACK_WEBHOOK
4 changes: 2 additions & 2 deletions .github/workflows/test-extension-workflows-release-2.8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
ref: release-2.8

- name: Retrieve Shell and Creators versions
run: source ./shell/scripts/retrieve-versions.sh
run: source ./.github/workflows/scripts/retrieve-versions.sh
id: retrieve-data
shell: bash
test-build-extension-charts-release-2-dot-8:
Expand Down Expand Up @@ -112,4 +112,4 @@ jobs:
echo "message sent: $MSG"
curl -X POST -H 'Content-type: application/json; charset=utf-8' \
--data '{ branch: "release-2.8", message: $MSG }' $SLACK_WEBHOOK
--data '{ "branch": "release-2.8", "message": $MSG, "workflow_run": ${{ github.run_id }} }' $SLACK_WEBHOOK
4 changes: 2 additions & 2 deletions .github/workflows/test-extension-workflows-release-2.9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
ref: release-2.9

- name: Retrieve Shell and Creators versions
run: source ./shell/scripts/retrieve-versions.sh
run: source ./.github/workflows/scripts/retrieve-versions.sh
id: retrieve-data
shell: bash
test-build-extension-charts-release-2-dot-9:
Expand Down Expand Up @@ -112,4 +112,4 @@ jobs:
echo "message sent: $MSG"
curl -X POST -H 'Content-type: application/json; charset=utf-8' \
--data '{ branch: "release-2.9", message: $MSG }' $SLACK_WEBHOOK
--data '{ "branch": "release-2.9", "message": $MSG, "workflow_run": ${{ github.run_id }} }' $SLACK_WEBHOOK
29 changes: 17 additions & 12 deletions shell/scripts/extension/parse-tag-name
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,32 @@ GITHUB_WORKFLOW_TYPE=$3

echo "Parse tag name - evaluating release tag $GITHUB_RELEASE_TAG"

# Ensure "catalog" workflow release tag name does not match a pkg/<pkg-name>
# Ensure "catalog" workflow release tag name matches the root <pkg-name>
if [[ "${GITHUB_WORKFLOW_TYPE}" == "catalog" ]]; then
BASE_EXT=$(jq -r .name package.json)
EXT_VERSION=$(jq -r .version package.json)

if [[ "${GITHUB_RELEASE_TAG}" != "${BASE_EXT}-${EXT_VERSION}" ]]; then
echo -e "release tag doesn't match catalog tag: release tag -> ${GITHUB_RELEASE_TAG} ::: curr catalog tag -> ${BASE_EXT}-${EXT_VERSION}"
gh run cancel ${GITHUB_RUN_ID}
fi
# Ensure "chart" workflow release tag name matches some pkg/<pkg-name>
else
NO_MATCHES="true"

for d in pkg/*/ ; do
pkg=$(basename $d)

PKG_VERSION=$(jq -r .version pkg/${pkg}/package.json)
PKG_NAME="${pkg}-${PKG_VERSION}"
CURR_PKG_TAG="${pkg}-${PKG_VERSION}"

if [[ "${GITHUB_RELEASE_TAG}" == "${PKG_NAME}" ]]; then
gh run cancel ${GITHUB_RUN_ID}
else
continue
if [[ "${GITHUB_RELEASE_TAG}" == "${CURR_PKG_TAG}" ]]; then
NO_MATCHES="false"
fi
done
else
# Ensure "charts" workflow release tag name does not match the root <pkg-name>
BASE_EXT=$(jq -r .name package.json)
EXT_VERSION=$(jq -r .version package.json)

if [[ "${GITHUB_RELEASE_TAG}" == "${BASE_EXT}-${EXT_VERSION}" ]]; then
echo -e "tag: ${GITHUB_RELEASE_TAG}"
if [[ "${NO_MATCHES}" == "true" ]]; then
echo -e "release tag doesn't match any chart tag: ${GITHUB_RELEASE_TAG}. Check your pkg/<!-YOUR-EXT-> folders and corresponding versions to complete the match"
gh run cancel ${GITHUB_RUN_ID}
fi
fi
5 changes: 3 additions & 2 deletions shell/scripts/publish-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
BASE_DIR="$(cd $SCRIPT_DIR && cd ../.. && pwd)"
SHELL_DIR=$BASE_DIR/shell/
CREATORS_DIR=$BASE_DIR/creators/extension
PUBLISH_ARGS="--no-git-tag-version --access public --registry $NPM_REGISTRY $NPM_TAG"
FORCE_PUBLISH_TO_NPM="false"
DEFAULT_NPM_REGISTRY="https://registry.npmjs.org"

Expand All @@ -31,6 +30,8 @@ if [ "$FORCE_PUBLISH_TO_NPM" == "true" ]; then
export NPM_REGISTRY=$DEFAULT_NPM_REGISTRY
fi

PUBLISH_ARGS="--no-git-tag-version --access public --registry $NPM_REGISTRY"

pushd ${SHELL_DIR} >/dev/null

function publish() {
Expand All @@ -47,7 +48,7 @@ function publish() {

# if the PKG_VERSION has a - it means it will be a pre-release
if [[ $PKG_VERSION == *"-"* ]]; then
PUBLISH_ARGS="--no-git-tag-version --access public --registry $NPM_REGISTRY --tag pre-release"
PUBLISH_ARGS="$PUBLISH_ARGS --tag pre-release"
fi

# when testing the workflow, we don't want to actually do an npm publish but only a dry run
Expand Down
2 changes: 2 additions & 0 deletions shell/scripts/typegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ ${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/plugins/dashboard-store/normalize
${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/plugins/dashboard-store/resource-class.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/plugins/dashboard-store/ > /dev/null
${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/plugins/dashboard-store/classify.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/plugins/dashboard-store/ > /dev/null
${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/plugins/dashboard-store/actions.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/plugins/dashboard-store/ > /dev/null
${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/plugins/steve/steve-class.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/plugins/steve/ > /dev/null

# # mixins
${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/mixins/create-edit-view/index.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/mixins/create-edit-view > /dev/null
${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/mixins/resource-fetch.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/mixins > /dev/null

# # models
${BASE_DIR}/node_modules/.bin/tsc ${SHELL_DIR}/models/namespace.js --declaration --allowJs --emitDeclarationOnly --outDir ${SHELL_DIR}/tmp/models/ > /dev/null
Expand Down

0 comments on commit df7e954

Please sign in to comment.