Skip to content

fix: PowerShell script set CRLF on Windows, instead of LF #4972

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

Merged
merged 8 commits into from
May 9, 2025

Conversation

ReneHezser
Copy link
Contributor

@ReneHezser ReneHezser commented Apr 2, 2025

Description

For token replacement, the bicep files are touched. On Windows, the PowerShell script takes the line ending of the OS.
This fix ignores the OS and always uses LF instead of CRLF.

Pipeline Reference

I tested on Windows and WSL Ubuntu.

Deployment Tests (both green)
https://github.com/ReneHezser/bicep-registry-modules/actions/runs/14248642871
https://github.com/ReneHezser/bicep-registry-modules/actions/runs/14248651739

Static Tests
avm.ptn.aca-lza.hosting-environment
avm.ptn.ai-platform.baseline
avm.ptn.app.container-job-toolkit.yml
avm.ptn.authorization.pim-role-assignment
avm.ptn.authorization.policy-assignment
avm.ptn.authorization.policy-exemption
avm.ptn.authorization.resource-role-assignment
avm.ptn.authorization.role-assignment
avm.ptn.authorization.role-definition
avm.ptn.azd.acr-container-app
avm.ptn.azd.aks-automatic-cluster
avm.ptn.azd.aks
avm.ptn.azd.apim-api
avm.ptn.azd.container-app-upsert
avm.ptn.azd.container-apps-stack
avm.ptn.azd.insights-dashboard
avm.ptn.azd.ml-ai-environment - Failed: Module tests / Template tests / Parameters / [azd/ml-ai-environment] All required parameters & UDTs in template file should have description that start with "(Required|Conditional).".
avm.ptn.azd.ml-hub-dependencies - Failed: WAF test
avm.ptn.azd.ml-project
avm.ptn.azd.monitoring
avm.ptn.data.private-analytical-workspace
avm.ptn.deployment-script.import-image-to-acr
avm.ptn.dev-ops.cicd-agents-and-runners - Failed: 1. Module tests / Template tests / Parameters / [dev-ops/cicd-agents-and-runners] All non-required parameters & UDTs in template file should not have description that start with "Required.". 2. Module tests / Template tests / Parameters / [dev-ops/cicd-agents-and-runners] All required parameters & UDTs in template file should have description that start with "(Required|Conditional).".
avm.ptn.finops-toolkit.finops-hub - Failed: Module tests / Template tests / Parameters / [finops-toolkit/finops-hub] All required parameters & UDTs in template file should have description that start with "(Required|Conditional).".
avm.ptn.lz.sub-vending - Failed: Module tests / Template tests / Parameters / [lz/sub-vending] Parameter & UDT names should be camel-cased (no dashes or underscores and must start with lower-case letter).
avm.ptn.mgmt-groups.subscription-placement
avm.ptn.network.hub-networking
avm.ptn.network.private-link-private-dns-zones
avm.ptn.policy-insights.remediation
avm.ptn.sa.conversation-knowledge-mining
avm.ptn.security.security-center - Failed: WAF test
avm.ptn.virtual-machine-images.azure-image-builder
avm.res.aad.domain-service
avm.res.alerts-management.action-rule
avm.res.analysis-services.server
avm.res.api-management.service
avm.res.app-configuration.configuration-store
avm.res.app.container-app
avm.res.app.job
avm.res.app.managed-environment
avm.res.app.session-pool
avm.res.automation.automation-account
avm.res.azure-stack-hci.cluster
avm.res.azure-stack-hci.logical-network
avm.res.azure-stack-hci.network-interface
avm.res.azure-stack-hci.virtual-hard-disk
avm.res.batch.batch-account
avm.res.cache.redis-enterprise
avm.res.cache.redis
avm.res.cdn.profile
avm.res.cognitive-services.account
avm.res.communication.communication-service
avm.res.communication.email-service
avm.res.compute.availability-set
avm.res.compute.disk-encryption-set
avm.res.compute.disk
avm.res.compute.gallery
avm.res.compute.image
avm.res.compute.proximity-placement-group
avm.res.compute.ssh-public-key
avm.res.compute.virtual-machine-scale-set
avm.res.compute.virtual-machine
avm.res.consumption.budget
avm.res.container-instance.container-group
avm.res.container-registry.registry
avm.res.container-service.managed-cluster
avm.res.data-factory.factory
avm.res.data-protection.backup-vault
avm.res.databricks.access-connector
avm.res.databricks.workspace
avm.res.db-for-my-sql.flexible-server
avm.res.db-for-postgre-sql.flexible-server
avm.res.desktop-virtualization.application-group
avm.res.desktop-virtualization.host-pool
avm.res.desktop-virtualization.scaling-plan
avm.res.desktop-virtualization.workspace
avm.res.dev-ops-infrastructure.pool
avm.res.dev-test-lab.lab
avm.res.digital-twins.digital-twins-instance
avm.res.document-db.database-account
avm.res.document-db.mongo-cluster
avm.res.elastic-san.elastic-san
avm.res.event-grid.domain
avm.res.event-grid.namespace
avm.res.event-grid.system-topic
avm.res.event-grid.topic
avm.res.event-hub.namespace
avm.res.fabric.capacity
avm.res.health-bot.health-bot
avm.res.healthcare-apis.workspace
avm.res.hybrid-compute.gateway
avm.res.hybrid-compute.license
avm.res.hybrid-compute.machine
avm.res.hybrid-container-service.provisioned-cluster-instance
avm.res.insights.action-group
avm.res.insights.activity-log-alert
avm.res.insights.component
avm.res.insights.data-collection-endpoint
avm.res.insights.data-collection-rule
avm.res.insights.diagnostic-setting
avm.res.insights.metric-alert
avm.res.insights.private-link-scope
avm.res.insights.scheduled-query-rule
avm.res.insights.webtest
avm.res.key-vault.vault
avm.res.kubernetes-configuration.extension
avm.res.kubernetes-configuration.flux-configuration
avm.res.kubernetes.connected-cluster
avm.res.kusto.cluster
avm.res.load-test-service.load-test
avm.res.logic.workflow
avm.res.machine-learning-services.workspace
avm.res.maintenance.configuration-assignment
avm.res.maintenance.maintenance-configuration
avm.res.managed-identity.user-assigned-identity
avm.res.managed-services.registration-definition
avm.res.management.management-group
avm.res.maps.account
avm.res.net-app.net-app-account
avm.res.network.application-gateway-web-application-firewall-policy
avm.res.network.application-gateway - Failed: WAF tests
avm.res.network.application-security-group
avm.res.network.azure-firewall
avm.res.network.bastion-host
avm.res.network.connection
avm.res.network.ddos-protection-plan
avm.res.network.dns-forwarding-ruleset
avm.res.network.dns-resolver
avm.res.network.dns-zone
avm.res.network.express-route-circuit
avm.res.network.express-route-gateway
avm.res.network.express-route-port
avm.res.network.firewall-policy
avm.res.network.front-door-web-application-firewall-policy
avm.res.network.front-door
avm.res.network.ip-group
avm.res.network.load-balancer
avm.res.network.local-network-gateway - Failed: Module tests / Readme content tests / [network/local-network-gateway] Set-ModuleReadMe script should not apply any updates.
avm.res.network.nat-gateway
avm.res.network.network-interface
avm.res.network.network-manager
avm.res.network.network-security-group
avm.res.network.network-security-perimeter
avm.res.network.network-watcher
avm.res.network.p2s-vpn-gateway
avm.res.network.private-dns-zone
avm.res.network.private-endpoint
avm.res.network.private-link-service
avm.res.network.public-ip-address
avm.res.network.public-ip-prefix
avm.res.network.route-table
avm.res.network.service-endpoint-policy
avm.res.network.trafficmanagerprofile
avm.res.network.virtual-hub
avm.res.network.virtual-network-gateway
avm.res.network.virtual-network
avm.res.network.virtual-wan
avm.res.network.vpn-gateway
avm.res.network.vpn-server-configuration
avm.res.network.vpn-site
avm.res.operational-insights.workspace
avm.res.operations-management.solution
avm.res.portal.dashboard
avm.res.power-bi-dedicated.capacity
avm.res.purview.account
avm.res.recovery-services.vault
avm.res.relay.namespace
avm.res.resource-graph.query
avm.res.resources.deployment-script
avm.res.resources.resource-group
avm.res.search.search-service
avm.res.service-bus.namespace
avm.res.service-fabric.cluster
avm.res.service-networking.traffic-controller
avm.res.signal-r-service.signal-r
avm.res.signal-r-service.web-pub-sub
avm.res.sql.instance-pool
avm.res.sql.managed-instance
avm.res.sql.server
avm.res.storage.storage-account
avm.res.synapse.private-link-hub
avm.res.synapse.workspace
avm.res.virtual-machine-images.image-template - Failed: 1. Module tests / Template tests / Parameters / [virtual-machine-images/image-template] All non-required parameters & UDTs in template file should not have description that start with "Required.". 2. Module tests / Template tests / Parameters / [virtual-machine-images/image-template] Conditional parameters' & UDT's description should contain 'Required if' followed by the condition making the parameter required.
avm.res.web.connection
avm.res.web.hosting-environment
avm.res.web.serverfarm
avm.res.web.site
avm.res.web.static-site
avm.utl.types.avm-common-types

