Skip to content

update workflow#4

update workflow#4 #53

name: Build Window Packer Image
on:
push:
branches:
- cem/EDODSO-979
jobs:
install-coverity:
runs-on: self-hosted
environment: Sandbox
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Create Temp Directory
run: |
mkdir -p /tmp/temp
- name: Write license to file
run: |
if [ ! -z "${{ secrets.COVERITY_LICENSE }}" ]; then echo "${{ secrets.COVERITY_LICENSE }}" | base64 -d > /tmp/temp/license.dat; else exit 1; fi
- name: Authentication on Azure
run: |
az login --service-principal --username ${{ secrets.AZURE_CLIENT_ID }} -p="${{ secrets.AZURE_CLIENT_SECRET }}" --tenant ${{ secrets.AZURE_TENANT_ID }}
#az account set --subscription ${{ secrets.AZURE_SUBSCRIPTION_ID }}
env:
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_RESOURCE_GROUP: ${{ env.AZURE_RESOURCE_GROUP }}
VIRTUALNETWORK_RESOURCE_GROUP: ${{ env.VIRTUALNETWORK_RESOURCE_GROUP }}
VIRTUAL_NETWORK_NAME: ${{ env.VIRTUAL_NETWORK_NAME }}
VIRTUAL_SUBNET_NAME: ${{ env.VIRTUAL_SUBNET_NAME }}
AZURE_GALLERY_NAME: ${{ env.AZURE_GALLERY_NAME }}
AZURE_LOCATION: ${{ env.AZURE_LOCATION }}
- name: Install PowerShell
run: |
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo apt-add-repository https://packages.microsoft.com/ubuntu/22.04/prod
sudo apt-get update
sudo apt-get install -y powershell
- name: Run PowerShell Script
run: pwsh ./helpers/GenerateResourcesAndImage.ps1
- name: Initialise Packer template
run: |
./helpers/GenerateResourcesAndImage.sh \
--subscription-id ${{ secrets.AZURE_SUBSCRIPTION_ID }} \
--resource-group-name "ETN-ES-EAS-DEVSECOPS-PACKER" \
--image-type "Windows2022CoverityBase" \
--azure-location "East US" \
--azure-client-id ${{ secrets.AZURE_CLIENT_ID }} \
--azure-client-secret ${{ secrets.AZURE_CLIENT_SECRET }} \
--azure-tenant-id ${{ secrets.AZURE_TENANT_ID }} \
--virtual-network-name "vnet-yukon-sbx-eus" \
--virtual-network-resource-group-name "ETN-ES-Yukon-Infra-Primary" \
--virtual-network-subnet-name "AppSubnet" \
--gallery-name "etn_packer_gallery" \
--reuse-resource-group
env:
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}