Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Official Microsoft GitHub Action and Azure Pipeline task #1341

Closed
MarcusFelling opened this issue Jan 19, 2021 · 16 comments
Closed

Create Official Microsoft GitHub Action and Azure Pipeline task #1341

MarcusFelling opened this issue Jan 19, 2021 · 16 comments
Assignees
Labels
enhancement New feature or request

Comments

@MarcusFelling
Copy link
Collaborator

MarcusFelling commented Jan 19, 2021

There should be a first-class Bicep experience for GitHub Actions and Azure Pipelines. It should make it as easy as possible to build, test, and deploy a Bicep template.

Prerequisite: #858

@MarcusFelling MarcusFelling added the enhancement New feature or request label Jan 19, 2021
@MarcusFelling MarcusFelling added this to the v0.4 milestone Jan 19, 2021
@ghost ghost added the Needs: Triage 🔍 label Jan 19, 2021
@MarcusFelling MarcusFelling self-assigned this Jan 19, 2021
@MarcusFelling MarcusFelling changed the title Create Official Microsoft GitHub Action Create Official Microsoft GitHub Action and Azure Pipeline task Jan 31, 2021
@alex-frankel alex-frankel modified the milestones: v0.4, Committed Backlog Mar 8, 2021
@johnnyreilly
Copy link
Contributor

johnnyreilly commented Mar 18, 2021

Hey @MarcusFelling

Just wanted to chime in and say we're super excited about Bicep! Myself and my comrades had the opportunity to talk to @alex-frankel and @anthony-c-martin yesterday; you're all doing some amazing work! Having a first class experience for doing bicep in an Azure Pipeline is something we value highly.

Until that shimmers into being, is there advice on how we should be doing Bicep in pipelines? We happened upon this:

https://thomasthornton.cloud/2021/02/22/deploy-azure-bicep-using-azure-devops-pipelines/

Does this seem like a reasonable approach? It looks like 0.3 was released after this post. Perhaps this means that just using the az cli might work in the interim?

Just to give you an idea of what we're trying to achieve in a pipeline, it's something of this nature but for bicep:

          - task: AzureResourceManagerTemplateDeployment@3
            displayName: 'Deploy App Service ARM Template'
            inputs:
              deploymentScope: Resource Group
              azureResourceManagerConnection: $(serviceConnection)
              subscriptionId: $(subscriptionId)
              action: Create Or Update Resource Group
              resourceGroupName: $(azureResourceGroup)
              location: $(location)
              templateLocation: Linked artifact
              csmFile: 'infra/app-service/azuredeploy.json'
              deploymentMode: Incremental
              overrideParameters: >-
                -environment $(environment)
                -tags {"owner": "$(owner)", "costCenter": "$(costCenter)", "application": "$(application)", "description": "$(description)", "repo": "$(repo)"}
                -appServiceName $(appServiceName)
                -appServicePlanName $(appServicePlanName)
                -logAnalyticsWsName $(logAnalyticsWsName)
                -managedIdentityName $(managedIdentityName)
                -appInsightsName $(appInsightsName)
                -keyVaultName $(keyVaultName)
                -storageAccountName $(storageAccountName)
                -sqlServerName $(sqlServerName)
                -sqlDatabaseName $(sqlDatabaseName)

cc @jamiemccrindle

@alex-frankel
Copy link
Collaborator

I'd recommend using the Azure CLI task to deploy. As long as that task is updated to Az CLI version 2.20 or later, it will automatically install the bicep CLI when calling az deployment group create -f main.bicep.

There is an outstanding issue that may prevent this from working today, so you may need to wait until 3/23 to do this. @shenglol - will this issue affect both GitHub actions and DevOps YAML pipelines?

@johnnyreilly
Copy link
Contributor

Until the official task ships, it's possible to do what @alex-frankel suggested around using the Azure task. I've written it up here:

https://blog.johnnyreilly.com/2021/03/20/bicep-meet-azure-pipelines

@KeesV
Copy link

KeesV commented Mar 23, 2021

