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

Updates for GH actions runner changes #242

Merged
merged 4 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,34 @@ jobs:
uses: im-open/[email protected]
with:
deploy-key-info: ${{ env.SSH_DEPLOY_KEY_INFO }}


- name: Install PS Modules
shell: pwsh
run: |
Install-Module -Name SqlServer -Force
Install-Module -Name Az -Force
Install-Module -Name Az.Accounts -MinimumVersion 2.2.0 -Force

- name: Confirm PS Modules
shell: pwsh
run: |
$modules = @("SqlServer", "Az", "Az.Accounts")
foreach ($module in $modules) {
if (Get-Module -ListAvailable -Name $module) {
Write-Host "$module Module exists"
}
else {
Write-Host "$module Module does not exist"
}
}
mike-schenk marked this conversation as resolved.
Show resolved Hide resolved

- name: AZ Login
uses: azure/login@v1
with:
tenant-id: ${{ vars.ARM_TENANT_ID }}
subscription-id: ${{ vars.ARM_SUBSCRIPTION_ID }}
client-id: ${{ vars.ARM_CLIENT_ID }}

- name: Setup Terraform
id: setup
uses: hashicorp/[email protected]
Expand Down
32 changes: 25 additions & 7 deletions workflow-templates/im-deploy-tf-manual-apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
# production-environments: 'prod,prod-secondary' # TODO: Adjust and include the production-environments if necessary (some apps may need to add stage/stage-secondary to this list)
# default-branch: main # TODO: Update and include this arg if the default branch is not main
# workflow-summary : | # TODO: If desired, the workflow summary that is generated can be overridden by providing this custom value.

set-vars:
needs: [setup-deployment-workflow]
runs-on: ubuntu-latest # Force this to run on github-hosted runner by using a tag that does not exist on self-hosted runners
Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:

plan_results=$(echo "$plan" | grep -e "Plan:" -e "No changes." -e "# module.") # TODO: Add any unique filters required in your pipeline. IE terraform-f5 output doesn't have module. prefix.
echo "Plan Results Returned:"
echo "$plan_results "
echo "$plan_results "
if [[ -z "$plan_results" ]]; then
plan_results="Errors were found in terraform plan"
fi
Expand All @@ -263,7 +263,7 @@ jobs:
echo "current directory:"
ls -R

echo "Uploading tf plan to azure storage account ${{ needs.set-vars.outputs.STORAGE_ACCOUNT }}"
echo "Uploading tf plan to azure storage account ${{ needs.set-vars.outputs.STORAGE_ACCOUNT }}"
az storage blob upload --no-progress --auth-mode login --account-name ${{ needs.set-vars.outputs.STORAGE_ACCOUNT }} --container-name ${{ env.PLAN_STORAGE_CONTAINER }} --file $terraformPlanName --name $terraformBlobName
echo "The plan was successfully uploaded"

Expand Down Expand Up @@ -307,12 +307,30 @@ jobs:
with:
deploy-key-info: ${{ env.SSH_DEPLOY_KEY_INFO }}

- name: Install PS Modules
shell: pwsh
run: |
Install-Module -Name SqlServer -Force
Install-Module -Name Az -Force
Install-Module -Name Az.Accounts -MinimumVersion 2.2.0 -Force

- name: Confirm PS Modules
shell: pwsh
run: |
$modules = @("SqlServer", "Az", "Az.Accounts")
foreach ($module in $modules) {
if (Get-Module -ListAvailable -Name $module) {
Write-Host "$module Module exists"
}
else {
Write-Host "$module Module does not exist"
}
}

- name: AZ Login
uses: azure/login@v1
with:
# This is an org-level variable
tenant-id: ${{ vars.ARM_TENANT_ID }}
# These are env-level variables
subscription-id: ${{ vars.ARM_SUBSCRIPTION_ID }}
client-id: ${{ vars.ARM_CLIENT_ID }}

Expand Down Expand Up @@ -409,7 +427,7 @@ jobs:
uses: im-practices/.github/.github/workflows/im-reusable-finish-deployment-workflow.yml@v2
with:
# Required Inputs
deployment-environment: ${{ inputs.root-module }} # The environment/target that was deployed to (dev, qa, stage, stage-secondary, uat, demo, prod, prod-secondary)
deployment-environment: ${{ inputs.root-module }} # The environment/target that was deployed to (dev, qa, stage, stage-secondary, uat, demo, prod, prod-secondary)
gh-secrets-environment: ${{ needs.set-vars.outputs.GITHUB_SECRETS_ENVIRONMENT }} # The GitHub environment that secrets are pulled from
release-tag: ${{ inputs.branch-tag-sha }}
title-of-teams-post: 'Deploy <<PROJECT_NAME>> @${{ inputs.branch-tag-sha }} to ${{ inputs.root-module }}' # TODO: Replace <<PROJECT_NAME>> and verify title to ensure it is descriptive/readable.
Expand All @@ -434,4 +452,4 @@ jobs:
# ]
secrets:
MS_TEAMS_URI: ${{ vars.MS_TEAMS_URI }}
DEPLOY_NOTIFICATIONS_CHANNEL: ${{ vars.DEPLOY_NOTIFICATIONS_CHANNEL }}
DEPLOY_NOTIFICATIONS_CHANNEL: ${{ vars.DEPLOY_NOTIFICATIONS_CHANNEL }}