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

Adjust extension workflows in branch 'release 2.8' for nightly run tests for extensions #12604

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
36 changes: 32 additions & 4 deletions .github/workflows/build-extension-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,44 @@ on:
tagged_release:
required: false
type: string
is_test:
required: false
type: string
test_ext_repo:
required: false
type: string
test_ext_branch:
required: false
type: string
secrets:
registry_token:
required: true
outputs:
build-extension-catalog-job-status:
value: ${{ jobs.build-extension-catalog.outputs.build-status }}

jobs:
build-extension-catalog:
name: Build container image
if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test == 'true'
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
packages: write
outputs:
build-status: ${{ job.status }}

steps:
- name: Checkout repository
- if: inputs.is_test == 'true'
name: Checkout repository (test flow)
uses: actions/checkout@v4
with:
repository: rancher/${{ inputs.test_ext_repo }}
ref: ${{ inputs.test_ext_branch }}

- if: inputs.is_test != 'true'
name: Checkout repository (normal flow)
uses: actions/checkout@v4

- name: Setup Nodejs for corepack
Expand Down Expand Up @@ -64,7 +86,7 @@ jobs:
run: yarn

- name: Parse Extension Name
if: github.ref_type == 'tag'
if: github.ref_type == 'tag' || inputs.is_test == 'true'
id: parsed-name
env:
GH_TOKEN: ${{ github.token }}
Expand All @@ -73,7 +95,13 @@ jobs:

- name: Build and push UI image
run: |
publish="yarn publish-pkgs -cp -r ${{ inputs.registry_target }} -o ${{ github.repository_owner }}"
publish="yarn publish-pkgs -c"

if [[ "${{ inputs.is_test }}" != "true" ]]; then
publish="$publish -p"
fi

publish="$publish -r ${{ inputs.registry_target }} -o ${{ github.repository_owner }}"

if [[ -n "${{ inputs.tagged_release }}" ]]; then
publish="$publish -t ${{ inputs.tagged_release }}"
Expand Down
35 changes: 31 additions & 4 deletions .github/workflows/build-extension-charts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ on:
tagged_release:
required: false
type: string
is_test:
required: false
type: string
test_ext_repo:
required: false
type: string
test_ext_branch:
required: false
type: string
outputs:
build-job-status:
value: ${{ jobs.build-extension-artifact.outputs.build-status }}

env:
ACTIONS_RUNNER_DEBUG: false
Expand All @@ -26,8 +38,19 @@ jobs:
permissions:
actions: write
contents: read
outputs:
build-status: ${{ job.status }}
steps:
- name: Checkout
- if: inputs.is_test == 'true'
name: Checkout (test flow)
uses: actions/checkout@v4
with:
repository: rancher/${{ inputs.test_ext_repo }}
ref: ${{ inputs.test_ext_branch }}
fetch-depth: 0

- if: inputs.is_test != 'true'
name: Checkout (normal flow)
uses: actions/checkout@v4
with:
fetch-depth: 0
Expand Down Expand Up @@ -60,7 +83,7 @@ jobs:
run: yarn

- name: Parse Extension Name
if: github.ref_type == 'tag'
if: github.ref_type == 'tag' || inputs.is_test == 'true'
id: parsed-name
env:
GH_TOKEN: ${{ github.token }}
Expand All @@ -77,18 +100,22 @@ jobs:
publish="$publish -t ${{ inputs.tagged_release }}"
fi

if [[ "${{ inputs.is_test }}" == "true" ]]; then
publish="$publish -f"
fi

$publish

- name: Upload charts artifact
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test == 'true'
uses: actions/upload-artifact@v3
with:
name: charts
path: tmp

release:
name: Release Build
if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request')
if: github.ref_type == 'tag' || (github.ref == 'refs/heads/main' && github.event_name != 'pull_request') || inputs.is_test != 'true'
needs: build-extension-artifact
runs-on: ubuntu-latest
permissions:
aalves08 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
34 changes: 31 additions & 3 deletions .github/workflows/release-shell-pkg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,42 @@ on:
tags:
- "shell-pkg-v*"
- "creators-pkg-v*"
workflow_call:
inputs:
tag:
required: false
type: string
is_test:
required: false
type: string
test_branch:
required: false
type: string
outputs:
build-release-shell-creators-status:
value: ${{ jobs.build.outputs.build-status }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
if: github.repository == 'rancher/dashboard' && (github.event_name == 'workflow_call' || (github.event_name == 'push' && github.event.ref == 'refs/tags/${{ github.ref_name }}'))
outputs:
build-status: ${{ job.status }}
steps:
- uses: actions/checkout@v3
- if: inputs.is_test == 'true' && inputs.test_branch != ''
name: Checkout (test flow)
uses: actions/checkout@v4
with:
persist-credentials: false
ref: ${{ inputs.test_branch }}
fetch-depth: 0

- if: inputs.is_test != 'true'
jordojordo marked this conversation as resolved.
Show resolved Hide resolved
name: Checkout (normal flow)
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
Expand All @@ -26,7 +53,7 @@ jobs:

- name: Check Tags Version Matching
env:
TAG: ${{github.ref_name}}
TAG: ${{ inputs.tag || github.ref_name }}
run: ./.github/workflows/scripts/check-package-tag-version.sh
shell: bash

Expand Down Expand Up @@ -57,5 +84,6 @@ jobs:
- name: Publish Shell Package to npm
run: ./shell/scripts/publish-shell.sh --npm
env:
TAG: ${{github.ref_name}}
TAG: ${{ inputs.tag || github.ref_name }}
DRY_RUN: ${{ inputs.is_test }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions shell/scripts/extension/parse-tag-name
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ GITHUB_RELEASE_TAG=$1
GITHUB_RUN_ID=$2
GITHUB_WORKFLOW_TYPE=$3

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

# Check packages for released tag name
if [[ "${GITHUB_WORKFLOW_TYPE}" == "container" ]]; then
for d in pkg/*/ ; do
Expand Down
7 changes: 7 additions & 0 deletions shell/scripts/publish-shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ function publish() {
PUBLISH_ARGS="$PUBLISH_ARGS --tag legacy-v1"
fi

# when testing the workflow, we don't want to actually do an npm publish but only a dry run
if [ ${DRY_RUN} == "true" ]; then
PUBLISH_ARGS="$PUBLISH_ARGS --dry-run"
fi

echo "Publish to NPM - arguments ::: ${PUBLISH_ARGS}"

# Make a note of dependency versions, if required
node ${SCRIPT_DIR}/record-deps.js

Expand Down
Loading