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

feat: amba #94

Merged
merged 82 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
1c114d9
feat: update policy definitions amba-alz flow
arjenhuitema Sep 17, 2024
98927e4
Removed all but one policy cp for testing
arjenhuitema Sep 17, 2024
8fdfc1a
fix: format command for better readability in update-amba-alz workflow
arjenhuitema Sep 17, 2024
fbcb1ec
feat: create directory for policy definitions copy in update-amba-alz…
arjenhuitema Sep 17, 2024
d9a9c62
fix: simplify directory path for policy definitions copy in update-am…
arjenhuitema Sep 17, 2024
869823b
fix: use -p flag with mkdir to create parent directories in update-am…
arjenhuitema Sep 17, 2024
d8f1e3b
fix: specify destination file for policy definitions copy in update-a…
arjenhuitema Sep 17, 2024
f62985b
fix: simplify paths for policy definitions in update-amba-alz workflow
arjenhuitema Sep 17, 2024
b0f94c9
fix: update alz_repository environment variable in update-amba-alz wo…
arjenhuitema Sep 17, 2024
17e8d08
fix: add checkout step for alz_repository in update-amba-alz workflow
arjenhuitema Sep 17, 2024
c571458
fix: comment out library policy assignments and archetypes step in up…
arjenhuitema Sep 17, 2024
5ec3186
fix: update paths for policy definitions in update-amba-alz workflow
arjenhuitema Sep 17, 2024
856445f
fix: update path for policy definitions copy in update-amba-alz workflow
arjenhuitema Sep 17, 2024
bc93b91
fix: streamline policy definitions handling in update-amba-alz workflow
arjenhuitema Sep 17, 2024
f12a118
fix: remove redundant policy definition copy commands in update-amba-…
arjenhuitema Sep 17, 2024
44876dc
fix: remove unnecessary policy definition copy commands in update-amb…
arjenhuitema Sep 17, 2024
0f6aa4d
fix: add additional policy definition copy commands in update-amba-al…
arjenhuitema Sep 17, 2024
07a472d
fix: optimize policy definitions management in update-amba-alz workflow
arjenhuitema Sep 17, 2024
c795f89
fix: add policy definition copy command for VM data disk read latency…
arjenhuitema Sep 17, 2024
4bc5d06
fix: enhance policy definition copying with matrix strategy in update…
arjenhuitema Sep 17, 2024
d2584f9
fix: add copy-policy-definitions job to update-amba-alz workflow
arjenhuitema Sep 18, 2024
a5c23eb
fix: add git status check and auto-commit for changes in update-amba-…
arjenhuitema Sep 18, 2024
759d60b
fix: configure local git settings in update-amba-alz workflow
arjenhuitema Sep 18, 2024
a476ff3
fix: refactor update-amba-alz workflow to streamline policy definitio…
arjenhuitema Sep 18, 2024
74097a7
fix: add Copy-PolicyDefinitions script to automate policy file copying
arjenhuitema Sep 18, 2024
2334dd9
fix: update policy definitions copying to use PowerShell script for i…
arjenhuitema Sep 18, 2024
d357286
fix: correct file path concatenation in Copy-PolicyDefinitions script
arjenhuitema Sep 18, 2024
0bbf985
fix: correct file path handling in Copy-PolicyDefinitions script
arjenhuitema Sep 18, 2024
a11b645
fix: correct indentation in file path handling of Copy-PolicyDefiniti…
arjenhuitema Sep 18, 2024
4014573
feat: update platform/amba-alz library (automated)
actions-user Sep 18, 2024
ebd81af
Merge pull request #9 from arjenhuitema/platform-amba-alz-33
arjenhuitema Sep 18, 2024
ac43bcf
docs: add detailed comments and parameters to Copy-PolicyDefinitions …
arjenhuitema Sep 18, 2024
5f04749
Modified script Invoke-LibraryUpdatePolicyAssignmentArchetypes.ps1 fo…
arjenhuitema Sep 18, 2024
7efea9c
feat: enable library policy assignments and archetypes update in work…
arjenhuitema Sep 18, 2024
d499fbc
fix: update remote repository reference and branch in update-amba-alz…
arjenhuitema Sep 18, 2024
34ee68c
fix: update ParserToolUrl to point to the correct CLI release
arjenhuitema Sep 18, 2024
b9189d2
fix: update ParserToolUrl to remove specific CLI version from the path
arjenhuitema Sep 18, 2024
2ade74f
fix: create parser directory if it doesn't exist before downloading
arjenhuitema Sep 18, 2024
0957af8
fix: create parser directory if it doesn't exist before downloading t…
arjenhuitema Sep 18, 2024
61f85c9
fix: update policy assignment source and target paths for amba-alz
arjenhuitema Sep 18, 2024
2dd54c6
fix: ensure parser directory is created before downloading files
arjenhuitema Sep 19, 2024
5e7f198
feat: add archetype definition files for connectivity, identity, land…
arjenhuitema Sep 19, 2024
47b748b
chore: add temporary policy assignment file for amba-alz
arjenhuitema Sep 19, 2024
6c4f59a
feat: update platform/amba-alz library (automated)
actions-user Sep 19, 2024
101ee34
Merge pull request #10 from arjenhuitema/platform-amba-alz-44
arjenhuitema Sep 19, 2024
b18a3fd
Removed temp file
arjenhuitema Sep 19, 2024
f24a1f6
feat: add script to update library policy definitions in archetype de…
arjenhuitema Sep 30, 2024
e1afbd5
feat: update platform/amba-alz library (automated)
actions-user Sep 30, 2024
40a3828
Merge pull request #11 from arjenhuitema/platform-amba-alz-52
arjenhuitema Sep 30, 2024
100f5ca
feat: remove deprecated policy definitions and update parameters in l…
arjenhuitema Oct 1, 2024
9553fb4
feat: update policy assignment script to use lowercase filenames
arjenhuitema Oct 1, 2024
28b1177
feat: convert policy assignment filenames to lowercase in library upd…
arjenhuitema Oct 1, 2024
d70fb74
feat: enhance policy assignment script to include MonitorDisable tag …
arjenhuitema Oct 1, 2024
0b24512
feat: extend policy assignment script to handle additional tags and e…
arjenhuitema Oct 1, 2024
d8c6b62
feat: update policy assignment script to handle HybridVM and improve …
arjenhuitema Oct 1, 2024
22c5bf8
feat: normalize HybridVM casing in policy assignment script
arjenhuitema Oct 1, 2024
ec8b6f5
feat: add topLevelManagementGroupPrefix parameter to library update p…
arjenhuitema Oct 1, 2024
0b02200
feat: update platform/amba-alz library (automated)
actions-user Oct 1, 2024
1da079d
Merge pull request #13 from arjenhuitema/platform-amba-alz-64
arjenhuitema Oct 1, 2024
79e41f6
feat: add AMBA-ALZ library metadata file
arjenhuitema Oct 1, 2024
893f0d4
feat: new policy default values file
arjenhuitema Oct 1, 2024
5708672
feat: add dependencies to AMBA-ALZ library metadata
arjenhuitema Nov 5, 2024
d6b6e2b
Merge branch 'main' into amba-alz-library-sync
arjenhuitema Nov 29, 2024
0043818
chore: update alz dependency reference to 2024.11.0
arjenhuitema Nov 29, 2024
6a1c3d8
chore: refine pull request message formatting in update-amba-alz work…
arjenhuitema Nov 29, 2024
6bd5a5e
feat: add platform archetype definition JSON schema
arjenhuitema Dec 3, 2024
0e5b672
feat: update platform/amba-alz library (automated)
actions-user Dec 9, 2024
af6cc79
Merge pull request #55 from arjenhuitema/platform-amba-alz-118
arjenhuitema Dec 9, 2024
db5110e
chore: update remote repository reference and branch in update-amba-a…
arjenhuitema Dec 9, 2024
dde1d65
feat: add ALZ architecture definition JSON schema
arjenhuitema Dec 9, 2024
db05150
Merge branch 'main' of https://github.com/arjenhuitema/Azure-Landing-…
arjenhuitema Dec 9, 2024
9e3634e
feat: add new AMBA archetype definitions and library metadata
arjenhuitema Dec 11, 2024
138274c
feat: update platform/amba library (automated)
actions-user Dec 11, 2024
fa53105
Merge pull request #57 from arjenhuitema/platform-amba-122
arjenhuitema Dec 11, 2024
e37cd0c
rename automated update workflow for platform/amba library
arjenhuitema Dec 11, 2024
2cb4234
feat: add new library metadata for AMBA
arjenhuitema Dec 11, 2024
72c9654
Added readme
arjenhuitema Dec 11, 2024
ef25f49
feat: update existence status for AMBA architecture definitions
arjenhuitema Dec 12, 2024
f2f666a
fix: update version number to 1.5.2 and correct policyDefinitionId fo…
arjenhuitema Dec 18, 2024
f91f6a0
fix: correct casing of evaluationPeriods
arjenhuitema Dec 18, 2024
c048aa8
fix: correct casing of evaluationPeriods
arjenhuitema Dec 18, 2024
09f6384
fix: update version numbers
arjenhuitema Dec 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
174 changes: 174 additions & 0 deletions .github/workflows/update-amba.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
---
name: update platform/amba

# yamllint disable-line rule:truthy
on:
schedule:
- cron: "0 8 * * 1-5"
workflow_dispatch: {}

permissions:
contents: write

env:
alz_repository: "Azure/Enterprise-Scale"
remote_repository: "Azure/azure-monitor-baseline-alerts"
alzlib_repository: "Azure/alzlib"
library_dir: "platform/amba"
pr_title: "feat: update platform/amba library (automated)"
pr_body: |-
This is an automated pull_request containing updates to the library templates stored in 'platform/amba'.
Please review the files changed tab to review changes.

jobs:
update-lib:
name: update
runs-on: ubuntu-latest
environment: libupdate
steps:
- name: Local repository checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: ${{ github.repository }}
fetch-depth: 0

- name: Remote repository checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: ${{ env.remote_repository }}
path: ${{ env.remote_repository }}
ref: main

- name: Alz repository checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: ${{ env.alz_repository }}
path: ${{ env.alz_repository }}
ref: main

- name: setup go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: 'stable'

- name: install alzlibtool
run: go install github.com/Azure/alzlib/cmd/alzlibtool@v0.18.0

- uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
id: generate-token
with:
app_id: ${{ secrets.TOKEN_APP_ID }}
private_key: ${{ secrets.TOKEN_APP_PRIVATE_KEY }}

- name: Configure local git
run: |
git config user.name github-actions
git config user.email action@github.com
working-directory: ${{ github.repository }}

- name: Create and checkout branch
id: branch
run: |
BRANCH="platform-amba-${{ github.run_number }}"
echo "name=$BRANCH" >> "$GITHUB_OUTPUT"
git checkout -b "$BRANCH"
working-directory: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

- name: Copy policy definitions
uses: azure/powershell@53dd145408794f7e80f97cfcca04155c85234709 # v2.0.0
with:
inlineScript: |
Write-Information "==> Running copy policy definitions script..." -InformationAction Continue
${{ github.repository }}/platform/amba/scripts/Copy-PolicyDefinitions.ps1 `
-TemplatePath "${{ github.workspace }}/${{ env.remote_repository }}/patterns/alz/templates" `
-TargetPath "${{ github.workspace }}/${{ github.repository }}/${{ env.library_dir }}/policy_definitions_copy" `
-SourcePath "${{ github.workspace }}/${{ env.remote_repository }}"
azPSVersion: "latest"

- name: Update library policy definitions
run: |
alzlibtool convert policydefinition -o \
"${{ github.workspace }}/${{ github.repository }}/${{ env.library_dir }}/policy_definitions_copy" \
"${{ github.workspace }}/${{ github.repository }}/${{ env.library_dir }}/policy_definitions"

- name: Update library policy set definitions
run: |
alzlibtool convert policysetdefinition -o \
"${{ github.workspace }}/${{ env.remote_repository }}/patterns/alz/policySetDefinitions" \
"${{ github.workspace }}/${{ github.repository }}/${{ env.library_dir }}/policy_set_definitions"

- name: Clean up copied policy definitions
run: |
rm -rf "${{ github.workspace }}/${{ github.repository }}/${{ env.library_dir }}/policy_definitions_copy"
working-directory: ${{ github.workspace }}

- name: Remove deprecated policy definitions
run: |
rm -rf "${{ github.workspace }}/${{ github.repository }}/${{ env.library_dir }}/policy_set_definitions/Alerting-LandingZone.alz_policy_set_definition.json"
working-directory: ${{ github.workspace }}

- name: Update library policy assignments and archetypes
uses: azure/powershell@53dd145408794f7e80f97cfcca04155c85234709 # v2.0.0
with:
inlineScript: |
Write-Information "==> Running policy assignments and archetypes script..." -InformationAction Continue
${{ github.repository }}/platform/amba/scripts/Invoke-LibraryUpdatePolicyAssignmentArchetypes.ps1 `
-AlzToolsPath "${{ github.workspace }}/${{ env.alz_repository }}/src/Alz.Tools/" `
-TargetPath "${{ github.workspace }}/${{ github.repository }}" `
-SourcePath "${{ github.workspace }}/${{ env.remote_repository }}"
azPSVersion: "latest"

- name: Update library policy definitions in archetype definitions
uses: azure/powershell@53dd145408794f7e80f97cfcca04155c85234709 # v2.0.0
with:
inlineScript: |
Write-Information "==> Running policy definitions in archetype definitions script..." -InformationAction Continue
${{ github.repository }}/platform/amba/scripts/Invoke-LibraryUpdatePolicyDefinitions.ps1 `
-AlzToolsPath "${{ github.workspace }}/${{ env.alz_repository }}/src/Alz.Tools/" `
-TargetPath "${{ github.workspace }}/${{ github.repository }}" `
-SourcePath "${{ github.workspace }}/${{ env.remote_repository }}"
azPSVersion: "latest"

- name: Check for changes
id: git_status
run: |
mapfile -t "CHECK_GIT_STATUS" < <(git status -s ${{ env.library_dir }})
printf "%s\n" "${CHECK_GIT_STATUS[@]}"
echo "changes=${#CHECK_GIT_STATUS[@]}" >> "$GITHUB_OUTPUT"
working-directory: ${{ github.workspace }}/${{ github.repository }}

- name: Add files, commit and push
if: steps.git_status.outputs.changes > 0
run: |
echo "Pushing changes to origin..."
git add ${{ env.library_dir }}
git commit -m '${{ env.pr_title }}'
git push origin ${{ steps.branch.outputs.name }}
working-directory: ${{ github.repository }}

- name: Create pull request
if: steps.git_status.outputs.changes > 0
id: pr
run: |
PR="$(gh pr create \
--title "${{ env.pr_title }}" \
--body "${{ env.pr_body }}" \
--base "${{ github.ref }}" \
--head "${{ steps.branch.outputs.name }}" \
--draft)"
echo "Created new PR: $CHECK_PULL_REQUEST_URL"
echo number=$(gh pr view $PR_URL --json number | jq -r '.number') >> "$GITHUB_OUTPUT"
working-directory: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}

- name: close and comment out of date prs
if: steps.git_status.outputs.changes > 0
run: |
PULL_REQUESTS=$(gh pr list --search 'feat: update platform/amba library (automated)' --json number,headRefName)
echo "$PULL_REQUESTS" | jq -r '.[] | select(.number != ${{ steps.pr.outputs.number }}) | .number' | xargs -I {} gh pr close {} --delete-branch --comment "Supersceeded by #${{ steps.pr.outputs.pull-request-number }}"
working-directory: ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
Loading
Loading