-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #317 from Azure/asset-build-changes
Azure IPAM v3.5.0 Release
- Loading branch information
Showing
23 changed files
with
1,131 additions
and
783 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Azure IPAM Release Assets | ||
|
||
run-name: Azure IPAM Assets Build & Upload | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
assets: | ||
name: Build & Upload Asset Files to Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "Job triggered by a ${{ github.event_name }} event." | ||
- run: echo "Release Tag - ${{ github.event.release.tag_name }}." | ||
|
||
- name: "Setup NodeJS v18" | ||
id: setupNode | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- name: "Setup Python v3.9" | ||
id: setupPython | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Checkout Azure IPAM Code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install NPM Packages | ||
id: installNpmPackages | ||
working-directory: ui | ||
run: | | ||
npm ci | ||
- name: Install PIP Packages | ||
id: installPipPackages | ||
working-directory: engine | ||
run: | | ||
pip install -r requirements.lock.txt --progress-bar off | ||
- name: "Create Azure IPAM ZIP Asset" | ||
id: buildZipAsset | ||
working-directory: tools | ||
shell: pwsh | ||
run: | | ||
New-Item -ItemType Directory -Name ../assets/ -Force | ||
./build.ps1 -Path ../assets/ | ||
- name: Upload Azure IPAM Release Asset | ||
id: uploadReleaseAsset | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tagName: ${{ github.event.release.tag_name }} | ||
assetPath: ./assets/ipam.zip | ||
run: | | ||
gh release upload "$tagName" "$assetPath" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,167 +1,40 @@ | ||
name: Azure IPAM Build | ||
|
||
run-name: Azure IPAM Production Build & Release | ||
run-name: Azure IPAM Container Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
release: | ||
types: [ published ] | ||
|
||
permissions: | ||
id-token: write | ||
contents: write | ||
pull-requests: read | ||
|
||
env: | ||
ACR_NAME: ${{ vars.IPAM_PROD_ACR }} | ||
|
||
jobs: | ||
version: | ||
name: Update Azure IPAM Version | ||
init: | ||
name: Initialize Azure IPAM Build | ||
runs-on: ubuntu-latest | ||
outputs: | ||
ipamVersion: ${{ steps.updateVersion.outputs.ipamVersion }} | ||
prNumber: ${{ fromJson(steps.getPullRequestData.outputs.result).number }} | ||
commitHash: ${{ steps.commitCode.outputs.commitHash }} | ||
ipamVersion: ${{ steps.extractVersion.outputs.ipamVersion }} | ||
steps: | ||
- run: echo "Job triggered by a ${{ github.event_name }} event to main." | ||
|
||
- name: "Setup NodeJS v18" | ||
id: setupNode | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18 | ||
|
||
- name: "Setup Python v3.9" | ||
id: setupPython | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: "Extract Pull Request Details" | ||
id: getPullRequestData | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
return ( | ||
await github.rest.repos.listPullRequestsAssociatedWithCommit({ | ||
commit_sha: context.sha, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}) | ||
).data[0]; | ||
- name: Checkout Azure IPAM Code | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.PAT_TOKEN }} | ||
- run: echo "Job triggered by a ${{ github.event_name }} event." | ||
- run: echo "Release Tag - ${{ github.event.release.tag_name }}." | ||
|
||
- name: Configure Git | ||
id: configureGit | ||
run: | | ||
git config --global user.name "IPAM GitHub Actions" | ||
git config --global user.email "[email protected]" | ||
- name: "Increment Azure IPAM Version" | ||
id: updateVersion | ||
working-directory: tools | ||
- name: Extract IPAM Version | ||
id: extractVersion | ||
env: | ||
prBody: ${{ fromJson(steps.getPullRequestData.outputs.result).body }} | ||
shell: pwsh | ||
run: | | ||
$version = [regex]::matches($env:prBody, '(?<=\[version:).*(?=])').value | ||
$major = $env:prBody -match '(?<=\[)major(?=])' | ||
$minor = $env:prBody -match '(?<=\[)minor(?=])' | ||
$build = $env:prBody -match '(?<=\[)build(?=])' | ||
try { | ||
$version = [System.Version]$version | ||
$newVersion = "{0}.{1}.{2}" -f $version.Major, $version.Minor, $version.Build | ||
} catch { | ||
$version = $null | ||
} | ||
if ($version) { | ||
./version.ps1 -Version $newVersion | ||
} elseif ($major) { | ||
./version.ps1 -BumpMajor | ||
} elseif ($minor) { | ||
./version.ps1 -BumpMinor | ||
} else { | ||
./version.ps1 -BumpBuild | ||
} | ||
- name: Install NPM Packages | ||
id: installNpmPackages | ||
working-directory: ui | ||
run: | | ||
npm install | ||
- name: Install PIP Packages | ||
id: installPipPackages | ||
working-directory: engine | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Freeze PIP Packages | ||
id: freezePipPackages | ||
working-directory: engine | ||
run: | | ||
echo "# Dependencies for Azure IPAM v${{ steps.updateVersion.outputs.ipamVersion }}" > requirements.lock.txt | ||
pip freeze >> requirements.lock.txt | ||
- name: "Create Azure IPAM ZIP Asset" | ||
id: buildZipAsset | ||
working-directory: tools | ||
releaseTag: ${{ github.event.release.tag_name }} | ||
shell: pwsh | ||
run: | | ||
./build.ps1 -Path ../assets/ | ||
- name: Commit Updated Azure IPAM Code | ||
id: commitCode | ||
env: | ||
prNumber: ${{ fromJson(steps.getPullRequestData.outputs.result).number }} | ||
run: | | ||
git commit -a -m "Updated Azure IPAM Version to v${{ steps.updateVersion.outputs.ipamVersion }} [skip ci]" | ||
git push | ||
echo "commitHash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | ||
release: | ||
name: Create Azure IPAM Release | ||
runs-on: ubuntu-latest | ||
needs: [ version ] | ||
steps: | ||
- name: Checkout Azure IPAM Code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.version.outputs.commitHash }} | ||
sparse-checkout: | | ||
assets | ||
- name: Publish Azure IPAM Release | ||
id: publishRelease | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tagName: v${{ needs.version.outputs.ipamVersion }} | ||
run: | | ||
gh release create "$tagName" \ | ||
--repo="$GITHUB_REPOSITORY" \ | ||
--title="$tagName" \ | ||
--notes "Azure IPAM Release" | ||
- name: Upload Azure IPAM Release Asset | ||
id: uploadReleaseAsset | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
tagName: v${{ needs.version.outputs.ipamVersion }} | ||
assetPath: ./assets/ipam.zip | ||
run: | | ||
gh release upload "$tagName" "$assetPath" | ||
$version = $env:releaseTag -replace "v", "" | ||
Write-Output "ipamVersion=$version" >> $Env:GITHUB_OUTPUT | ||
build: | ||
name: Build Azure IPAM Containers | ||
runs-on: ubuntu-latest | ||
needs: [ version, release ] | ||
needs: [ init ] | ||
steps: | ||
- name: Azure Login | ||
uses: azure/login@v2 | ||
|
@@ -174,23 +47,21 @@ jobs: | |
- name: Checkout Azure IPAM Code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.version.outputs.commitHash }} | ||
sparse-checkout: | | ||
engine | ||
ui | ||
lb | ||
- name: Build Azure IPAM Containers | ||
env: | ||
IPAM_VERSION: ${{ needs.version.outputs.ipamVersion }} | ||
IPAM_VERSION: ${{ needs.init.outputs.ipamVersion }} | ||
run: | | ||
az acr build -r $ACR_NAME -t ipam:$IPAM_VERSION -t ipam:latest -f ./Dockerfile.deb . | ||
az acr build -r $ACR_NAME -t ipamfunc:$IPAM_VERSION -t ipamfunc:latest -f ./Dockerfile.func . | ||
build-legacy: | ||
name: Build Legacy Azure IPAM Containers | ||
runs-on: ubuntu-latest | ||
needs: [ version, release ] | ||
needs: [ init ] | ||
steps: | ||
- name: Azure Login | ||
uses: azure/login@v2 | ||
|
@@ -203,15 +74,14 @@ jobs: | |
- name: Checkout Azure IPAM Code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.version.outputs.commitHash }} | ||
sparse-checkout: | | ||
engine | ||
ui | ||
lb | ||
- name: Build Legacy Azure IPAM Containers | ||
env: | ||
IPAM_VERSION: ${{ needs.version.outputs.ipamVersion }} | ||
IPAM_VERSION: ${{ needs.init.outputs.ipamVersion }} | ||
run: | | ||
az acr build -r $ACR_NAME -t ipam-engine:$IPAM_VERSION -t ipam-engine:latest -f ./engine/Dockerfile.deb ./engine | ||
az acr build -r $ACR_NAME -t ipam-func:$IPAM_VERSION -t ipam-func:latest -f ./engine/Dockerfile.func ./engine | ||
|
Oops, something went wrong.