Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Github actions: Output from one step is only accessible in the next step and not other steps

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

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading