1

I have the below github actions where i am storing the release version in manager job and using it in the deployment with manager-uat and manager-production and a weird thing is happening that i get the output current_version available in manager-uat but not in manager-production whereas i am referring to the same variable. Please can somebody suggest.

  manager:
    runs-on: ubuntu-latest
    outputs:
          CURRENT_VERSION: ${{ steps.status.outputs.CURRENT_VERSION }}
          NEED_RELEASE: ${{ steps.status.outputs.NEED_RELEASE }}
    steps:
      - uses: actions/checkout@v2
      - <more steps>

      - name: manager - Check the current version
        working-directory: .
        run: |
          echo "CURRENT_VERSION=$(python tools/check_version.py manager)" >> $GITHUB_ENV

      - id: status
        run: |
          echo "::set-output name=CURRENT_VERSION::${{ env.CURRENT_VERSION }}"
          echo "::set-output name=NEED_RELEASE::${{ env.NEED_RELEASE }}"
  manager_uat:
    needs: [manager]
    if: needs.manager.outputs.NEED_RELEASE == 'true'
    uses: ./.github/workflows/cd_mlops.yml
    secrets: inherit
    with:
      version: ${{needs.manager.outputs.CURRENT_VERSION}}
      service: manager
      envir: uat
  manager_production:
    needs: [ manager_uat ]
    if: needs.manager.outputs.NEED_RELEASE == 'true'
    uses: ./.github/workflows/cd_mlops.yml
    secrets: inherit
    with:
      version: ${{needs.manager.outputs.CURRENT_VERSION}}
      service: manager
      envir: production

1 Answer 1

1

You cannot use needs.X if X is not a direct dependency of the job.

So in your case, you need to add manager as a dependency of manager_production like so:

  manager_production:
    needs: [ manager, manager_uat ]
    if: needs.manager.outputs.NEED_RELEASE == 'true'
    uses: ./.github/workflows/cd_mlops.yml
    # ..etc
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.