Type of Change

  • Update to CI Environment or utilities (Non-module affecting changes)
  • Azure Verified Module updates:
    • Bugfix containing backwards-compatible bug fixes, and I have NOT bumped the MAJOR or MINOR version in version.json:
      • Someone has opened a bug report issue, and I have included "Closes #{bug_report_issue_number}" in the PR description.
      • The bug was found by the module author, and no one has opened an issue to report it yet.
    • Feature update backwards compatible feature updates, and I have bumped the MINOR version in version.json.
    • Breaking changes and I have bumped the MAJOR version in version.json.
    • Update to documentation

Checklist

  • I'm sure there are no other open Pull Requests for the same update/change
  • I have run Set-AVMModule locally to generate the supporting module files.
  • My corresponding pipelines / checks run clean and green without any errors or warnings

@ReneHezser ReneHezser requested a review from a team as a code owner April 2, 2025 12:24
@ReneHezser ReneHezser enabled auto-merge (squash) April 2, 2025 12:25
@avm-team-linter avm-team-linter bot added the Needs: Core Team 🧞 This item needs the AVM Core Team to review it label Apr 2, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Triage 🔍 Maintainers need to triage still Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue labels Apr 2, 2025
@ChrisSidebotham
Copy link
Contributor

@ReneHezser - As this will trigger all workflows please associate some test runs to this PR - We have a handy script for running this in your branch https://github.com/Azure/bicep-registry-modules/blob/main/utilities/tools/Invoke-WorkflowsForBranch.ps1

@ReneHezser
Copy link
Contributor Author

@ReneHezser - As this will trigger all workflows please associate some test runs to this PR - We have a handy script for running this in your branch https://github.com/Azure/bicep-registry-modules/blob/main/utilities/tools/Invoke-WorkflowsForBranch.ps1

The workflows don't need to run after merging this. The problem only occurs on non-linux machines for contributors. The workflows - and the current files - are not affected. The PR is to avoid issues in the future.

@eriqua
Copy link
Contributor

eriqua commented Apr 3, 2025

@ReneHezser - As this will trigger all workflows please associate some test runs to this PR - We have a handy script for running this in your branch https://github.com/Azure/bicep-registry-modules/blob/main/utilities/tools/Invoke-WorkflowsForBranch.ps1

The workflows don't need to run after merging this. The problem only occurs on non-linux machines for contributors. The workflows - and the current files - are not affected. The PR is to avoid issues in the future.

We can (should) disable triggers before merge. Nevertheless I agree we should test that any change does not impact the current environment by running all workflows on static validation and a few selected workflows on all stages

@ReneHezser
Copy link
Contributor Author

@eriqua @ChrisSidebotham I ran the static tests on all modules and deployment tests on two.

Copy link
Contributor

@eriqua eriqua left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗

@ReneHezser ReneHezser merged commit 67f029b into Azure:main May 9, 2025
4 checks passed
@ReneHezser ReneHezser deleted the fix-CRLF-in-CI branch May 12, 2025 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Core Team 🧞 This item needs the AVM Core Team to review it Needs: Triage 🔍 Maintainers need to triage still Type: AVM 🅰️ ✌️ Ⓜ️ This is an AVM related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants