Skip to content

Commit

Permalink
Merge
Browse files Browse the repository at this point in the history
  • Loading branch information
terjebra committed Nov 6, 2024
2 parents 580ec41 + d045ddd commit 686d6b0
Show file tree
Hide file tree
Showing 49 changed files with 862 additions and 363 deletions.
16 changes: 16 additions & 0 deletions infrastructure/arm/environment.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,22 @@
"maxDeliveryCount": 2
}
},
{
"type": "Microsoft.ServiceBus/namespaces/queues",
"apiVersion": "2017-04-01",
"name": "[concat(variables('sb-name'), '/scheduled-weekly-project-report')]",
"location": "North Europe",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', variables('sb-name'))]"
],
"properties": {
"maxSizeInMegabytes": 1024,
"duplicateDetectionHistoryTimeWindow": "P1D",
"defaultMessageTimeToLive": "PT1H",
"deadLetteringOnMessageExpiration": true,
"maxDeliveryCount": 2
}
},

/* SECRETS */
{
Expand Down
103 changes: 63 additions & 40 deletions pipelines/api-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ resources:

variables:
imageTag: $(Build.BuildNumber)
fusionAcr: 'fusioncr.azurecr.io'
imageRepo: resources/fusion-resouces-api
fusionAcr: 'crfsharedhostingall.azurecr.io'
imageRepo: fra/resouces-api
imageName: $(imageRepo):$(imageTag)
subscriptionServiceNonProd: 'FRA Automation Non-Prod'
subscriptionServiceProd: 'FRA Automation Prod'
deploymentManifest: '$(Pipeline.Workspace)/k8s-deployment/deployment-test-env.yml'
deploymentManifestFolder: '$(Pipeline.Workspace)/k8s-deployment'
fullImageName: $(fusionAcr)/$(imageName)
dbTagPrefix: resources

Expand All @@ -38,19 +38,15 @@ stages:
- job: BuildImage
steps:
- task: Docker@2
displayName: Login to fusioncr
displayName: 'Build docker image'
inputs:
command: login
containerRegistry: fusioncr
- template: templates/docker-buildx.yml@infra
parameters:
containerRegistry: 'fusion-aks-cr'
repository: $(imageRepo)
command: 'buildAndPush'
buildContext: ./src/backend
dockerfile: src/backend/api/Fusion.Resources.Api/Dockerfile
dockerPush: true
disableCache: true
tags: |
$(imageTag)
dockerfile: ./src/backend/api/Fusion.Resources.Api/Dockerfile
tags: $(imageTag)

- template: templates/docker-buildx.yml@infra
parameters:
initBuilderInstance: false
Expand All @@ -60,14 +56,14 @@ stages:
arguments: |
--target=export
--output=type=local,dest=$(Build.ArtifactStagingDirectory)
--cache-from=type=registry,ref=fusioncachecr.azurecr.io/$(imageRepo):$(imageTag)
--cache-from=type=registry,ref=crfsharedhostingall.azurecr.io/$(imageRepo):$(imageTag)
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: 'src/backend/api/Fusion.Resources.Api/Deployment/k8s'
Contents: |
deployment-test-env.yml
deployment-*.yml
TargetFolder: '$(Build.ArtifactStagingDirectory)'

- publish: $(Build.ArtifactStagingDirectory)
Expand All @@ -81,10 +77,11 @@ stages:
envName: 'ci'
fusionEnvironment: 'ci'
clientId: '5a842df8-3238-415d-b168-9f16a6a6031b'
aks-namespace: 'fusion-resource-allocation-ci'

jobs:
- deployment: DeployCI
environment: fusion-ci.fusion-resources-app-ci
environment: fusion-ci
strategy:
runOnce:
deploy:
Expand Down Expand Up @@ -113,23 +110,26 @@ stages:
variableName: envKeyVaultUrl
azureSubscription: $(subscriptionServiceNonProd)


- template: templates/replace-tokens.yml
parameters:
targetFiles: '$(deploymentManifest)'
targetFiles: $(deploymentManifestFolder)/*.yml

- template: templates/execute-sql-migration.yml
parameters:
artifact: 'k8s-deployment'
environment: $(envName)
azureSubscription: $(subscriptionServiceNonProd)
dbTagPrefix: $(dbTagPrefix)
dbTagPrefix: $(dbTagPrefix)

- task: KubernetesManifest@0
- task: KubernetesManifest@1
displayName: Deploy to Kubernetes cluster
inputs:
kubernetesServiceConnection: fra-k8s-ci
namespace: $(aks-namespace)
action: deploy
manifests: $(deploymentManifest)
manifests: |
$(deploymentManifestFolder)/deployment-service.yml
$(deploymentManifestFolder)/deployment-ingress-test.yml
- stage: DeployFQA
displayName: 'Deploy to FQA'
Expand All @@ -139,10 +139,11 @@ stages:
envName: 'fqa'
fusionEnvironment: 'fqa'
clientId: '5a842df8-3238-415d-b168-9f16a6a6031b'
aks-namespace: 'fusion-resource-allocation-fqa'

jobs:
- deployment: DeployFQA
environment: fusion-fqa.fusion-resources-app-fqa
environment: fusion-fqa
strategy:
runOnce:
deploy:
Expand Down Expand Up @@ -172,20 +173,24 @@ stages:

- template: templates/replace-tokens.yml
parameters:
targetFiles: '$(deploymentManifest)'
targetFiles: $(deploymentManifestFolder)/*.yml

- template: templates/execute-sql-migration.yml
parameters:
artifact: 'k8s-deployment'
environment: $(envName)
azureSubscription: $(subscriptionServiceNonProd)
dbTagPrefix: $(dbTagPrefix)
- task: KubernetesManifest@0

- task: KubernetesManifest@1
displayName: Deploy to Kubernetes cluster
inputs:
kubernetesServiceConnection: fra-k8s-fqa
namespace: $(aks-namespace)
action: deploy
manifests: $(deploymentManifest)
manifests: |
$(deploymentManifestFolder)/deployment-service.yml
$(deploymentManifestFolder)/deployment-ingress-test.yml
- stage: DeployFPRD
displayName: 'Deploy to FPRD'
Expand All @@ -195,10 +200,11 @@ stages:
envName: 'fprd'
fusionEnvironment: 'fprd'
clientId: '97978493-9777-4d48-b38a-67b0b9cd88d2'
aks-namespace: 'fusion-resource-allocation-prod'

jobs:
- deployment: DeployFPRD
environment: fusion-prod.fusion-resources-app-fprd
environment: fusion-prod
strategy:
runOnce:
deploy:
Expand Down Expand Up @@ -228,7 +234,7 @@ stages:

- template: templates/replace-tokens.yml
parameters:
targetFiles: '$(deploymentManifest)'
targetFiles: $(deploymentManifestFolder)/*.yml

- template: templates/execute-sql-migration.yml
parameters:
Expand All @@ -237,19 +243,31 @@ stages:
azureSubscription: $(subscriptionServiceProd)
dbTagPrefix: $(dbTagPrefix)

- task: KubernetesManifest@0
- task: KubernetesManifest@1
displayName: Deploy to Kubernetes cluster
inputs:
kubernetesServiceConnection: fra-k8s-prod
namespace: $(aks-namespace)
action: deploy
manifests: $(deploymentManifest)
manifests: |
$(deploymentManifestFolder)/deployment-service.yml
$(deploymentManifestFolder)/deployment-ingress-prod.yml
- template: templates/deploy-container-app.yml
parameters:
## Must check out code to get deployment file
- checkout: self
- task: AzurePowerShell@5
displayName: 'Deploy ARM template'
inputs:
azureSubscription: $(subscriptionServiceProd)
environment: $(envName)
fusionEnvironment: $(fusionEnvironment)
clientId: $(clientId)
imageName: $(fullImageName)
ScriptType: FilePath
FailOnStandardError: true
azurePowerShellVersion: 'LatestVersion'
ScriptPath: src/backend/api/Fusion.Resources.Api/Deployment/deploy-webapp.ps1
ScriptArguments: >
-environment $(envName)
-clientId $(clientId)
-fusionEnvironment $(fusionEnvironment)
-imageName $(fullImageName)
- stage: DeployTR
displayName: 'Deploy to TR'
Expand All @@ -259,10 +277,11 @@ stages:
envName: 'tr'
fusionEnvironment: 'tr'
clientId: '5a842df8-3238-415d-b168-9f16a6a6031b'
aks-namespace: 'fusion-resource-allocation-tr'

jobs:
- deployment: DeployTR
environment: fusion-tr.fusion-resources-app-tr
environment: fusion-tr
strategy:
runOnce:
deploy:
Expand Down Expand Up @@ -292,7 +311,7 @@ stages:

- template: templates/replace-tokens.yml
parameters:
targetFiles: '$(deploymentManifest)'
targetFiles: $(deploymentManifestFolder)/*.yml

- template: templates/execute-sql-migration.yml
parameters:
Expand All @@ -302,8 +321,12 @@ stages:

dbTagPrefix: $(dbTagPrefix)

- task: KubernetesManifest@0
- task: KubernetesManifest@1
displayName: Deploy to Kubernetes cluster
inputs:
kubernetesServiceConnection: fra-k8s-tr
namespace: $(aks-namespace)
action: deploy
manifests: $(deploymentManifest)
manifests: |
$(deploymentManifestFolder)/deployment-service.yml
$(deploymentManifestFolder)/deployment-ingress-test.yml
47 changes: 20 additions & 27 deletions pipelines/api-pr-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ resources:

variables:
prNumber: $(System.PullRequest.PullRequestNumber)
fusionAcr: 'fusioncr.azurecr.io'
imageRepo: resources/fusion-resouces-api
fusionAcr: 'crfsharedhostingall.azurecr.io'
imageRepo: fra/resouces-api-pr
imageName: $(imageRepo):$(prNumber)
subscriptionService: 'FRA Automation Non-Prod'
subscriptionServiceCore: PROJECT_PORTAL (63b791ae-b2bc-41a1-ac66-806c4e69bffe)
deploymentManifest: '$(Pipeline.Workspace)/k8s-deployment/deployment-pr-env.yml'
deploymentManifest: '$(Pipeline.Workspace)/k8s-deployment/pr-deployment-env.yml'
fullImageName: $(fusionAcr)/$(imageName)
buildNr: $(Build.BuildNumber)

Expand All @@ -34,28 +34,17 @@ stages:
jobs:
- job: BuildImage
steps:

- task: Docker@2
displayName: Login to fusioncr
inputs:
command: login
containerRegistry: fusioncr
- task: Docker@2
displayName: Login to fusioncachecr
displayName: 'Build docker image'
inputs:
command: login
containerRegistry: fusioncachecr
- template: templates/docker-buildx.yml@infra
parameters:
containerRegistry: 'fusion-aks-cr'
repository: $(imageRepo)
command: buildAndPush
buildContext: ./src/backend
dockerfile: src/backend/api/Fusion.Resources.Api/Dockerfile
dockerPush: true
cacheFrom: |
latest
cacheTo: |
$(prNumber)
tags: |
$(prNumber)
dockerfile: ./src/backend/api/Fusion.Resources.Api/Dockerfile
tags: $(prNumber)

- template: templates/docker-buildx.yml@infra
parameters:
initBuilderInstance: false
Expand All @@ -65,13 +54,14 @@ stages:
arguments: |
--target=export
--output=type=local,dest=$(Build.ArtifactStagingDirectory)
--cache-from=type=registry,ref=fusioncachecr.azurecr.io/$(imageRepo):$(prNumber)
--cache-from=type=registry,ref=crfsharedhostingall.azurecr.io/$(imageRepo):$(prNumber)
- task: CopyFiles@2
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
inputs:
SourceFolder: 'src/backend/api/Fusion.Resources.Api/Deployment/k8s'
Contents: |
deployment-pr-env.yml
pr-deployment-env.yml
TargetFolder: '$(Build.ArtifactStagingDirectory)'
- publish: $(Build.ArtifactStagingDirectory)
artifact: 'k8s-deployment'
Expand All @@ -84,11 +74,12 @@ stages:
envName: 'pr'
fusionEnvironment: 'ci'
clientId: '5a842df8-3238-415d-b168-9f16a6a6031b'
aks-namespace: 'fusion-resource-allocation-pr'

jobs:
- deployment: DeployPR
displayName: 'Deploy API to PR'
environment: fra-pr.fusion-resources-app-pr
environment: fra-pr
strategy:
runOnce:
deploy:
Expand Down Expand Up @@ -162,9 +153,11 @@ stages:
azureSubscription: $(subscriptionService)
dbTagPrefix: resources


- task: KubernetesManifest@0
- task: KubernetesManifest@1
displayName: Deploy to Kubernetes cluster
inputs:
kubernetesServiceConnection: fra-k8s-pr
namespace: $(aks-namespace)
action: deploy
manifests: $(deploymentManifest)
manifests: |
$(deploymentManifest)
Loading

0 comments on commit 686d6b0

Please sign in to comment.