bicep icon indicating copy to clipboard operation
bicep copied to clipboard

Error while deploying bicep module to container registry with GitHub actions

Open pinakighatak opened this issue 3 years ago • 6 comments

Bicep version latest as running on GitHub host agent Describe the bug When I try to register a bicep module to ACR I get error as shown below.

To Reproduce My GitHub actions

      - name: Push Bicep modules to ACR
        id: BicepTemplatesDeploy
        uses: azure/CLI@v1
        with:
          inlineScript: |
            ls -R
            az bicep publish -f ${{ env.BUILD_OUTPUT_PATH }}/modules/AzureKeyvault.bicep -t ${{steps.ACRDeploy.outputs.loginServer}}/bicepmodules/keyvault:v1

Additional context The error I get is:

ERROR: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /root/.azure/bin/bicep)
Error relocating /root/.azure/bin/bicep: __strdup: symbol not found
Error relocating /root/.azure/bin/bicep: __isnan: symbol not found
Error relocating /root/.azure/bin/bicep: __isnanf: symbol not found
Error: Error: az cli script failed.
cleaning up container...
MICROSOFT_AZURE_CLI_1657048[35](https://github.com/PinakiMSFT/DAI-bicep-privateregistry/runs/7202652229?check_suite_focus=true#step:5:36)0200_CONTAINER
(node:1657) UnhandledPromiseRejectionWarning: Error: az cli script failed.
    at /home/runner/work/_actions/azure/CLI/v1/dist/index.js:1:23964
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/_actions/azure/CLI/v1/dist/index.js:1:204[36](https://github.com/PinakiMSFT/DAI-bicep-privateregistry/runs/7202652229?check_suite_focus=true#step:5:37))
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:1657) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:1657) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

pinakighatak avatar Jul 05 '22 19:07 pinakighatak

@shenglol Any ideas? Seems possibly related to the Alpine Linux detection?

anthony-c-martin avatar Jul 05 '22 19:07 anthony-c-martin

That's odd. I wasn't able to reproduce it in a test CI run: https://github.com/shenglol/test-az-cli-bicep/runs/7436600909?check_suite_focus=true.

@pinakighatak is the issue still happening?

shenglol avatar Jul 20 '22 19:07 shenglol

That's odd. I wasn't able to reproduce it in a test CI run: https://github.com/shenglol/test-az-cli-bicep/runs/7436600909?check_suite_focus=true.

@pinakighatak is the issue still happening?

Yes. What I found is that this error occurs when using the azure/cli action but works fine if you just use the plain bash actions. It seems the Azure cli container image has the problem

pinakighatak avatar Jul 20 '22 20:07 pinakighatak

What is the OS type of the runner? Also, is the job running inside a container using the Azure CLI image?

shenglol avatar Aug 03 '22 19:08 shenglol

What is the OS type of the runner? Also, is the job running inside a container using the Azure CLI image?

I'm using Ubuntu-latest and the azure/cli action.

but it works, if I use the straight bash action.

pinakighatak avatar Aug 04 '22 15:08 pinakighatak

Bash actions works because Bicep CLI is installed on GitHub workflow runners. I don't know why the azure/cli action doesn't work since I cannot reproduce the issue, but one workaround is to run one of the following install commands with --target-platform before running bicep publish and see which one works:

  • bicep install --target-platform linux-x64
  • bicep install --target-platform linux-musl-x64

shenglol avatar Aug 04 '22 17:08 shenglol

Hi pinakighatak, this issue has been marked as stale because it was labeled as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thanks for contributing to bicep! :smile: :mechanical_arm:

ghost avatar May 24 '23 04:05 ghost