Azure / PSRule.Rules.Azure

Rules to validate Azure resources and infrastructure as code (IaC) using PSRule.
https://azure.github.io/PSRule.Rules.Azure/
MIT License
387 stars 84 forks source link

Bicep with GitHub Actions #1002

Closed BernieWhite closed 2 years ago

BernieWhite commented 2 years ago

When using Bicep expansion using the ps-rule GitHub Action installing bicep CLI is a challenge.

The PSRule docker container is alpine and cannot access bicep CLI easily if it is installed via az CLI.

Currently a workaround by installing it into the docker container can be done by adding the following custom code, but this is not ideal.

#
# Bicep installation for PSRule
#

# Note:
# This content is set in .ps-rule/Bicep.Rule.ps1

# Install the latest Bicep CLI binary for alpine
Invoke-WebRequest -Uri 'https://github.com/Azure/bicep/releases/latest/download/bicep-linux-musl-x64' -OutFile $Env:GITHUB_WORKSPACE/bicep.bin

# Set executable
chmod +x $Env:GITHUB_WORKSPACE/bicep.bin

# Copy to PATH environment
Move-Item $Env:GITHUB_WORKSPACE/bicep.bin /usr/local/bin/bicep
BernieWhite commented 2 years ago

Duplicate #1050