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

Environment URL #751

Merged
merged 8 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
6 changes: 4 additions & 2 deletions Actions/Deploy/Deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@ try {
throw "Authentication failed. $([environment]::Newline) $($_.exception.message)"
}

Write-Host "$($bcContainerHelperConfig.baseUrl.TrimEnd('/'))/$($bcAuthContext.tenantId)/$($deploymentSettings.EnvironmentName)/deployment/url"
$response = Invoke-RestMethod -UseBasicParsing -Method Get -Uri "$($bcContainerHelperConfig.baseUrl.TrimEnd('/'))/$($bcAuthContext.tenantId)/$($deploymentSettings.EnvironmentName)/deployment/url"
$environmentUrl = "$($bcContainerHelperConfig.baseUrl.TrimEnd('/'))/$($bcAuthContext.tenantId)/$($deploymentSettings.EnvironmentName)"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "environmentUrl=$environmentUrl"
Write-Host "EnvironmentUrl: $environmentUrl"
$response = Invoke-RestMethod -UseBasicParsing -Method Get -Uri "$environmentUrl/deployment/url"
if ($response.Status -eq "DoesNotExist") {
OutputError -message "Environment with name $($deploymentSettings.EnvironmentName) does not exist in the current authorization context."
exit
Expand Down
5 changes: 5 additions & 0 deletions Actions/Deploy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,16 @@ inputs:
deploymentEnvironmentsJson:
description: The settings for all Deployment Environments
required: true
outputs:
freddydk marked this conversation as resolved.
Show resolved Hide resolved
environmentUrl:
description: The URL of the deployed environment
value: ${{ steps.Deploy.outputs.environmentUrl }}
runs:
using: composite
steps:
- name: run
shell: ${{ inputs.shell }}
id: Deploy
env:
_token: ${{ inputs.token }}
_parentTelemetryScopeJson: ${{ inputs.parentTelemetryScopeJson }}
Expand Down
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ AL-Go for GitHub allows you to build and test using insider builds without any e
### New Settings
- `enableExternalRulesets`: set this setting to true if you want to allow AL-Go to automatically download external references in rulesets.

### Deployment
Environment URL is now displayed underneath the environment being deployed to in the build summary. For Custom Deployment, the script can set the GitHub Output variable `environmentUrl` in order to show a custom URL.

## v3.3

Expand Down
2 changes: 2 additions & 0 deletions Templates/AppSource App/.github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ jobs:
name: Deploy to ${{ matrix.environment }}
environment:
name: ${{ matrix.environment }}
url: ${{ steps.Deploy.outputs.environmentUrl }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -187,6 +188,7 @@ jobs:
getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects'

- name: Deploy
id: Deploy
uses: microsoft/AL-Go-Actions/Deploy@main
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:
name: Deploy to ${{ matrix.environment }}
environment:
name: ${{ matrix.environment }}
url: ${{ steps.Deploy.outputs.environmentUrl }}
env:
deviceCode: ${{ needs.Initialization.outputs.deviceCode }}
steps:
Expand Down Expand Up @@ -144,6 +145,7 @@ jobs:
getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects'

- name: Deploy
id: Deploy
uses: microsoft/AL-Go-Actions/Deploy@main
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
Expand Down
2 changes: 2 additions & 0 deletions Templates/Per Tenant Extension/.github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ jobs:
name: Deploy to ${{ matrix.environment }}
environment:
name: ${{ matrix.environment }}
url: ${{ steps.Deploy.outputs.environmentUrl }}
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -187,6 +188,7 @@ jobs:
getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects'

- name: Deploy
id: Deploy
uses: microsoft/AL-Go-Actions/Deploy@main
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ jobs:
name: Deploy to ${{ matrix.environment }}
environment:
name: ${{ matrix.environment }}
url: ${{ steps.Deploy.outputs.environmentUrl }}
env:
deviceCode: ${{ needs.Initialization.outputs.deviceCode }}
steps:
Expand Down Expand Up @@ -144,6 +145,7 @@ jobs:
getSecrets: '${{ steps.envName.outputs.envName }}-AuthContext,${{ steps.envName.outputs.envName }}_AuthContext,AuthContext,${{ steps.envName.outputs.envName }}-EnvironmentName,${{ steps.envName.outputs.envName }}_EnvironmentName,EnvironmentName,projects'

- name: Deploy
id: Deploy
uses: microsoft/AL-Go-Actions/Deploy@main
env:
Secrets: '${{ steps.ReadSecrets.outputs.Secrets }}'
Expand Down
1 change: 1 addition & 0 deletions Tests/Deploy.Action.Test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Describe "Deploy Action Tests" {
$permissions = [ordered]@{
}
$outputs = [ordered]@{
"environmentUrl" = "The URL of the deployed environment"
}
YamlTest -scriptRoot $scriptRoot -actionName $actionName -actionScript $actionScript -permissions $permissions -outputs $outputs
}
Expand Down
Loading