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

Migration from ADO to Github Actions 3 #3828

Draft
wants to merge 152 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
f5b68b9
Initial separation of pipeline for onboarding to github actions for b…
PTaladay Mar 11, 2024
ff0df35
Initial file conversion with test ci pipeline
PTaladay Mar 12, 2024
adb771f
Temp workflow dispatch
PTaladay Mar 12, 2024
797788d
PR trigger for testing
PTaladay Mar 12, 2024
2cd1d0c
Added checkout to get current version of action
PTaladay Mar 12, 2024
3465ec1
Added need for checkout
PTaladay Mar 12, 2024
805e7ea
Testing semver changes
PTaladay Mar 13, 2024
d0e9b23
Moved and renamed update semver action so it gets picked up
PTaladay Mar 13, 2024
56668f0
Tweaking semver
PTaladay Mar 13, 2024
47b867c
Changing run name
PTaladay Mar 13, 2024
d3a7af5
Semver now similar to dicom
PTaladay Mar 13, 2024
3e6b90d
Removed property from semver call
PTaladay Mar 14, 2024
0314029
Removing ref as it is changing the workspace path
PTaladay Mar 14, 2024
04c3154
Simplified semver job call
PTaladay Mar 14, 2024
585c9fe
Version typo
PTaladay Mar 14, 2024
ccbc744
Wrong property in git tools
PTaladay Mar 14, 2024
a04ec61
Setup actions to create build variables to be reused
PTaladay Mar 14, 2024
5577e2a
Added setup variables
PTaladay Mar 14, 2024
aaa5027
Wrong path
PTaladay Mar 14, 2024
2ca4a4b
Added shell property
PTaladay Mar 14, 2024
abd8043
Updated clean storage accounts action. Removed setup ci build variabl…
PTaladay Mar 15, 2024
a21accd
Changing pool
PTaladay Mar 15, 2024
bc0d82b
Wrong tag
PTaladay Mar 15, 2024
7eb344a
Missing input added.
PTaladay Mar 15, 2024
d62ee55
Wrong property call
PTaladay Mar 15, 2024
4271fbe
Moved some variables to repository level due to limitations
PTaladay Mar 15, 2024
1e4f71e
property update
PTaladay Mar 15, 2024
5cc4e8d
Missing az context
PTaladay Mar 15, 2024
4dd3509
Created integration test db cleanup action
PTaladay Mar 15, 2024
77595da
Adding in build job
PTaladay Mar 15, 2024
61b45ff
Added build action.
PTaladay Mar 20, 2024
940761b
Updated variables references.
PTaladay Mar 20, 2024
3ef15c8
Working on multiple build targets
PTaladay Mar 20, 2024
5696278
Modified build targets
PTaladay Mar 20, 2024
6502ed8
Had wrong output properties for semver
PTaladay Mar 21, 2024
274c76b
Fixing output mapping
PTaladay Mar 21, 2024
1f4ccc5
Updating output of semver
PTaladay Mar 21, 2024
5c1a84b
Further output param adjustment
PTaladay Mar 21, 2024
4d09faa
Specifying unittest project to run
PTaladay Mar 21, 2024
8ec2d8a
Fixing test call
PTaladay Mar 21, 2024
08314ca
Changed property for unit test run
PTaladay Mar 21, 2024
7065e5f
REmoving solution from build command
PTaladay Mar 21, 2024
49e3fe7
Removed output directory for build since it is a solution this won't …
PTaladay Mar 21, 2024
f255ccf
Ironing out test properties
PTaladay Mar 21, 2024
5cec7ac
Removed duplicated property
PTaladay Mar 21, 2024
b5ad1fa
Removed code coverage as it does not appear to be working
PTaladay Mar 21, 2024
79f49b8
Project path update
PTaladay Mar 21, 2024
76c5808
Pathing update
PTaladay Mar 21, 2024
e77eec8
Updating path of project
PTaladay Mar 21, 2024
a860ed6
Update unit test path
PTaladay Mar 22, 2024
80d8b6b
Updating to point to sln as the wild cards are not supported
PTaladay Mar 22, 2024
b49225a
Updating test settings path
PTaladay Mar 22, 2024
006bf9f
Added test filter to only run unit tests
PTaladay Mar 22, 2024
1c1eb0a
Added SBOM task and initial artifact upload to use between jobs.
PTaladay Mar 25, 2024
723dd4f
SBOM with initial artifact upload.
PTaladay Mar 25, 2024
5b8ee3a
Attempting to parse dotnet version
PTaladay Mar 25, 2024
48e5137
Added conversion for dotnet version to use in build
PTaladay Mar 25, 2024
d660afb
Variable reference fix
PTaladay Mar 25, 2024
340b69f
Fixing reference
PTaladay Mar 25, 2024
6037a16
Variable fixing
PTaladay Mar 25, 2024
2f4445d
Trying another approach
PTaladay Mar 25, 2024
6d3ab83
Variable still not showing up in bash command
PTaladay Mar 25, 2024
896d8af
Closer
PTaladay Mar 25, 2024
9d7a126
Syntax
PTaladay Mar 25, 2024
06a3926
Removing quotes
PTaladay Mar 25, 2024
00a0f27
working on bash command
PTaladay Mar 25, 2024
bfa63a5
Updated regex
PTaladay Mar 25, 2024
102d8af
Updated build and test property
PTaladay Mar 25, 2024
deb2239
Misspelled property
PTaladay Mar 25, 2024
311bb13
Splitting packaging off to separate job so we don't create more than …
PTaladay Mar 25, 2024
e1366bf
Removing escape character
PTaladay Mar 25, 2024
8a2f526
Added condition to only run test if matrix is dotnet 8 so we don't du…
PTaladay Mar 26, 2024
401fad1
Updated SBOM path
PTaladay Mar 26, 2024
88518d3
Required package supplier
PTaladay Mar 26, 2024
9a1a946
Added package name and version to SboM
PTaladay Mar 26, 2024
cdc77ce
Merge remote-tracking branch 'origin/main' into personal/patalada/bui…
PTaladay Mar 26, 2024
3c851b5
Trying with just one dotnet version to see if badimageformatexception…
PTaladay Mar 27, 2024
bbf341d
Removing additional restore during build
PTaladay Mar 27, 2024
a5338c9
Simplifying build and test
PTaladay Mar 27, 2024
89ea790
Trying with 3.1 installed
PTaladay Mar 27, 2024
76996b8
Temporarily commenting out unit tests until I can rest of pipeline wo…
PTaladay Mar 28, 2024
c6c705c
Added checkout command before running package
PTaladay Mar 29, 2024
ee9866c
Added explicit restore for nuget packages
PTaladay Mar 29, 2024
5148fa0
Moved restore to before the artifacts pull
PTaladay Mar 29, 2024
3b9bc28
Added sln to restore call
PTaladay Mar 29, 2024
f3680f3
Updating action to v2
PTaladay Mar 29, 2024
ca5701f
dotnet restore update
PTaladay Mar 29, 2024
3f82401
Debugging restore
PTaladay Mar 29, 2024
027772f
Added working path
PTaladay Mar 29, 2024
8ba73e4
Fixed working path
PTaladay Mar 29, 2024
ba2f956
path update
PTaladay Mar 29, 2024
297aab5
Added missing parameter
PTaladay Mar 29, 2024
86d8890
Added additional needs
PTaladay Mar 29, 2024
2f86d92
Temp change to same job for build and package
PTaladay Mar 29, 2024
8cb3d42
Put in explicit path for web projects
PTaladay Apr 1, 2024
3ec269a
Explicit dotnet version package
PTaladay Apr 1, 2024
f70e55b
Used wrong dotnet version modifiers
PTaladay Apr 1, 2024
b29fa14
Updated web packaging to only target latest dotnet 8
PTaladay Apr 1, 2024
5d33dee
Testing packaging back into its own job.
PTaladay Apr 1, 2024
a7fa0ae
Remove no longer needed matrix
PTaladay Apr 1, 2024
16c0544
Migrated to primary yml file for uploads.
PTaladay Apr 2, 2024
d2c5afd
Fixed properties after moving
PTaladay Apr 2, 2024
39ced0b
Added name for each artifact upload as it was defaulting to artifact …
PTaladay Apr 2, 2024
7223fd5
Updated to copy for deploy folder.
PTaladay Apr 2, 2024
b4dc30a
Added maxcpu 1 to fix file lock issue during build.
PTaladay Apr 2, 2024
b972e59
Removing package version
PTaladay Apr 3, 2024
fb562b7
Added in docker image create and symbols publishing.
PTaladay Apr 3, 2024
f3bbcc2
Commenting out symbols for now
PTaladay Apr 3, 2024
552102e
Fixes
PTaladay Apr 4, 2024
92cbae7
Adding zip command
PTaladay Apr 4, 2024
a33d79f
Copy root docker yaml file
PTaladay Apr 4, 2024
f0c1e77
Updated docker compose and web package
PTaladay Apr 4, 2024
19727dc
Updated created docker compose file from release
PTaladay Apr 4, 2024
fe1e3a0
Updating working path for docker build
PTaladay Apr 4, 2024
deb4482
Shortening root path
PTaladay Apr 4, 2024
2cd31c5
Trying to figure out current working path during docker creation
PTaladay Apr 4, 2024
7a1b427
Docker compose path update
PTaladay Apr 4, 2024
885d2b3
Improper version format
PTaladay Apr 4, 2024
9e51b09
Updated to use our self hosted runner
PTaladay Apr 4, 2024
7d79fad
Uncommented unit tests to try again. Updated symbols copy
PTaladay Apr 4, 2024
a9103a4
Added max cpu 1 to get around file in use issues.
PTaladay Apr 5, 2024
366e477
Switched to windows runner and removed maxcpu as that was slowing thi…
PTaladay Apr 5, 2024
f6ca76b
Fixing symbols publishing
PTaladay Apr 5, 2024
9dfc420
Switching build job to windows latest runner
PTaladay Apr 5, 2024
a90cd0c
Commenting out unit tests
PTaladay Apr 5, 2024
0c35741
Adding no restore to test run
PTaladay Apr 5, 2024
56cda9c
Minor tweaks to see if that resolves file in use issue
PTaladay Apr 5, 2024
13399c2
Adding maxcpucount back in. It exponentially increases build time.
PTaladay Apr 5, 2024
00ae742
Bundling unit tests into collection to run them sequentially to preve…
PTaladay Apr 5, 2024
5da9f62
Setting BuildTimeCodeGenerator to build time dependency to try and re…
PTaladay Apr 8, 2024
a4b3bc7
Build component change
PTaladay Apr 8, 2024
f2717cc
Merge branch 'personal/patalada/buildtogithubrunner' into 114284_gith…
Apr 28, 2024
c1f13a9
- remove unused reference in test integration project
Apr 23, 2024
ed71f79
- Specify .net version for build and check version installed before …
Apr 25, 2024
6731ccc
- remove nobuild setting in dotnet test step to resolve error about f…
Apr 29, 2024
c5e21a0
- attempt build and run unit tests with .net 8 only
May 3, 2024
d48ebe1
- run web and core unit tests separately to avoid resource contention
May 3, 2024
c176059
- try a simple build action workflow
May 5, 2024
7a946cd
- adding unit tests to simple action workflow
May 5, 2024
508b8bd
- run unit tests separately
May 6, 2024
9f9292d
Revert "- run unit tests separately"
May 11, 2024
a23f880
- add create package step
May 11, 2024
565832e
- update output path for nuget packages
May 12, 2024
2cafa5d
- add env variables, update package job
May 12, 2024
e816d0e
Merge branch 'main' of https://github.com/microsoft/fhir-server into …
May 13, 2024
bf62b90
- comment out tests to try package step
May 13, 2024
ac3ba59
- adding upload nuget packages step
May 13, 2024
ad59f56
- add step to login to Azure, build docker image and push to acr
May 16, 2024
cefd58f
- remove default build version
May 19, 2024
7333e90
- update build to use .net 8.0.205
May 19, 2024
a8862c9
- set .net build to 8.0.204
May 19, 2024
8d47328
- specify .net build version to 8.0.204
May 19, 2024
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
201 changes: 201 additions & 0 deletions .github/actions/analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
parameters:
analyzeARMTemplates: true
analyzeBinaries: true
analyzePackages: true
runAntiMalware: true
credScanDirectory: '$(Build.SourcesDirectory)'

steps:
- task: UseDotNet@2
displayName: Use .NET Core sdk
inputs:
useGlobalJson: true

- ${{ if eq(parameters.analyzeBinaries, 'true') }}:
- task: DownloadBuildArtifacts@0
displayName: 'Download Binaries'
inputs:
buildType: 'current'
downloadType: 'single'
downloadPath: '$(Agent.TempDirectory)/artifacts'
artifactName: 'deploy'

- ${{ if eq(parameters.analyzePackages, 'true') }}:
- task: DownloadBuildArtifacts@0
displayName: 'Download NuGet Packages'
inputs:
buildType: 'current'
downloadType: 'single'
downloadPath: '$(Build.SourcesDirectory)/artifacts'
artifactName: 'nuget'

- ${{ if eq(parameters.analyzeBinaries, 'true') }}:
- task: ExtractFiles@1
displayName: 'Extract Stu3 Web Server Binaries'
inputs:
archiveFilePatterns: '$(Agent.TempDirectory)/artifacts/deploy/Microsoft.Health.Fhir.Stu3.Web.zip'
destinationFolder: '$(Build.SourcesDirectory)/artifacts/web/Stu3'
- task: ExtractFiles@1
displayName: 'Extract R4 Web Server Binaries'
inputs:
archiveFilePatterns: '$(Agent.TempDirectory)/artifacts/deploy/Microsoft.Health.Fhir.R4.Web.zip'
destinationFolder: '$(Build.SourcesDirectory)/artifacts/web/r4'
- task: ExtractFiles@1
displayName: 'Extract R4B Web Server Binaries'
inputs:
archiveFilePatterns: '$(Agent.TempDirectory)/artifacts/deploy/Microsoft.Health.Fhir.R4B.Web.zip'
destinationFolder: '$(Build.SourcesDirectory)/artifacts/web/r4b'
- task: ExtractFiles@1
displayName: 'Extract R5 Web Server Binaries'
inputs:
archiveFilePatterns: '$(Agent.TempDirectory)/artifacts/deploy/Microsoft.Health.Fhir.R5.Web.zip'
destinationFolder: '$(Build.SourcesDirectory)/artifacts/web/r5'

- ${{ if eq(parameters.runAntiMalware, 'true') }}:
- task: AntiMalware@4
inputs:
InputType: 'Basic'
ScanType: 'CustomScan'
FileDirPath: '$(Build.SourcesDirectory)'
EnableServices: true
TreatSignatureUpdateFailureAs: 'Standard'
SignatureFreshness: 'OneDay'
TreatStaleSignatureAs: 'Error'

- ${{ if eq(parameters.analyzeARMTemplates, 'true') }}:
- task: Armory@2
inputs:
targetDirectory: '$(Build.SourcesDirectory)/samples/templates'
targetFiles: 'f|*.json'
excludePassesFromLog: false

- task: TemplateAnalyzer@3
displayName: 'Run Template Analyzer'
inputs:
ToolVersion: Latest
AnalyzeDirectory: '$(Build.SourcesDirectory)/samples/templates'
Verbose: false
IncludeNonSecurityRules: true

- task: CredScan@3
inputs:
scanFolder: ${{ parameters.credScanDirectory }}
outputFormat: 'pre'
suppressionsFile: 'CredScanSuppressions.json'
verboseOutput: true

- task: CSRF@1
inputs:
Path: '$(Build.SourcesDirectory)'
ToolVersion: Latest

- task: Trivy@1
displayName: 'Run Trivy'
inputs:
Target: '$(Build.SourcesDirectory)/build/docker'
Severities: all
VulTypes: all

- task: PSScriptAnalyzer@1
displayName: 'Run PSScriptAnalyzer'
inputs:
Path: '$(Build.SourcesDirectory)'
Settings: required
IgnorePattern: .gdn
Recurse: true

- task: RoslynAnalyzers@3
inputs:
userProvideBuildInfo: 'msBuildInfo'
msBuildArchitecture: 'DotNetCore'
msBuildCommandline: 'dotnet build $(Build.SourcesDirectory)/Microsoft.Health.Fhir.sln --configuration $(buildConfiguration) -p:ContinuousIntegrationBuild=true -f net8.0'

- task: BinSkim@4
inputs:
toolVersion: Latest
InputType: Basic
Function: analyze
AnalyzeTargetGlob: 'f|$(Agent.TempDirectory)/artifacts/**/*Microsoft.Health.*.dll'

## PoliCheck@2 does not need to be added since it is run internally

## Tools that are no longer supported:
# AutoApplicability@1, CodeMetrics@1, VulnerabilityAssessment@0

- task: SdtReport@2
condition: succeededOrFailed()
continueOnError: True
inputs:
GdnExportAllTools: false
GdnExportGdnToolArmory: ${{ eq(parameters.analyzeARMTemplates, 'true') }}
GdnExportGdnToolCredScan: true
GdnExportGdnToolCSRF: true
GdnExportGdnToolRoslynAnalyzers: true
BinSkim: true
CredScan: true

- task: PublishSecurityAnalysisLogs@3
condition: succeededOrFailed()
continueOnError: True
inputs:
ArtifactName: 'CodeAnalysisLogs'
ArtifactType: 'Container'
AllTools: false
AntiMalware: ${{ eq(parameters.runAntiMalware, 'true') }}
APIScan: false
Armory: ${{ eq(parameters.analyzeARMTemplates, 'true') }}
Bandit: false
BinSkim: false
CodesignValidation: false
CredScan: true
CSRF: true
ESLint: false
Flawfinder: false
FortifySCA: false
FxCop: false
ModernCop: false
MSRD: false
PoliCheck: false
RoslynAnalyzers: true
SDLNativeRules: false
Semmle: false
SpotBugs: false
TSLint: false
WebScout: false
ToolLogsNotFoundAction: 'Standard'

- task: PostAnalysis@2
condition: succeededOrFailed()
inputs:
GdnBreakAllTools: false
GdnBreakGdnToolArmory: ${{ eq(parameters.analyzeARMTemplates, 'true') }}
GdnBreakGdnToolCredScan: true
GdnBreakGdnToolCSRF: true
GdnBreakGdnToolRoslynAnalyzers: true
BinSkim: true
CredScan: true

- task: TSAUpload@2
condition: and(succeeded(), eq(variables['build.sourceBranch'], 'refs/heads/main'))
displayName: 'TSA upload'
inputs:
tsaVersion: 'TsaV2'
codebase: 'NewOrUpdate'
GdnPublishTsaOnboard: false
GdnPublishTsaConfigFile: '$(Build.SourcesDirectory)\build\jobs\tsaconfig.gdntsa'
GdnPublishTsaExportedResultsPublishable: true

- task: DeleteFiles@1
displayName: 'Delete files to make space'
inputs:
SourceFolder: '$(Build.SourcesDirectory)'
Contents: '**\*'

- task: DropValidatorTask@0
displayName: 'SBOM Validator and Publisher Task'
inputs:
BuildDropPath: '$(Agent.TempDirectory)/artifacts/deploy'
OutputPath: 'output.json'
ValidateSignature: true
Verbosity: 'Verbose'
continueOnError: true
88 changes: 88 additions & 0 deletions .github/actions/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
parameters:
# Default values
unitTest: true
codeCoverage: false
componentGovernance: false
packageArtifacts: false
packageIntegrationTests: false
targetBuildFramework: ''

steps:
- task: UseDotNet@2
displayName: 'Use .NET SDK'
inputs:
useGlobalJson: true

- ${{ if eq(parameters.targetBuildFramework, '') }}:
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: build
arguments: '--configuration $(buildConfiguration) -p:ContinuousIntegrationBuild=true -p:AssemblyVersion="$(assemblySemVer)" -p:FileVersion="$(assemblySemFileVer)" -p:InformationalVersion="$(informationalVersion)" -p:Version="$(majorMinorPatch)" -warnaserror'
workingDirectory: $(System.DefaultWorkingDirectory)

- ${{ if ne(parameters.targetBuildFramework, '') }}:
- task: DotNetCoreCLI@2
displayName: 'dotnet build $(buildConfiguration)'
inputs:
command: build
arguments: '--configuration $(buildConfiguration) -p:ContinuousIntegrationBuild=true -p:AssemblyVersion="$(assemblySemVer)" -p:FileVersion="$(assemblySemFileVer)" -p:InformationalVersion="$(informationalVersion)" -p:Version="$(majorMinorPatch)" -warnaserror -f ${{parameters.targetBuildFramework}}'
workingDirectory: $(System.DefaultWorkingDirectory)

- ${{ if eq(parameters.unitTest, 'true') }}:
- task: DotNetCoreCLI@2
displayName: 'dotnet test'
inputs:
command: test
projects: '**/*UnitTests/*.csproj'
arguments: '--configuration $(buildConfiguration) --no-build -f ${{parameters.targetBuildFramework}}'
testRunTitle: 'Unit Tests'

- ${{ if eq(parameters.codeCoverage, 'true') }}:
- task: DotNetCoreCLI@2
displayName: 'dotnet test with coverage'
inputs:
command: test
projects: '**/*UnitTests/*.csproj'
arguments: '--configuration $(buildConfiguration) --no-build --collect "XPlat Code Coverage" -s "$(build.sourcesDirectory)/CodeCoverage.runsettings" -v normal -f ${{parameters.targetBuildFramework}}'
testRunTitle: 'Unit Tests'
- task: reportgenerator@5
displayName: 'aggregate code coverage'
condition: succeededOrFailed()
inputs:
reports: '$(Agent.TempDirectory)/*/coverage.cobertura.xml'
reporttypes: 'Cobertura'
targetdir: '$(Agent.TempDirectory)/coverage'
- task: PublishCodeCoverageResults@1
displayName: 'publish code coverage'
condition: succeededOrFailed()
inputs:
codeCoverageTool: 'Cobertura'
failIfCoverageEmpty: true
summaryFileLocation: '$(Agent.TempDirectory)/coverage/Cobertura.xml'
- task: PublishBuildArtifacts@1
displayName: 'publish Cobertura.xml'
inputs:
pathToPublish: '$(Agent.TempDirectory)/coverage/Cobertura.xml'
artifactName: 'IntegrationTests'
artifactType: 'container'

- ${{ if eq(parameters.packageArtifacts, 'true') }}:
# https://eng.ms/docs/cloud-ai-platform/devdiv/one-engineering-system-1es/1es-docs/secure-supply-chain/ado-sbom-generator
- task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0
displayName: 'SBOM Generation Task'
inputs:
BuildDropPath: '$(build.artifactStagingDirectory)'
BuildComponentPath: '$(Build.SourcesDirectory)'
- task: PublishBuildArtifacts@1
displayName: 'Publish SBOM Artifacts'
inputs:
pathToPublish: '$(build.artifactStagingDirectory)'
artifactName: 'deploy'
artifactType: 'container'

- ${{ if eq(parameters.packageArtifacts, 'true') }}:
- template: package.yml

- ${{ if eq(parameters.packageIntegrationTests, 'true') }}:
- template: package-integration-tests.yml
30 changes: 30 additions & 0 deletions .github/actions/clean-storage-accounts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: clean storage Accounts
description: Removes blob containers from test storage accounts

inputs:
environmentName:
description: Deployment environment name
required: true

runs:
using: 'composite'
steps:
- name: Clean Storage Accounts
uses: azure/powershell@v2
with:
azPSVersion: "latest"
inlineScript: |
$currentUtcTime = [DateTime]::UtcNow
Get-AzContext
$storageAccounts = Get-AzStorageAccount -ResourceGroupName ${{ inputs.environmentName }}
foreach ($storageAccount in $storageAccounts) {

$storageContainers = Get-AzStorageContainer -Name * -Context $storageAccount.Context
foreach ($container in $storageContainers) {
$ageDiff = $currentUtcTime - $container.CloudBlobContainer.Properties.LastModified.UtcDateTime
if($ageDiff.TotalDays -ge 3) {
Write-Host "Deleting container $($container.Name)"
$container.CloudBlobContainer.Delete()
}
}
}
25 changes: 25 additions & 0 deletions .github/actions/cleanup-integration-test-databases/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: cleanup integration test databases
description: Deletes databases used for integration tests from previous runs

inputs:
environmentName:
description: Deployment environment name
required: true

runs:
using: 'composite'
steps:
- name: Remove Integration Test Databases
uses: azure/powershell@v1
with:
azPSVersion: "latest"
inlineScript: |
Get-AzContext
$testNamePatterns = @("SNAPSHOT*","FHIRCOMPATIBILITYTEST*","FHIRINTEGRATIONTEST*","FHIRRESOURCECHANGEDISABLEDTEST*","BASE*","SNAPSHOT*")
foreach ($pattern in $testNamePatterns) {
$resources = Get-AzResource -ResourceGroupName ${{ inputs.environmentName }} -ResourceType 'Microsoft.Sql/servers/databases' -Name $pattern
foreach ($resource in $resources) {
Write-Host "Cleaning up $($resource.ResourceName)"
Remove-AzResource -ResourceId $resource.ResourceId -Force
}
}
28 changes: 28 additions & 0 deletions .github/actions/docker-add-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

parameters:
- name: sourceTag
type: string
- name: targetTag
type: string

jobs:
- job: DockerAddTag
pool:
name: '$(DefaultLinuxPool)'
vmImage: '$(LinuxVmImage)'
steps:
- task: AzureCLI@2
displayName: 'Azure CLI: InlineScript'
inputs:
azureSubscription: $(ConnectedServiceName)
scriptType: bash
scriptLocation: inlineScript
inlineScript: |
az acr login -n $(azureContainerRegistry)
for v in stu3 r4 r4b r5; do
sourceImage="$(azureContainerRegistry)/${v}_fhir-server:${{parameters.sourceTag}}"
targetImage="$(azureContainerRegistry)/${v}_fhir-server:${{parameters.targetTag}}"
docker pull $sourceImage
docker tag $sourceImage $targetImage
docker push $targetImage
done
Loading
Loading