diff --git a/azure-pipelines-staging.yml b/azure-pipelines-staging.yml index 0e177bf..8b9cd42 100644 --- a/azure-pipelines-staging.yml +++ b/azure-pipelines-staging.yml @@ -193,9 +193,67 @@ jobs: --type block \ --overwrite \ --file $(Build.ArtifactStagingDirectory)/$(Build.SourceVersion).zip -- job: backend_deploy +- job: function_build dependsOn: frontend_build_production condition: succeeded('frontend_build_production') + displayName: Build And Push Function Image + pool: + name: odms-deploy-pipeline + steps: + - checkout: self + clean: true + fetchDepth: 1 + - task: Npm@1 + displayName: npm ci + inputs: + command: ci + workingDir: dictation_function + verbose: false + - task: AzureKeyVault@2 + displayName: 'Azure Key Vault: kv-odms-secret-stg' + inputs: + ConnectedServiceName: 'omds-service-connection-stg' + KeyVaultName: kv-odms-secret-stg + SecretsFilter: '*' + - task: Bash@3 + displayName: Bash Script (Test) + inputs: + targetType: inline + script: | + cd dictation_function + npm run test + env: + TENANT_NAME: xxxxxxxxxxxx + SIGNIN_FLOW_NAME: xxxxxxxxxxxx + ADB2C_TENANT_ID: $(adb2c-tenant-id) + ADB2C_CLIENT_ID: $(adb2c-client-id) + ADB2C_CLIENT_SECRET: $(adb2c-client-secret) + ADB2C_ORIGIN: xxxxxx + SENDGRID_API_KEY: $(sendgrid-api-key) + MAIL_FROM: xxxxxx + APP_DOMAIN: xxxxxxxxx + REDIS_HOST: xxxxxxxxxxxx + REDIS_PORT: 0 + REDIS_PASSWORD: xxxxxxxxxxxx + - task: Docker@0 + displayName: build + inputs: + azureSubscriptionEndpoint: 'omds-service-connection-stg' + azureContainerRegistry: '{"loginServer":"crodmsregistrymaintenance.azurecr.io", "id" : "/subscriptions/108fb131-cdca-4729-a2be-e5bd8c0b3ba7/resourceGroups/maintenance-rg/providers/Microsoft.ContainerRegistry/registries/crOdmsRegistryMaintenance"}' + dockerFile: dictation_function/Dockerfile + imageName: odmscloud/staging/dictation_function:$(Build.SourceVersion) + buildArguments: | + BUILD_VERSION=$(Build.SourceVersion) + - task: Docker@0 + displayName: push + inputs: + azureSubscriptionEndpoint: 'omds-service-connection-stg' + azureContainerRegistry: '{"loginServer":"crodmsregistrymaintenance.azurecr.io", "id" : "/subscriptions/108fb131-cdca-4729-a2be-e5bd8c0b3ba7/resourceGroups/maintenance-rg/providers/Microsoft.ContainerRegistry/registries/crOdmsRegistryMaintenance"}' + action: Push an image + imageName: odmscloud/staging/dictation_function:$(Build.SourceVersion) +- job: backend_deploy + dependsOn: function_build + condition: succeeded('function_build') displayName: Backend Deploy pool: vmImage: ubuntu-latest @@ -252,9 +310,24 @@ jobs: is_static_export: false verbose: false azure_static_web_apps_api_token: $(STATIC_DICTATION_DEPLOYMENT_TOKEN) -- job: smoke_test +- job: function_deploy dependsOn: frontend_deploy condition: succeeded('frontend_deploy') + displayName: Function Deploy + pool: + vmImage: ubuntu-latest + steps: + - checkout: self + clean: true + fetchDepth: 1 + - task: AzureFunctionAppContainer@1 + inputs: + azureSubscription: 'omds-service-connection-stg' + appName: 'func-odms-dictation-stg' + imageName: 'crodmsregistrymaintenance.azurecr.io/odmscloud/staging/dictation_function:$(Build.SourceVersion)' +- job: smoke_test + dependsOn: function_deploy + condition: succeeded('function_deploy') displayName: 'smoke test' pool: name: odms-deploy-pipeline