Github Actions: await-task-action@v3-- server_task_id is not using value

Hello,

I am trying to finish a workflow on github actions and am having some trouble with the await-task-action@v3.

I want to check the deployment status from a previous step but every time i do i end with error: Error: Input required and not supplied: server_task_id

How am i supposed to access this value from the previous step? I did essentially exactly what is shown in the docs but i always seem to get the error. Even if i try to run an echo command and print it it shows nothing, but i can see the id is there when i fprint server_tasks

any suggestions?

relevant code is below

- name: Deploy Octopus Tenanted Release
      id: octoDeploy
      uses: OctopusDeploy/deploy-release-tenanted-action@v3
      env:
            OCTOPUS_URL: ***
            OCTOPUS_API_KEY: ****
            OCTOPUS_SPACE: 'Default'
      with: 
        project: 'Perle Web'
        release_number: ${{steps.octoRelease.outputs.release_number}}
        environment: 'Production'
        tenants: |
            perle websites
    - name: status check
      run: echo ${{steps.octoDeploy.outputs.server_tasks}}
    - name: Await task in Octopus Deploy 🐙
      id: octoTask
      uses: OctopusDeploy/await-task-action@v3
      env:
        OCTOPUS_URL: ***
        OCTOPUS_API_KEY: ***
        OCTOPUS_SPACE: 'Default'
      with:
        server_task_id: ${{steps.octoDeploy.outputs.server_tasks[0].server_task_id}}

Hi @mfalconi,

Thanks for reaching out.

The Full Marketplace Listing sometimes has a bit more information on our steps. In this case, it shows an example of server_task_id: {{ steps.some_previous_deployment_step.outputs.server_tasks[0].server_task_id }}

Listing here: Wait/watch an execution task in Octopus Deploy · Actions · GitHub Marketplace · GitHub

This would be dependent on the step being one that generates a Task ID. You can also use a normal script step in your GHA to query via the API for the task ID and use an output variable and use that in the await task. You could adapt the following script to search on the task name rather than the date and then return the task ID: OctopusDeploy-Api/FindByDate.ps1 at master · OctopusDeploy/OctopusDeploy-Api · GitHub

Can you give that a try and please let me know if it works for you or if we need to dig in more?

Best,
Jeremy

1 Like

Hey Jeremy thanks for the response I will give that a try and let you know the results.

1 Like

Hey jeremy, not sure i fully understand the example you sent. Am i supposed to capture them all and then just use the one i need?

Also I don’t understand why i can view the output when i run run: echo ${{steps.octoDeploy.outputs.server_tasks}}

but running

run: echo ${{steps.octoDeploy.outputs.server_tasks[0]}}

in the same location produces an empty response. i am very confused by this.

Hey @mfalconi,

I’m going to get more clarification from the developers that manage the GHA steps as they are coming online very soon. Hopefully, we can get back to you tonight, but if not, we will get back to you in the morning on the proper way to do this with a good example.

Please let me know if you have any questions in the meantime.

Best,
Jeremy

1 Like

Hey,

Sounds good thank you!

1 Like

Hi @mfalconi,

I was able to do some tinkering on my side and it looks like the tooltip and full marketplace listing format for that parameter is incorrect. I’ll let the developers know so they can remediate it.

Here is what worked for me:

   - name: Deploy a Release in Octopus Deploy
      id: deployrelease
        # You may pin to the exact commit or the version.
        # uses: OctopusDeploy/deploy-release-action@f738e6032178fb02033230cac2e31599d2c0cb33
      uses: OctopusDeploy/deploy-release-action@v3
      env:
         OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }}
         OCTOPUS_URL:  ${{ secrets.OCTOPUS_URL }}
         OCTOPUS_SPACE: 'JeremyM'
      with:
         project: 'StartSleep 1'
         release_number: '0.0.2'
         environments: Development
    - name: Await task in Octopus Deploy 🐙
      uses: OctopusDeploy/await-task-action@v3
      env:
          OCTOPUS_API_KEY: ${{ secrets.OCTOPUS_API_KEY }} 
          OCTOPUS_URL: ${{ secrets.OCTOPUS_URL }}
          OCTOPUS_SPACE: 'JeremyM'
      with:
          server_task_id: ${{ fromJson(steps.deployrelease.outputs.server_tasks)[0].servertaskid }}

The important part is here:
${{ fromJson(steps.deployrelease.outputs.server_tasks)[0].servertaskid }}

You can see there is the fromJson() portion, as well as it is servertaskid and not server_task_id

Can you please give that a try and let me know if it works for you as well?

Best,
Jeremy

Hey Jeremy,

Trying this now, Will let you know the result,

Thank you!

1 Like

So it worked, it was the fromJson I needed. I should have realized since i could see the response was in JSON format. Thank you so much for all the help

2 Likes

You’re very welcome! Thanks for letting me know. I wouldn’t shoulder too much blame, our marketplace listing should have the correct example :sweat_smile: .

I’m still looking into getting that updated.

Please let us know if you run into any other snags in the future!

Best,
Jeremy

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.