Azure / bicep

Bicep is a declarative language for describing and deploying Azure resources
MIT License
3.17k stars 731 forks source link

'Deploy Bicep File' does not detect change in file used in loadJsonContent() #9590

Closed zoeylan closed 1 year ago

zoeylan commented 1 year ago

I have a Azure Logic app definition file called "workflow.json" and I made changes to this file. But when I tried to deploy(update) the logic app with bicep, the new changes did not be reflected to the logic app.

The bicep file is shown below. I use loadJsonContent() function in it. I found a similar github issue which is related to the loadTextContent() function: https://github.com/Azure/bicep/issues/8239

Could you please help to check if the loadJsonContent() function has same caching issue? How to fix it? Or, if we have any workaround?


param logicAppDefinition object = **loadJsonContent('../logicapps/workflow.json')**
...
resource logicApp 'Microsoft.Logic/workflows@2019-05-01' = {
  name: logicAppName
  location: location
  identity: {
    type: 'SystemAssigned'
  }
  properties: {
    state: 'Enabled'
    integrationServiceEnvironment: {
      id: integrationServiceEnvironment
    }
    definition: logicAppDefinition.definition
    parameters: {}
  }
}
alex-frankel commented 1 year ago

Can you share which version of the bicep extension you are using? I agree it seems to be the same issue as #8239.

azhyzhk commented 1 year ago

az bicep version A new Bicep release is available: v0.13.1. Upgrade now by running "az bicep upgrade". Bicep CLI version 0.8.9 (33a85174de)

azhyzhk commented 1 year ago

az bicep upgrade Installing Bicep CLI v0.13.1... Successfully installed Bicep CLI to "/root/.azure/bin/bicep".

az bicep version

Bicep CLI version 0.13.1 (e3ac80d678)

azhyzhk commented 1 year ago

No changes propagated from local workflow.json to cloud with newer version.

alex-frankel commented 1 year ago

That is the version of the CLI, but can you check the version of the VS code extension too? Since you are deploying from the VS code extension, that is the more relevant version in this case.

Screenshot 2023-01-24 at 7 31 15 AM
azhyzhk commented 1 year ago

We are not deploying from VS Code. We use Bamboo to run az cli commands:

az login --service-principal -u ${bamboo.spn_id} -p ${bamboo.spn_password} --tenant ${bamboo.tenant_id} az account set --subscription "${bamboo.subscription}" bicep restore /apps/cdmservices/${bamboo.env}/bicep/main.bicep --force az deployment group create --resource-group "${bamboo.ResourceGroup}" --template-file /apps/cdmservices/${bamboo.env}/bicep/main.bicep --parameters @/apps/cdmservices/${bamboo.env}/bicep/main.bicep.parameters.${bamboo.env}.json

Let's have an online session to get on the same page.

alex-frankel commented 1 year ago

Sure, feel free to email me at alfran@microsoft.com.

If you are deploying via CLI, then it is not related to the issue you referenced. Can you share more details so we can try to reproduce on our end? Can you share the "workflow.json" v0, the "workflow.json" v1, and the main.bicep you are using?

azhyzhk commented 1 year ago

We solved the issue by restructuring main.bicep and logicapp.bicep. Now definition of workflow is passed as a parameter from main.bicep to logicapp.bicep vs. sourced in logicapp.bicep.

alex-frankel commented 1 year ago

But it is still using loadJsonContent() in main.bicep? Would be strange for that to be working in one file, but not another. Going to close for now since you got the issue resolved.