|
65 | 65 | TF_PLAN: "tfplan" |
66 | 66 | # https://github.com/hashicorp/terraform/releases |
67 | 67 | TF_VERSION: "1.7.3" |
68 | | - TF_WORKING_DIR: ./terraform-vf |
| 68 | + TF_WORKING_DIR: ./terraform |
69 | 69 | # azurerm provider oidc |
70 | 70 | # https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/service_principal_oidc |
71 | 71 | # https://developer.hashicorp.com/terraform/language/settings/backends/azurerm#oidc_request_token |
@@ -123,6 +123,12 @@ jobs: |
123 | 123 | subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }} |
124 | 124 | enable-AzPSSession: true |
125 | 125 |
|
| 126 | + # This is required when developing after the initial build, and the AKS cluster may have been stopped |
| 127 | + # Ensure AKS cluster is running, else timeouts will occur on k8s Terraform apply tasks |
| 128 | + - name: Start AKS Cluster |
| 129 | + continue-on-error: true |
| 130 | + run: ./scripts/start_aks_cluster.sh |
| 131 | + |
126 | 132 | # Prereqs |
127 | 133 | - name: Create Storage Account for Terraform state |
128 | 134 | run: ./scripts/storage_create.sh |
@@ -189,10 +195,137 @@ jobs: |
189 | 195 | env: |
190 | 196 | TF_PLAN: ${{ env.TF_PLAN }} |
191 | 197 |
|
| 198 | + # Kubernetes |
| 199 | + - name: Deploy kubernetes manifests |
| 200 | + run: ./scripts/k8s_manifests_apply.sh |
| 201 | + |
| 202 | + - name: Wait for resources to be "Ready" |
| 203 | + run: ./scripts/wait.sh |
| 204 | + |
| 205 | + # Ansible |
| 206 | + - name: Run Ansible playbook |
| 207 | + run: ./scripts/ansible.sh |
| 208 | + env: |
| 209 | + NEXUS_ADMIN_PASSWORD: ${{ secrets.NEXUS_ADMIN_PASSWORD }} |
| 210 | + NEXUS_USER_PASSWORD: ${{ secrets.NEXUS_USER_PASSWORD }} |
| 211 | + |
| 212 | + # Docker |
| 213 | + # https://github.com/Azure/docker-login |
| 214 | + - name: Docker repo login |
| 215 | + uses: Azure/docker-login@v1 |
| 216 | + with: |
| 217 | + login-server: ${{ env.DOCKER_FQDN }} |
| 218 | + username: ${{ env.NEXUS_USER_USERNAME }} |
| 219 | + password: ${{ secrets.NEXUS_USER_PASSWORD }} |
| 220 | + |
| 221 | + - name: Push images to Docker repo |
| 222 | + run: ./scripts/push_docker_images.sh |
| 223 | + |
| 224 | + # TODO: Remove once issue has been fixed |
| 225 | + - name: Fix Function App version |
| 226 | + run: pwsh -command "./scripts/Fix-FunctionApp.ps1" |
| 227 | + env: |
| 228 | + FUNCTION_APP_NAME: "${{ env.PREFIX }}-funcapp" |
| 229 | + FUNCTION_APP_RG: "${{ env.PREFIX }}-rg-aks-dev-001" |
| 230 | + |
| 231 | + # Pester tests |
| 232 | + - name: 🧪 Run Pester tests |
| 233 | + continue-on-error: true |
| 234 | + run: pwsh -command "./scripts/Start-Test.ps1" |
| 235 | + |
| 236 | + # https://github.com/actions/upload-artifact |
| 237 | + - name: Archive test artifacts |
| 238 | + uses: actions/upload-artifact@v3 |
| 239 | + with: |
| 240 | + name: test-results |
| 241 | + path: test/pester-test-results.xml |
| 242 | + if: always() |
| 243 | + |
| 244 | + # remove NuGet proxy repo so pester report step doesnt fail |
| 245 | + - name: Unregister NuGet proxy repo |
| 246 | + run: pwsh -command "Unregister-PSRepository -Name nuget.org-proxy -Verbose" |
| 247 | + |
| 248 | + # Shows at the bottom of a run: https://github.com/adamrushuk/devops-lab/runs/1035347513?check_suite_focus=true |
| 249 | + # https://github.com/zyborg/pester-tests-report |
| 250 | + # - name: Pester report |
| 251 | + # uses: zyborg/pester-tests-report@v1 |
| 252 | + # with: |
| 253 | + # test_results_path: test/pester-test-results.xml |
| 254 | + # report_name: pester_tests |
| 255 | + # report_title: Pester Tests |
| 256 | + # github_token: ${{ secrets.GITHUB_TOKEN }} |
| 257 | + |
| 258 | + # - uses: dorny/test-reporter@v1.6.0 |
| 259 | + # with: |
| 260 | + # # artifact: test-results # artifact name |
| 261 | + # name: Pester Tests Results # Name of the check run which will be created |
| 262 | + # path: 'test/pester-test-results.xml' # Path to test results (inside artifact .zip) |
| 263 | + # reporter: java-junit # Format of test results |
| 264 | + |
192 | 265 | # Notify |
193 | 266 | - name: Notify slack |
194 | 267 | continue-on-error: true |
195 | 268 | env: |
196 | 269 | SLACK_CHANNEL_ID: ${{ secrets.SLACK_CHANNEL_ID }} |
197 | 270 | SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |
198 | 271 | run: ./scripts/send_slack_message.sh "[devops-lab] Build complete" |
| 272 | + |
| 273 | + # used for any windows-only tasks |
| 274 | + test-windows: |
| 275 | + needs: build-and-deploy |
| 276 | + |
| 277 | + # https://github.com/actions/runner-images?tab=readme-ov-file#available-images |
| 278 | + runs-on: windows-2022 |
| 279 | + |
| 280 | + # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idenvironment |
| 281 | + environment: |
| 282 | + name: dev |
| 283 | + |
| 284 | + # only run if owner triggered action |
| 285 | + if: github.actor == github.event.repository.owner.login |
| 286 | + |
| 287 | + steps: |
| 288 | + # Checkout |
| 289 | + - uses: actions/checkout@v4 |
| 290 | + |
| 291 | + # Init tasks - inc Env var concatenation |
| 292 | + # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#environment-files |
| 293 | + - name: Init tasks - inc Env var concatenation (Workaround) |
| 294 | + # * NOTE: different syntax required for Windows agents |
| 295 | + run: | |
| 296 | + echo "AKS_RG_NAME=${{ env.PREFIX }}-rg-aks-dev-001" | Out-File -Append -Encoding utf8 -FilePath "$env:GITHUB_ENV" |
| 297 | + echo "AKS_CLUSTER_NAME=${{ env.PREFIX }}-aks-001" | Out-File -Append -Encoding utf8 -FilePath "$env:GITHUB_ENV" |
| 298 | + echo "DNS_DOMAIN_NAME=nexus.${{ env.ROOT_DOMAIN_NAME }}" | Out-File -Append -Encoding utf8 -FilePath "$env:GITHUB_ENV" |
| 299 | +
|
| 300 | + # Login |
| 301 | + # https://github.com/Azure/login |
| 302 | + - name: Login via OIDC to Azure Public Cloud (az cli and az powershell) |
| 303 | + uses: azure/login@v1 |
| 304 | + with: |
| 305 | + client-id: ${{ secrets.ARM_CLIENT_ID }} |
| 306 | + tenant-id: ${{ secrets.ARM_TENANT_ID }} |
| 307 | + subscription-id: ${{ secrets.ARM_SUBSCRIPTION_ID }} |
| 308 | + enable-AzPSSession: true |
| 309 | + |
| 310 | + # Chocolatey |
| 311 | + - name: Test Nexus Chocolatey proxy repo |
| 312 | + run: | |
| 313 | + choco install velero --source "https://${{ env.DNS_DOMAIN_NAME }}/repository/chocolatey-proxy/" |
| 314 | +
|
| 315 | + # Velero CLI |
| 316 | + - name: Test Velero CLI |
| 317 | + # NOTE: Some functions cast values to a string to perform comparisons |
| 318 | + # https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#functions |
| 319 | + # ! WARNING: only single quotes work for boolean comparison |
| 320 | + if: env.VELERO_ENABLED == 'true' |
| 321 | + run: | |
| 322 | + az aks get-credentials --resource-group "${{ env.AKS_RG_NAME }}" --name "${{ env.AKS_CLUSTER_NAME }}" --overwrite-existing --admin |
| 323 | +
|
| 324 | + echo "`nVelero version info:" |
| 325 | + velero version || true |
| 326 | +
|
| 327 | + echo "`nVelero backup location info:" |
| 328 | + velero backup-location get |
| 329 | +
|
| 330 | + echo "`nVelero backup info:" |
| 331 | + velero backup get |
0 commit comments