Skip to content

[Feature Request] Listening for a specific job or step when waiting #97

Open
@selecsosi

Description

@selecsosi

Hi,

I have a use case for the turnstyle action where I would like it to be "intelligent" enough to listen for a specific job/step in a workflow to complete, rather than relying on the entire run to complete.

I have a proof of concept PR that I'm working on that I will link. The goal here is to take what is currently 2 workflows and combine them into a single workflow with two jobs, the first job is "turnstyled" and performs a git checkout and a gitops commit before pushing back to main. The second part of the job then will trigger a deployment job that might take 1-2 minutes depending on migrations and such.

We would like the run turnstyle, to only consider the first job (or a particular step) as the trigger to gate the action.

Example abbreviated workflow (we also might want to combine the jobs into a single job [thus wanting two new inputs]:

jobs:
  create-deployment-commit:
    runs-on: ubuntu-latest
    steps:
      # Use the turnstyle action to ensure that the checkout and commit steps are run and committed before another job
      # is allowed to run.
      - name: Turnstyle
        uses: softprops/turnstyle@v2
        with:
          # Shortening the poll interval to 10 seconds to ensure that the commit is picked up quickly (default is 60s)
          poll-interval-seconds: 10
          job-to-wait-for: "create-deployment-commit"

      - uses: actions/checkout@v4

      - name: Create GitOps Deployment Commit
        id: create-deployment-commit
        run: >
          ./scripts/deployment/createDeploymentCommit.sh
          -e ${{ inputs.environment }}
          -n ${{ inputs.serviceName }}
          -t ${{ inputs.imageTag }}
          ${{ inputs.verbose && '-v' || '' }}
          ${{ inputs.dryRun && '-d' || '' }}

  sync-argocd-dev:
    runs-on: ubuntu-latest
    steps:
      - name: Setup ArgoCD CLI
        uses: imajeetyadav/argocd-cli@v1
        with:
          version: v2.13.0
      - name: Dev Deployment for Service - ArgoCD Sync
        id: sync-argocd
        if: ${{ !inputs.dryRun }}
        env:
          # Note: ArgoCD deployed applications are prefixed with their namespace, i.e. mono-<service-name>
          ARGOCD_APP_NAME: mono-${{ inputs.serviceName }}
        run: |
          # Refresh the app to ensure the latest changes are detected.
          argocd app get "${ARGOCD_APP_NAME}" --hard-refresh \
            --argocd-context argocd.dev.company.com || exit 1
          # Sync the app to apply the changes
          argocd app sync "${ARGOCD_APP_NAME}" --prune \
            --timeout 300 \
            --argocd-context argocd.dev.company.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions