Skip to content

Commit

Permalink
remove storage account ref (#1088)
Browse files Browse the repository at this point in the history
Co-authored-by: freddydk <[email protected]>
  • Loading branch information
freddydk and freddydk authored May 24, 2024
1 parent 6a9ef0c commit 0bb71ae
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 63 deletions.
21 changes: 7 additions & 14 deletions .github/workflows/E2E.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ on:
required: false
default: 'preview'

env:
TestUpgradesFromVersion: 'v3.1'

defaults:
run:
shell: pwsh
Expand Down Expand Up @@ -57,10 +60,6 @@ jobs:
Write-Host "::Error::In order to run end to end tests, you need a Secret called adminCenterApiCredentials containing API access credentials for BC Admin Center"
$err = $true
}
if ('${{ Secrets.licenseFileUrl }}' -eq '') {
Write-Host "::Error::In order to run end to end tests, you need a Secret called licenseFileUrl containing a secure Url to a build license file"
$err = $true
}
if ($err) {
exit 1
}
Expand Down Expand Up @@ -148,7 +147,7 @@ jobs:
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "testruns=$testrunsJson"
Write-Host "testruns=$testrunsJson"
$releases = @(gh release list --repo microsoft/AL-Go | ForEach-Object { $_.split("`t")[0] })
$releases = @(gh release list --repo microsoft/AL-Go | ForEach-Object { $_.split("`t")[0] }) | Where-Object { [Version]($_.trimStart('v')) -ge [Version]("$env:TestUpgradesFromVersion".TrimStart('v')) }
$releasesJson = @{
"matrix" = @{
"include" = @($releases | ForEach-Object { @{ "Release" = $_; "type" = 'appSourceApp' }; @{ "Release" = $_; "type" = 'PTE' } } )
Expand Down Expand Up @@ -191,7 +190,7 @@ jobs:
- name: Run test
run: |
try {
. (Join-Path "." "e2eTests/scenarios/${{ matrix.scenario }}/runtest.ps1") -github -githubOwner '${{ needs.Check.outputs.githubowner }}' -repoName ${{ steps.calculateParams.outputs.repoName }} -token '${{ Secrets.E2EPAT }}' -pteTemplate '${{ needs.Check.outputs.githubowner }}/${{ needs.SetupRepositories.outputs.perTenantExtensionRepo }}' -appSourceTemplate '${{ needs.Check.outputs.githubowner }}/${{ needs.SetupRepositories.outputs.appSourceAppRepo }}' -adminCenterApiToken '${{ Secrets.adminCenterApiCredentials }}' -licenseFileUrl '${{ Secrets.licenseFileUrl }}'
. (Join-Path "." "e2eTests/scenarios/${{ matrix.scenario }}/runtest.ps1") -github -githubOwner '${{ needs.Check.outputs.githubowner }}' -repoName ${{ steps.calculateParams.outputs.repoName }} -token '${{ Secrets.E2EPAT }}' -pteTemplate '${{ needs.Check.outputs.githubowner }}/${{ needs.SetupRepositories.outputs.perTenantExtensionRepo }}' -appSourceTemplate '${{ needs.Check.outputs.githubowner }}/${{ needs.SetupRepositories.outputs.appSourceAppRepo }}' -adminCenterApiToken '${{ Secrets.adminCenterApiCredentials }}'
}
catch {
Write-Host $_.Exception.Message
Expand All @@ -215,19 +214,16 @@ jobs:
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
$adminCenterApiCredentials = ''
$licenseFileUrl = ''
if ('${{ matrix.type }}' -eq 'PTE' -and '${{ matrix.style }}' -eq 'singleProject' -and '${{ matrix.os }}' -eq 'windows') {
$adminCenterApiCredentials = '${{ Secrets.adminCenterApiCredentials }}'
}
if ('${{ matrix.type }}' -eq 'appSourceApp') {
$licenseFileUrl='${{ secrets.licenseFileUrl }}'
$template = '${{ needs.Check.outputs.githubowner }}/${{ needs.SetupRepositories.outputs.appSourceAppRepo }}'
}
else {
$template = '${{ needs.Check.outputs.githubowner }}/${{ needs.SetupRepositories.outputs.perTenantExtensionRepo }}'
}
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "adminCenterApiCredentials='$adminCenterApiCredentials'"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "licenseFileUrl='$licenseFileUrl'"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "template='$template'"
$reponame = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName())
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "repoName='$repoName'"
Expand All @@ -237,7 +233,7 @@ jobs:
- name: Run tests
run: |
try {
. (Join-Path "." "e2eTests/Test-AL-Go.ps1") -github -githubOwner '${{ needs.Check.outputs.githubowner }}' -repoName ${{ steps.calculateParams.outputs.repoName }} -token '${{ Secrets.E2EPAT }}' -template ${{ steps.calculateParams.outputs.template }} -adminCenterApiToken ${{ steps.calculateParams.outputs.adminCenterApiCredentials }} -licenseFileUrl ${{ steps.calculateParams.outputs.licenseFileUrl }} -multiProject:('${{ matrix.style }}' -eq 'multiProject') -appSource:('${{ matrix.type }}' -eq 'appSourceApp') -linux:('${{ matrix.os }}' -eq 'linux') -private:('${{ matrix.visibility }}' -eq 'private') -useCompilerFolder:('${{ matrix.Compiler }}' -eq 'CompilerFolder')
. (Join-Path "." "e2eTests/Test-AL-Go.ps1") -github -githubOwner '${{ needs.Check.outputs.githubowner }}' -repoName ${{ steps.calculateParams.outputs.repoName }} -token '${{ Secrets.E2EPAT }}' -template ${{ steps.calculateParams.outputs.template }} -adminCenterApiToken ${{ steps.calculateParams.outputs.adminCenterApiCredentials }} -multiProject:('${{ matrix.style }}' -eq 'multiProject') -appSource:('${{ matrix.type }}' -eq 'appSourceApp') -linux:('${{ matrix.os }}' -eq 'linux') -private:('${{ matrix.visibility }}' -eq 'private') -useCompilerFolder:('${{ matrix.Compiler }}' -eq 'CompilerFolder')
}
catch {
Write-Host $_.Exception.Message
Expand All @@ -261,16 +257,13 @@ jobs:
run: |
$errorActionPreference = "Stop"; $ProgressPreference = "SilentlyContinue"; Set-StrictMode -Version 2.0
if ('${{ matrix.type }}' -eq 'appSourceApp') {
$licenseFileUrl = '${{ secrets.licenseFileUrl }}'
$template = '${{ needs.Check.outputs.githubowner }}/${{ needs.SetupRepositories.outputs.appSourceAppRepo }}'
$contentPath = 'appsourceapp'
}
else {
$licenseFileUrl = ''
$template = '${{ needs.Check.outputs.githubowner }}/${{ needs.SetupRepositories.outputs.perTenantExtensionRepo }}'
$contentPath = 'pte'
}
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "licenseFileUrl='$licenseFileUrl'"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "template='$template'"
Add-Content -Encoding UTF8 -Path $env:GITHUB_OUTPUT -Value "contentPath='$contentPath'"
$reponame = [System.IO.Path]::GetFileNameWithoutExtension([System.IO.Path]::GetTempFileName())
Expand All @@ -281,7 +274,7 @@ jobs:
- name: Run tests
run: |
try {
. (Join-Path "." "e2eTests/Test-AL-Go-Upgrade.ps1") -github -githubOwner '${{ needs.Check.outputs.githubowner }}' -repoName ${{ steps.calculateParams.outputs.repoName }} -token '${{ Secrets.E2EPAT }}' -template ${{ steps.calculateParams.outputs.template }} -licenseFileUrl ${{ steps.calculateParams.outputs.licenseFileUrl }} -appSource:('${{ matrix.type }}' -eq 'appSourceApp') -release '${{ matrix.release }}' -contentPath ${{ steps.calculateParams.outputs.contentPath }}
. (Join-Path "." "e2eTests/Test-AL-Go-Upgrade.ps1") -github -githubOwner '${{ needs.Check.outputs.githubowner }}' -repoName ${{ steps.calculateParams.outputs.repoName }} -token '${{ Secrets.E2EPAT }}' -template ${{ steps.calculateParams.outputs.template }} -appSource:('${{ matrix.type }}' -eq 'appSourceApp') -release '${{ matrix.release }}' -contentPath ${{ steps.calculateParams.outputs.contentPath }}
}
catch {
Write-Host $_.Exception.Message
Expand Down
2 changes: 1 addition & 1 deletion Scenarios/SetupCiCdForExistingPTE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# #10 Set up CI/CD for an existing per-tenant extension (BingMaps)
*Prerequisites: A GitHub account.
We will use the BingMaps sample app, which can be found on GitHub in the [Business Central BingMaps.PTE repo](https://github.com/BusinessCentralApps/BingMaps.PTE). Copy the following URL (a direct download of the latest released app file from BingMaps sample) to the clipboard: [https://businesscentralapps.blob.core.windows.net/bingmaps-pte/latest/bingmaps-pte-apps.zip](https://businesscentralapps.blob.core.windows.net/bingmaps-pte/latest/bingmaps-pte-apps.zip) – you can also download the .zip file and see the content of it.
We will use the BingMaps sample app, which can be found on GitHub in the [Business Central BingMaps.PTE repo](https://github.com/microsoft/bcsamples-bingmaps.pte). Copy the URL to the Apps artifact of the latest release to the clipboard (currently [https://github.com/microsoft/bcsamples-bingmaps.pte/releases/download/24.0.0/bcsamples-bingmaps.pte-main-Apps-24.0.169.0.zip](https://github.com/microsoft/bcsamples-bingmaps.pte/releases/download/24.0.0/bcsamples-bingmaps.pte-main-Apps-24.0.169.0.zip) – you can also download the .zip file and see the content of it.

1. Navigate to [https://github.com/microsoft/AL-Go-PTE](https://github.com/microsoft/AL-Go-PTE) and then choose **Use this template**.
![Use this template](https://github.com/microsoft/AL-Go/assets/10775043/b4e32467-723d-434e-8c0a-45c6254699b4)
Expand Down
13 changes: 0 additions & 13 deletions e2eTests/Test-AL-Go-Upgrade.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Param(
[string] $contentPath = "pte",
[string] $release = "v2.2",
[string] $template = $global:pteTemplate,
[string] $licenseFileUrl = "",
[switch] $appSourceApp,
[switch] $private
)
Expand All @@ -27,7 +26,6 @@ Write-Host -ForegroundColor Yellow @'
#
# - Login
# - Create a new repository based on the selected template and the selected version
# - If (AppSource App) Create a licensefileurl secret
# - Run CI/CD workflow
# - Test that the number of workflows ran is correct and the artifacts created from CI/CD are correct and of the right version
# - Create the GHTOKENWORKFLOW secret
Expand All @@ -52,15 +50,9 @@ $releaseVersion = [System.Version]$release.Substring(1)

if ($appSourceApp) {
$orgTemplate = 'https://github.com/microsoft/al-go-appSource'
if (!$licenseFileUrl) {
throw "License file secret must be set"
}
}
else {
$orgTemplate = 'https://github.com/microsoft/al-go-pte'
if ($licenseFileUrl) {
throw "License file secret should not be set"
}
}
$template = "https://github.com/$template"

Expand Down Expand Up @@ -89,11 +81,6 @@ CommitAndPush -commitMessage "Update settings.json"
# Expected Run: CI/CD triggered on push
$runs++

# Add Existing App
if ($appSourceApp) {
SetRepositorySecret -repository $repository -name 'LICENSEFILEURL' -value $licenseFileUrl
}

# Run CI/CD and wait
$run = RunCICD -wait -branch $branch
Test-ArtifactsFromRun -runid $run.id -expectedArtifacts @{"Apps"=1;"TestApps"=1} -expectedNumberOfTests 1 -folder 'artifacts' -repoVersion '1.0' -appVersion ''
Expand Down
23 changes: 9 additions & 14 deletions e2eTests/Test-AL-Go.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Param(
[string] $token = ($Global:SecureE2EPAT | Get-PlainText),
[string] $template = $global:pteTemplate,
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText),
[string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText),
[switch] $multiProject,
[switch] $appSourceApp,
[switch] $private,
Expand All @@ -26,7 +25,6 @@ Write-Host -ForegroundColor Yellow @'
#
# - Login to GitHub
# - Create a new repository based on the selected template
# - If (AppSource App) Create a licensefileurl secret
# - Run the "Add an existing app" workflow and add an app as a Pull Request
# - Test that a Pull Request was created and merge the Pull Request
# - Run the "CI/CD" workflow
Expand Down Expand Up @@ -70,13 +68,13 @@ $repository = "$githubOwner/$repoName"
$branch = "main"

if ($appSourceApp) {
$sampleApp1 = "https://businesscentralapps.blob.core.windows.net/githubhelloworld-appsource-preview/2.0.47.0/apps.zip"
$sampleTestApp1 = "https://businesscentralapps.blob.core.windows.net/githubhelloworld-appsource-preview/2.0.47.0/testapps.zip"
$sampleApp1 = "https://github.com/BusinessCentralApps/helloworld.appsource/releases/download/2.0.0/helloworld.appsource-main-Apps-2.0.6.0.zip"
$sampleTestApp1 = "https://github.com/BusinessCentralApps/helloworld.appsource/releases/download/2.0.0/helloworld.appsource-main-TestApps-2.0.6.0.zip"
$idRange = @{ "from" = 75055000; "to" = 75056000 }
}
else {
$sampleApp1 = "https://businesscentralapps.blob.core.windows.net/githubhelloworld-preview/2.0.82.0/apps.zip"
$sampleTestApp1 = "https://businesscentralapps.blob.core.windows.net/githubhelloworld-preview/2.0.82.0/testapps.zip"
$sampleApp1 = "https://github.com/BusinessCentralApps/helloworld.pte/releases/download/2.0.0/helloworld.pte-main-Apps-2.0.5.0.zip"
$sampleTestApp1 = "https://github.com/BusinessCentralApps/helloworld.pte/releases/download/2.0.0/helloworld.pte-main-TestApps-2.0.5.0.zip"
$idRange = @{ "from" = 55000; "to" = 56000 }
}
if ($multiProject) {
Expand Down Expand Up @@ -116,9 +114,6 @@ Start-Sleep -Seconds 60
$runs = GetNumberOfRuns -repository $repository

# Add Existing App
if ($appSourceApp) {
SetRepositorySecret -repository $repository -name 'LICENSEFILEURL' -value $licenseFileUrl
}
RunAddExistingAppOrTestApp @project1Param -url $sampleApp1 -wait -directCommit -branch $branch | Out-Null
$runs++
if ($appSourceApp) {
Expand Down Expand Up @@ -168,11 +163,11 @@ if ($appSourceApp) {
"brief" = "Hello World for AppSource"
"description" = "Hello World sample app for AppSource"
"logo" = "helloworld256x240.png"
"url" = "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource"
"EULA" = "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource"
"privacyStatement" = "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource"
"help" = "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource"
"contextSensitiveHelpUrl" = "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource"
"url" = "https://github.com/BusinessCentralApps/helloworld.appsource"
"EULA" = "https://github.com/BusinessCentralApps/helloworld.appsource"
"privacyStatement" = "https://github.com/BusinessCentralApps/helloworld.appsource"
"help" = "https://github.com/BusinessCentralApps/helloworld.appsource"
"contextSensitiveHelpUrl" = "https://github.com/BusinessCentralApps/helloworld.appsource"
"features" = @( "TranslationFile" )
}
$runs++
Expand Down
10 changes: 5 additions & 5 deletions e2eTests/appsourceapp/My App/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"version": "1.0.0.0",
"brief": "Hello World for AppSource",
"description": "Hello World sample app for AppSource",
"privacyStatement": "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource",
"EULA": "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource",
"help": "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource",
"url": "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource",
"contextSensitiveHelpUrl": "https://dev.azure.com/businesscentralapps/HelloWorld.AppSource",
"privacyStatement": "https://github.com/BusinessCentralApps/helloworld.appsource",
"EULA": "https://github.com/BusinessCentralApps/helloworld.appsource",
"help": "https://github.com/BusinessCentralApps/helloworld.appsource",
"url": "https://github.com/BusinessCentralApps/helloworld.appsource",
"contextSensitiveHelpUrl": "https://github.com/BusinessCentralApps/helloworld.appsource",
"logo": "helloworld256x240.png",
"dependencies": [

Expand Down
3 changes: 1 addition & 2 deletions e2eTests/scenarios/BuildModes/runtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Param(
[string] $token = ($Global:SecureE2EPAT | Get-PlainText),
[string] $pteTemplate = $global:pteTemplate,
[string] $appSourceTemplate = $global:appSourceTemplate,
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText),
[string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText)
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText)
)

Write-Host -ForegroundColor Yellow @'
Expand Down
3 changes: 1 addition & 2 deletions e2eTests/scenarios/GitHubPackages/runtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Param(
[string] $token = ($Global:SecureE2EPAT | Get-PlainText),
[string] $pteTemplate = $global:pteTemplate,
[string] $appSourceTemplate = $global:appSourceTemplate,
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText),
[string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText)
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText)
)

Write-Host -ForegroundColor Yellow @'
Expand Down
3 changes: 1 addition & 2 deletions e2eTests/scenarios/IncludeDependencies/runtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Param(
[string] $token = ($Global:SecureE2EPAT | Get-PlainText),
[string] $pteTemplate = $global:pteTemplate,
[string] $appSourceTemplate = $global:appSourceTemplate,
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText),
[string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText)
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText)
)

Write-Host -ForegroundColor Yellow @'
Expand Down
3 changes: 1 addition & 2 deletions e2eTests/scenarios/PowerPlatform/runtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Param(
[string] $token = ($Global:SecureE2EPAT | Get-PlainText),
[string] $pteTemplate = $global:pteTemplate,
[string] $appSourceTemplate = $global:appSourceTemplate,
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText),
[string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText)
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText)
)

Write-Host -ForegroundColor Yellow @'
Expand Down
3 changes: 1 addition & 2 deletions e2eTests/scenarios/ReferenceDocumentation/runtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Param(
[string] $token = ($Global:SecureE2EPAT | Get-PlainText),
[string] $pteTemplate = $global:pteTemplate,
[string] $appSourceTemplate = $global:appSourceTemplate,
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText),
[string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText)
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText)
)

Write-Host -ForegroundColor Yellow @'
Expand Down
3 changes: 1 addition & 2 deletions e2eTests/scenarios/ReleaseBranches/runtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Param(
[string] $token = ($Global:SecureE2EPAT | Get-PlainText),
[string] $pteTemplate = $global:pteTemplate,
[string] $appSourceTemplate = $global:appSourceTemplate,
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText),
[string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText)
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText)
)

Write-Host -ForegroundColor Yellow @'
Expand Down
3 changes: 1 addition & 2 deletions e2eTests/scenarios/SpecialCharacters/runtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Param(
[string] $token = ($Global:SecureE2EPAT | Get-PlainText),
[string] $pteTemplate = $global:pteTemplate,
[string] $appSourceTemplate = $global:appSourceTemplate,
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText),
[string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText)
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText)
)

Write-Host -ForegroundColor Yellow @'
Expand Down
3 changes: 1 addition & 2 deletions e2eTests/scenarios/UseProjectDependencies/runtest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ Param(
[string] $token = ($Global:SecureE2EPAT | Get-PlainText),
[string] $pteTemplate = $global:pteTemplate,
[string] $appSourceTemplate = $global:appSourceTemplate,
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText),
[string] $licenseFileUrl = ($global:SecureLicenseFileUrl | Get-PlainText)
[string] $adminCenterApiToken = ($global:SecureAdminCenterApiToken | Get-PlainText)
)

Write-Host -ForegroundColor Yellow @'
Expand Down

0 comments on commit 0bb71ae

Please sign in to comment.