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

inconsistent app deployment when action is triggered by a closed PR #17

Open
halemade opened this issue Jan 17, 2024 · 2 comments
Open

Comments

@halemade
Copy link

A customer is using this action with the following triggers:

on:
  push:
    branches: main
  pull_request:
    types:  'closed'

and when a new PR is merged into main the action is successfully triggered. However, the action does not trigger a build on Dash Enterprise. In the logs we see:

2024-01-16T16:54:06.4360432Z Requirement already satisfied: pyasn1 in /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64/lib/python3.10/site-packages (from python-jose>=3.3.0->python-keycloak>=0.27.1->de-client==1.2.1) (0.5.1)
2024-01-16T16:54:06.4364579Z Requirement already satisfied: charset-normalizer<4,>=2 in /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64/lib/python3.10/site-packages (from requests->dash>=2.6.0->de-client==1.2.1) (3.3.2)
2024-01-16T16:54:06.4368585Z Requirement already satisfied: urllib3<3,>=1.21.1 in /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64/lib/python3.10/site-packages (from requests->dash>=2.6.0->de-client==1.2.1) (2.1.0)
2024-01-16T16:54:06.4373190Z Requirement already satisfied: certifi>=2017.4.17 in /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64/lib/python3.10/site-packages (from requests->dash>=2.6.0->de-client==1.2.1) (2023.11.17)
2024-01-16T16:54:06.4465416Z Requirement already satisfied: zipp>=0.5 in /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64/lib/python3.10/site-packages (from importlib-metadata->dash>=2.6.0->de-client==1.2.1) (3.17.0)
2024-01-16T16:54:06.4479530Z Requirement already satisfied: six>=1.7.0 in /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64/lib/python3.10/site-packages (from retrying->dash>=2.6.0->de-client==1.2.1) (1.16.0)
2024-01-16T16:54:06.7805608Z ##[group]Run # If an app name is not provided, use the repository name as the app name
2024-01-16T16:54:06.7807450Z [36;1m# If an app name is not provided, use the repository name as the app name[0m
2024-01-16T16:54:06.7808819Z [36;1mif [ -z "$APP_NAME" ]; then[0m
2024-01-16T16:54:06.7809895Z [36;1m    repository="$GITHUB_REPOSITORY"[0m
2024-01-16T16:54:06.7810861Z [36;1m    APP_NAME=${repository#*/}[0m
2024-01-16T16:54:06.7811673Z [36;1mfi[0m
2024-01-16T16:54:06.7812618Z [36;1m# Add the PR number as a suffix for deploy previews[0m
2024-01-16T16:54:06.7813853Z [36;1mif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then[0m
2024-01-16T16:54:06.7814959Z [36;1m    APP_NAME=$APP_NAME-$EVENT_NUMBER[0m
2024-01-16T16:54:06.7815898Z [36;1mfi[0m
2024-01-16T16:54:06.7816637Z [36;1mecho "::set-output name=app_name::$APP_NAME"[0m
2024-01-16T16:54:06.7838429Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2024-01-16T16:54:06.7839567Z env:
2024-01-16T16:54:06.7840562Z   pythonLocation: /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64
2024-01-16T16:54:06.7842189Z   LD_LIBRARY_PATH: /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64/lib
2024-01-16T16:54:06.7843665Z   APP_NAME: ***
2024-01-16T16:54:06.7844301Z   EVENT_NUMBER: 10
2024-01-16T16:54:06.7845012Z ##[endgroup]
2024-01-16T16:54:06.7929956Z ##[warning]The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2024-01-16T16:54:06.8012444Z ##[group]Run # Create the app if it does not already exist
2024-01-16T16:54:06.8013751Z [36;1m# Create the app if it does not already exist[0m
2024-01-16T16:54:06.8014940Z [36;1mexists=$(de --no-keyfile apps exists -n $APP_NAME)[0m
2024-01-16T16:54:06.8016401Z [36;1mif [[ $exists == *"App [$APP_NAME] does not exist on [$DASH_ENTERPRISE_HOST]."* ]]; then[0m
2024-01-16T16:54:06.8017899Z [36;1m  de --no-keyfile apps create -n $APP_NAME[0m
2024-01-16T16:54:06.8018814Z [36;1mfi[0m
2024-01-16T16:54:06.8037563Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2024-01-16T16:54:06.8038679Z env:
2024-01-16T16:54:06.8039637Z   pythonLocation: /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64
2024-01-16T16:54:06.8041244Z   LD_LIBRARY_PATH: /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64/lib
2024-01-16T16:54:06.8042921Z   DASH_ENTERPRISE_HOST: ***
2024-01-16T16:54:06.8043799Z   DASH_ENTERPRISE_USERNAME: ***
2024-01-16T16:54:06.8044888Z   DASH_ENTERPRISE_PASSWORD: ***
2024-01-16T16:54:06.8045727Z   APP_NAME: ***-10
2024-01-16T16:54:06.8046375Z ##[endgroup]
2024-01-16T16:54:09.3716118Z App [***-10] was initialized on [***].
2024-01-16T16:54:09.5138109Z ##[group]Run de --no-keyfile apps delete --name ***-10
2024-01-16T16:54:09.5139049Z [36;1mde --no-keyfile apps delete --name ***-10[0m
2024-01-16T16:54:09.5160253Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2024-01-16T16:54:09.5160946Z env:
2024-01-16T16:54:09.5161602Z   pythonLocation: /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64
2024-01-16T16:54:09.5162790Z   LD_LIBRARY_PATH: /home/ubuntu/actions-runner/_work/_tool/Python/3.10.13/x64/lib
2024-01-16T16:54:09.5163738Z   DASH_ENTERPRISE_PASSWORD: ***
2024-01-16T16:54:09.5164652Z   DASH_ENTERPRISE_HOST: ***
2024-01-16T16:54:09.5165190Z   DASH_ENTERPRISE_USERNAME: ***
2024-01-16T16:54:09.5165698Z ##[endgroup]
2024-01-16T16:54:10.8797429Z App [***-10] was deleted from [***].
2024-01-16T16:54:10.9916706Z Post job cleanup.
2024-01-16T16:54:10.9974149Z Post job cleanup.
2024-01-16T16:54:11.2116892Z Cleaning up orphan processes

but when we watch the UI we don't see the appname-10 staging app come up and be deleted. The action succeeds but no deployment is triggered as far as we can tell. If we trigger the action from a manual workflow_dispatch event it will trigger a deployment. When this occurred, it is a new deployment for a previously existing app and is not occurring for all repositories.

@ndrezn
Copy link
Member

ndrezn commented Jan 22, 2024

I think this error message makes sense. It is attempting to delete the preview app on closed PR, but the app doesn't exist because the creation was never run when the PR was opened. The fix would be to update the trigger for PRs:

on:
  push:
    branches: [main]
  pull_request:
    types: ['opened', 'edited', 'synchronize', 'closed']

If there are certain jobs that are required only on closed, then the other types (opened, edited, synchronize) would need to be captured in either different Workflow file or a condition would need to be added to this file, e.g.:

jobs:
  my_job:
    runs-on: ubuntu-latest
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    steps:

@ndrezn
Copy link
Member

ndrezn commented Jan 22, 2024

@halemade does this make sense? Or are you observing something different?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants