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

Accelerator Pipelines for Azure Devops #503

Merged
merged 10 commits into from
May 23, 2023
Merged

Conversation

picccard
Copy link
Contributor

Overview/Summary

Added necessary pipelines for the ALZ Bicep Accelerator feature to work with Azure Devops Pipelines.
See #479, #483, #487 and #497 for previous accelerator PRs

This PR fixes/adds/changes/removes

  1. Adds Azure Devops Pipelines in yaml

Breaking Changes

No breaking changes as this optional features of other aspects of ALZ-Bicep.

Testing Evidence

I've tested all but one pipeline, alz-bicep-4b.yml has not been tested as I don't use vWAN.

alz-bicep-1.yml

image

alz-bicep-2.yml

image

alz-bicep-3.yml

image

alz-bicep-4a.yml

image

alz-bicep-pr-1.yml

image

alz-bicep-pr-2.yml

image

As part of this Pull Request I have

@ghost ghost added the Needs: Triage 🔍 Needs triaging by the team label Apr 23, 2023
@picccard picccard marked this pull request as draft April 23, 2023 21:58
@picccard picccard marked this pull request as ready for review April 23, 2023 21:59
@picccard
Copy link
Contributor Author

@oZakari I've not played with your github workflows, but could you have a look at this?
Also see the last image, the 2nd PR pipeline runs for 15+ minutes as it lints the entire library of .json policyDefinitions, 400+ files. Would every PR have to trigger such a task or should more folders be excluded in the regex?

Lastly these AzDevops pipelines uses variables and does not follow the idea of a .env file yet.

@oZakari
Copy link
Contributor

oZakari commented Apr 24, 2023

Hi @picccard, thank you very much for your contribution! We actually haven't even launched the Accelerator officially yet (likely will go into beta this week actually), but we were planning on incorporating an Azure Pipelines option in the near future so this is awesome!

As part of the Accelerator, we also built out a PowerShell module to essentially bootstrap the pipelines and create a development framework for ALZ-Bicep. Please see my most recent PR for more details. Now that you have provided the Azure pipelines, we'll be able to start adding some user input to the module to request what platform the user would prefer. We'll probably wait at least a few weeks to make sure there are no major issues during the beta before we support additional platforms though as a heads up.

As for your question about the super-linter, I see that you have VALIDATE_ALL_CODEBASE environment variable set to false. Therefore, it should only check the files during the pr if they are new or modified. Have you created a second PR after this one to verify?

Also, for the environment variables, GitHub Actions doesn't support loading in variables from a environment variables file either. I had to take the .env file and inject the values as shown here:

- name: Import Environment Variables from File
  run: cat ${{ env.ENV_FILE }} >> $GITHUB_ENV

The PowerShell module we built creates the .env file which is why we went with this approach. Also, we should be able to mimic a similar approach with Azure Pipelines using something like this.

Overall, this looks great though and thanks again! I will be on vacation for a couple of weeks, but my team can assist in the meantime as well.

@ghost ghost removed the Needs: Author Feedback label Apr 24, 2023
@picccard
Copy link
Contributor Author

👏 The powershell module for ALZ does some handy stuff with the creation of the entire folder structure and .env file!

✨ Support for loading values from the .env into the AzDo Pipelines is now present in this PR.

I've not found any solution for the super-linter... Running it locally in an AzurePipeline means

You need to pass the RUN_LOCAL flag to bypass some of the GitHub Actions checks

The flag:RUN_LOCAL will set: VALIDATE_ALL_CODEBASE to true. This means it will scan all the files in the directory you have mapped. If you want to only validate a subset of your codebase, map a folder with only the files you wish to have linted

As a result I've added some regex to exclude the policy assignment/definition lib folder.

@oZakari
Copy link
Contributor

oZakari commented May 16, 2023

👏 The powershell module for ALZ does some handy stuff with the creation of the entire folder structure and .env file!

✨ Support for loading values from the .env into the AzDo Pipelines is now present in this PR.

I've not found any solution for the super-linter... Running it locally in an AzurePipeline means

You need to pass the RUN_LOCAL flag to bypass some of the GitHub Actions checks

The flag:RUN_LOCAL will set: VALIDATE_ALL_CODEBASE to true. This means it will scan all the files in the directory you have mapped. If you want to only validate a subset of your codebase, map a folder with only the files you wish to have linted

As a result I've added some regex to exclude the policy assignment/definition lib folder.

Awesome, thanks for adding the .env values to the pipelines!

As I'm back from vacation, I'll play around with the super-linter in Azure DevOps a bit over the next couple of days, but I think your approach makes sense. Will get back to you shortly.

@oZakari
Copy link
Contributor

oZakari commented May 22, 2023

@picccard I've created a PR against your branch

Decided the best approach would be to just remove the upstream-releases folder entireley as changes shouldn't be made in that directory anyways. Also, everything within that directory would have already been linted by the pipelines within ALZ-Bicep.

@picccard
Copy link
Contributor Author

@oZakari Good spot 😎

Copy link
Contributor

@oZakari oZakari left a comment

Choose a reason for hiding this comment

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

LGTM and thanks again @picccard

@jtracey93
Copy link
Collaborator

@oZakari do we want to do the renaming here as per #537 to save ourselves work later?

@oZakari
Copy link
Contributor

oZakari commented May 23, 2023

@jtracey93 We can just push this, and I'll make the changes for #537 for both GitHub and ADO in a separate PR for tracking.

@jtracey93 jtracey93 merged commit ba8fb09 into Azure:main May 23, 2023
@picccard picccard deleted the accelerator-azdo branch May 23, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs: Triage 🔍 Needs triaging by the team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants