Azure / login

Connect to Azure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

1.6.0 breaks when azure/client ID not known at workflow start

mhulscher opened this issue · comments

After (automatically) upgrading to 1.6.0 our workflows started breaking today.

We have a job that first reads environment data from a JSON file, which we later use in our azure/login action. This no longer works with 1.6.0 because it uses a pre: step.

      - id: settings
        name: Read settings
        uses: ActionsTools/read-json-action@main
        with:
          file_path: settings.json

      - name: Log in to Azure using OIDC
        uses: azure/login@v1
        with:
          tenant-id: ${{ fromJSON(steps.settings.outputs.environments).dev.tenant_id }}
          client-id: ${{ fromJSON(steps.settings.outputs.environments).dev.ci_spn_client_id }}
          allow-no-subscriptions: true

As a temporary workaround we now pin the action to the latest 1.5.

In my opinion this change could have warranted a major version bump.

It's another issue related to v1.6.0. Let's fix it in v1.6.1.

Hi @mhulscher,
Before using an evaluation expression, kindly verify the existence of its input. In your case, we should first check if steps.settings.outputs.environments exists, like

tenant-id: ${{ steps.settings.outputs.environments && fromJSON(steps.settings.outputs.environments).dev.tenant_id }}

This precaution can help prevent potential issues in case the previous step fails. See actions/runner#1722 (comment).

Hi @MoChilia , I expect azure/login to fail the job if one of its inputs is nil, that's totally fine.