Just to chime in on this, we're trying to do bicep based deployments from GitHub Actions (so not Azure Pipelines), but haven't been successful thus far. The issue seems to be that the AZ CLI task in GitHub Actions (https://github.com/marketplace/actions/azure-cli-action) runs inside an Alpine based docker container. That contains musl libc, whereas the bicep binaries for linux are built against glibc.
Trying to run a bicep deployment from the AZ CLI task then results in errors like this:

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: __isnanf: symbol not found
Error relocating /root/.azure/bin/bicep: sysctl: symbol not found
Error relocating /root/.azure/bin/bicep: __isnan: symbol not found
Error relocating /root/.azure/bin/bicep: __strdup: symbol not found

I've been able to fix the first error by doing some clever symbolic linking, but haven't been able to get passed the "symbol not found" errors...
So I agree, having a first-class bicep experience in GitHub actions would be nice :).

@alex-frankel
Copy link
Collaborator

@KeesV FYI we had a known issue with Az CLI + Docker that has been resolved with Az CLI v2.21.0. More info in #1683

This is working for me now: https://github.com/alex-frankel/ignite-spring-21/blob/main/.github/workflows/jobs.yaml#L26

@KeesV
Copy link

KeesV commented Mar 24, 2021

@alex-frankel thanks for the quick reply! I can confirm that with az 2.21.0 it now works as expected. My google-fu didn't lead me to #1683 , but that's exactly the issue we had indeed.
We tried running on az 2.21.0 yesterday already, but the bicep install resulted in a 404, so that's why we switched to 2.20.0. An unfortunate series of events... Thanks again!

@thomast1906
Copy link

Thanks for referencing my original blog post, original post was written < az 2.20.0.

Have updated the post with the relevant change, az bicep build

https://thomasthornton.cloud/2021/02/22/deploy-azure-bicep-using-azure-devops-pipelines/

@thomast1906
Copy link

@MarcusFelling MarcusFelling removed their assignment May 10, 2021
@rick-roche
Copy link

Hi @MarcusFelling,

Loving the ability to use the az deployment group create -f main.bicep in Azure DevOps pipelines for simple deployments. We do however have a number of more complex deployments where we rely on the useful helper from the AzureResourceManagerTemplateDeployment task deploymentOutputs to push outputs from the templates into variables.

As a result we are currently building Bicep to ARM first and then using the task. It would be great to have Bicep support in the task for this :)

@peter-bertok
Copy link

While workarounds are usable in a pinch, they're still workarounds. First-class, official support is not just a nicety. It's currently the biggest roadblock I've personally encountered to the adoption of Bicep. Developers will nod along and agree that the benefits of Bicep sound really good, and then backpedal and say that it is "too hard" when this issue comes up.

@anthony-c-martin
Copy link
Member

Agreed, we should prioritize ease of adoption. I've put some implementation notes under microsoft/azure-pipelines-tasks#15337. I'll re-add the "needs triage" label so we discuss this in our next triage discussion.

@rshariy
Copy link

rshariy commented Jan 13, 2022

Hi team,

sorry about raising this question again, is there any progress on getting Bicep Azure Pipeline task ready?

Looks like it is not coming with the 1.0 milestone, which is quite strange as the absence of the official task is biggest stopper from Bicep adoption.

@alex-frankel
Copy link
Collaborator

Hi @rshariy -- can you clarify what is the blocking issue? We definitely are eager to update this task so that it supports Bicep files, but our understanding is that you can use the Az CLI task as an alternative for deploying bicep in a DevOps pipeline. Have you looked into this?

@JanneHarju
Copy link

JanneHarju commented Jan 13, 2022

I can confirm what @alex-frankel suggest . You can use azure cli task and run az deployment command in it using .bicep file like you use it in azure cli in your command line.

@rshariy
Copy link

rshariy commented Jan 13, 2022

@alex-frankel, yes, I can do it, but the original goal was "There should be a first-class Bicep experience for GitHub Actions and Azure Pipelines. It should make it as easy as possible to build, test, and deploy a Bicep template."

Not Az CLI nor some third-party add-ons deliver the same simple experience as native task (comparing to the ARM template deployment task in Azure DevOps).

@anthony-c-martin
Copy link
Member

Support for the AzureResourceManagerTemplateDeployment@3 DevOps task was addressed with this issue: microsoft/azure-pipelines-tasks#15337.

I'll close this issue - please use the above issue to track rollout status!

Repository owner moved this from In Review to Done in Bicep Feb 2, 2022
@ghost ghost locked as resolved and limited conversation to collaborators May 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

10 participants