-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add daily CLI smoke test pipeline #551
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
base: main
Are you sure you want to change the base?
Changes from all commits
29bb2e3
cea0d34
eaa6ccd
86c39f5
e9532cf
def5bd0
4d4363c
e7c20cf
509554b
fa14aa6
7c82b07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,188 @@ | ||||||||||||||||
| name: CLI Smoke Test | ||||||||||||||||
|
|
||||||||||||||||
| on: | ||||||||||||||||
| schedule: | ||||||||||||||||
| # 3:30 UTC = 9:00 AM IST, daily | ||||||||||||||||
| - cron: '30 3 * * *' | ||||||||||||||||
| workflow_dispatch: {} # manual trigger for testing | ||||||||||||||||
|
|
||||||||||||||||
| permissions: {} | ||||||||||||||||
|
|
||||||||||||||||
| env: | ||||||||||||||||
| NODE_VERSION: "20" | ||||||||||||||||
| ALPHA_AUTHORITY: https://alpha.uipath.com | ||||||||||||||||
| ORG: popoc | ||||||||||||||||
| TENANT: adetenant | ||||||||||||||||
| FOLDER_KEY: 8645d674-92d8-4281-9aef-43f3e3608ded | ||||||||||||||||
| LOGIN_SCOPE: "Apps OR.Folders.Read OR.Execution" | ||||||||||||||||
|
|
||||||||||||||||
| jobs: | ||||||||||||||||
| stable-cli: | ||||||||||||||||
| name: Stable CLI (npm @latest) | ||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Neither
Suggested change
Same addition needed for the |
||||||||||||||||
| permissions: | ||||||||||||||||
| contents: read | ||||||||||||||||
| env: | ||||||||||||||||
| # Unique per run — always a fresh publish + deploy, no collisions | ||||||||||||||||
| APP_NAME: smoke-s-${{ github.run_number }} | ||||||||||||||||
| steps: | ||||||||||||||||
| - name: Checkout | ||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||
|
|
||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||
| with: | ||||||||||||||||
| node-version: ${{ env.NODE_VERSION }} | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install CLI (npm @latest) | ||||||||||||||||
| run: | | ||||||||||||||||
| npm i -g @uipath/cli@latest | ||||||||||||||||
| uip tools install codedapp | ||||||||||||||||
| echo "CLI version: $(uip --version)" | ||||||||||||||||
| uip tools list | ||||||||||||||||
|
|
||||||||||||||||
| - name: Login | ||||||||||||||||
| env: | ||||||||||||||||
| UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }} | ||||||||||||||||
| UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }} | ||||||||||||||||
| run: | | ||||||||||||||||
| uip login \ | ||||||||||||||||
| --authority "${{ env.ALPHA_AUTHORITY }}" \ | ||||||||||||||||
| --organization "${{ env.ORG }}" \ | ||||||||||||||||
| --tenant "${{ env.TENANT }}" \ | ||||||||||||||||
| --client-id "$UIPATH_CLIENT_ID" \ | ||||||||||||||||
| --client-secret "$UIPATH_CLIENT_SECRET" \ | ||||||||||||||||
| --scope "${{ env.LOGIN_SCOPE }}" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Pack | ||||||||||||||||
| run: | | ||||||||||||||||
| uip codedapp pack \ | ||||||||||||||||
| fixtures/smoke-test-app \ | ||||||||||||||||
| --name "$APP_NAME" \ | ||||||||||||||||
| --version "1.0.0" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Publish | ||||||||||||||||
| run: | | ||||||||||||||||
| uip codedapp publish --name "$APP_NAME" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Deploy | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The workflow deploys an app to the alpha environment on every run but never cleans it up. Daily runs will accumulate deployed versions indefinitely. Add an explicit cleanup step that runs even on failure — either a dedicated Example (add as the last step in each job): - name: Cleanup
if: always()
run: |
uip codedapp undeploy \
--name "$APP_NAME" \
--folder-key "${{ env.FOLDER_KEY }}" || true |
||||||||||||||||
| run: | | ||||||||||||||||
| uip codedapp deploy \ | ||||||||||||||||
| --name "$APP_NAME" \ | ||||||||||||||||
| --folder-key "${{ env.FOLDER_KEY }}" | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The deploy step doesn't pin Pin the version to match what was just published:
Suggested change
Same fix is needed in the |
||||||||||||||||
|
|
||||||||||||||||
| - name: Health check | ||||||||||||||||
| run: | | ||||||||||||||||
| APP_URL="https://${{ env.ORG }}.uipath.host/${APP_NAME}" | ||||||||||||||||
| echo "Checking $APP_URL" | ||||||||||||||||
| for i in 1 2 3; do | ||||||||||||||||
| if curl -sf --max-time 10 "$APP_URL" > /dev/null; then | ||||||||||||||||
| echo "Health check passed on attempt $i" | ||||||||||||||||
| exit 0 | ||||||||||||||||
| fi | ||||||||||||||||
| echo "Attempt $i failed, retrying in 10s..." | ||||||||||||||||
| sleep 10 | ||||||||||||||||
| done | ||||||||||||||||
| echo "Health check failed after 3 attempts" | ||||||||||||||||
| exit 1 | ||||||||||||||||
|
|
||||||||||||||||
| alpha-cli: | ||||||||||||||||
| name: Alpha CLI (GH Packages) | ||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
| permissions: | ||||||||||||||||
| contents: read | ||||||||||||||||
| packages: read | ||||||||||||||||
| env: | ||||||||||||||||
| APP_NAME: smoke-a-${{ github.run_number }} | ||||||||||||||||
| steps: | ||||||||||||||||
| - name: Checkout | ||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||
|
|
||||||||||||||||
| - name: Setup Node.js | ||||||||||||||||
| uses: actions/setup-node@v4 | ||||||||||||||||
| with: | ||||||||||||||||
| node-version: ${{ env.NODE_VERSION }} | ||||||||||||||||
|
|
||||||||||||||||
| - name: Install CLI (GH Packages) | ||||||||||||||||
| run: | | ||||||||||||||||
| echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> ~/.npmrc | ||||||||||||||||
|
Raina451 marked this conversation as resolved.
|
||||||||||||||||
| echo "@uipath:registry=https://npm.pkg.github.com" >> ~/.npmrc | ||||||||||||||||
| npm i -g @uipath/cli | ||||||||||||||||
| uip tools install codedapp | ||||||||||||||||
| echo "CLI version: $(uip --version)" | ||||||||||||||||
| uip tools list | ||||||||||||||||
|
|
||||||||||||||||
| - name: Login | ||||||||||||||||
| env: | ||||||||||||||||
| UIPATH_CLIENT_ID: ${{ secrets.UIPATH_CLIENT_ID }} | ||||||||||||||||
| UIPATH_CLIENT_SECRET: ${{ secrets.UIPATH_CLIENT_SECRET }} | ||||||||||||||||
| run: | | ||||||||||||||||
| uip login \ | ||||||||||||||||
| --authority "${{ env.ALPHA_AUTHORITY }}" \ | ||||||||||||||||
| --organization "${{ env.ORG }}" \ | ||||||||||||||||
| --tenant "${{ env.TENANT }}" \ | ||||||||||||||||
| --client-id "$UIPATH_CLIENT_ID" \ | ||||||||||||||||
| --client-secret "$UIPATH_CLIENT_SECRET" \ | ||||||||||||||||
| --scope "${{ env.LOGIN_SCOPE }}" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Pack | ||||||||||||||||
| run: | | ||||||||||||||||
| uip codedapp pack \ | ||||||||||||||||
| fixtures/smoke-test-app \ | ||||||||||||||||
| --name "$APP_NAME" \ | ||||||||||||||||
| --version "1.0.0" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Publish | ||||||||||||||||
| run: | | ||||||||||||||||
| uip codedapp publish --name "$APP_NAME" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Deploy | ||||||||||||||||
| run: | | ||||||||||||||||
| uip codedapp deploy \ | ||||||||||||||||
| --name "$APP_NAME" \ | ||||||||||||||||
| --folder-key "${{ env.FOLDER_KEY }}" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Health check | ||||||||||||||||
| run: | | ||||||||||||||||
| APP_URL="https://${{ env.ORG }}.uipath.host/${APP_NAME}" | ||||||||||||||||
| echo "Checking $APP_URL" | ||||||||||||||||
| for i in 1 2 3; do | ||||||||||||||||
| if curl -sf --max-time 10 "$APP_URL" > /dev/null; then | ||||||||||||||||
| echo "Health check passed on attempt $i" | ||||||||||||||||
| exit 0 | ||||||||||||||||
| fi | ||||||||||||||||
| echo "Attempt $i failed, retrying in 10s..." | ||||||||||||||||
| sleep 10 | ||||||||||||||||
| done | ||||||||||||||||
| echo "Health check failed after 3 attempts" | ||||||||||||||||
| exit 1 | ||||||||||||||||
|
Comment on lines
+89
to
+158
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Refactor using a matrix strategy: jobs:
smoke:
name: ${{ matrix.label }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- label: Stable CLI (npm @latest)
app_name: cli-smoke-stable
install_from_gh_packages: false
- label: Alpha CLI (GH Packages)
app_name: cli-smoke-alpha
install_from_gh_packages: true
env:
APP_NAME: ${{ matrix.app_name }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install CLI
run: |
if [ "${{ matrix.install_from_gh_packages }}" = "true" ]; then
echo "//npm.pkg.github.com/:_authToken=${{ secrets.GH_PACKAGES_TOKEN }}" >> ~/.npmrc
echo "@uipath:registry=https://npm.pkg.github.com" >> ~/.npmrc
npm i -g @uipath/cli
else
npm i -g @uipath/cli@latest
fi
uip tools update
# ... shared Pack / Publish / Deploy / Health-check / Cleanup stepsThis also naturally handles the |
||||||||||||||||
|
|
||||||||||||||||
| notify: | ||||||||||||||||
| name: Slack Alert on Failure | ||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||
| needs: [stable-cli, alpha-cli] | ||||||||||||||||
| if: failure() || contains(needs.*.result, 'cancelled') | ||||||||||||||||
| permissions: {} | ||||||||||||||||
| steps: | ||||||||||||||||
| - name: Build failure message | ||||||||||||||||
| id: msg | ||||||||||||||||
| run: | | ||||||||||||||||
| FAILED_JOBS="" | ||||||||||||||||
| if [ "${{ needs.stable-cli.result }}" = "failure" ] || [ "${{ needs.stable-cli.result }}" = "cancelled" ]; then | ||||||||||||||||
| FAILED_JOBS="stable-cli (npm @latest)" | ||||||||||||||||
| fi | ||||||||||||||||
| if [ "${{ needs.alpha-cli.result }}" = "failure" ] || [ "${{ needs.alpha-cli.result }}" = "cancelled" ]; then | ||||||||||||||||
| [ -n "$FAILED_JOBS" ] && FAILED_JOBS="$FAILED_JOBS, " | ||||||||||||||||
| FAILED_JOBS="${FAILED_JOBS}alpha-cli (GH Packages)" | ||||||||||||||||
| fi | ||||||||||||||||
| RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||||||||||||||||
| echo "text=:red_circle: *CLI Smoke Test Failed*\nJobs: ${FAILED_JOBS}\nRun: ${RUN_URL}" >> "$GITHUB_OUTPUT" | ||||||||||||||||
|
|
||||||||||||||||
| - name: Post to Slack | ||||||||||||||||
| uses: slackapi/slack-github-action@v3 | ||||||||||||||||
Check warningCode scanning / CodeQL Unpinned tag for a non-immutable Action in workflow or composite action Medium
Unpinned 3rd party Action 'CLI Smoke Test' step
Uses Step Error loading related location Loading |
||||||||||||||||
|
|
||||||||||||||||
| with: | ||||||||||||||||
| method: chat.postMessage | ||||||||||||||||
| token: ${{ secrets.SLACK_BOT_TOKEN }} | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two problems here: 1. Secret name mismatch with the PR description The setup table in the PR description documents 2. "Gracefully skipped if missing" is not implemented The PR description says: "optional, gracefully skipped if missing". But there is no
Suggested change
(And update the setup table to list
Raina451 marked this conversation as resolved.
|
||||||||||||||||
| payload: | | ||||||||||||||||
| channel: "C0AMP09RXH7" | ||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Slack channel ID is hardcoded. Like Move it to a repository variable:
Suggested change
Then add |
||||||||||||||||
| text: "${{ steps.msg.outputs.text }}" | ||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en"> | ||
| <head><meta charset="UTF-8"><title>CLI Smoke Test</title></head> | ||
| <body><h1>cli-smoke-test</h1></body> | ||
| </html> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These three values are hardcoded in the workflow file and will be committed to git history.
ORGandTENANTexpose internal alpha-environment infrastructure details;FOLDER_KEYis a GUID that could be used to make API calls in the wrong environment if reused elsewhere.Use repository variables instead so they can be rotated/changed without a code commit: