|
| 1 | +############################################################################################################################# |
| 2 | +# This is a generated file which includes some replacements. # |
| 3 | +# It is still very much recommended to go through this and ensure all variables are correct for your business/domain # |
| 4 | +# All variables are defined in a global scope. # |
| 5 | +# All Terraform produced resource names are using a labels module ensuring a predictable naming convention # |
| 6 | +# E.g.: variables for company, project, stage and component will produce a name of `$company-$project-$stage-$componenet` # |
| 7 | +# NB: Some resources e.g. blob storage only allow for alpha numeric characters so the name is adjusted accordingly # |
| 8 | +# ==> `$company$project$stage$componenet` # |
| 9 | + |
| 10 | +############################################################################################################################# |
| 11 | +name: "$(build.sourcebranchname)-init" |
| 12 | + |
| 13 | +pr: |
| 14 | + - master |
| 15 | + |
| 16 | +trigger: |
| 17 | + branches: |
| 18 | + include: |
| 19 | + - '*' |
| 20 | + paths: |
| 21 | + include: |
| 22 | + - 'packages/scaffolding-cli/templates/*' |
| 23 | + |
| 24 | +resources: |
| 25 | + repositories: |
| 26 | + - repository: templates |
| 27 | + type: github |
| 28 | + name: amido/stacks-pipeline-templates |
| 29 | + ref: refs/tags/v1.4.2 |
| 30 | + # EXCHANGE THIS FOR YOUR OWN ENDPOINT CONNECTION TO GITHUB |
| 31 | + # REPOSITORY IS PUBLIC |
| 32 | + endpoint: amidostacks |
| 33 | + |
| 34 | + containers: |
| 35 | + # Container for Java Build and Testing |
| 36 | + - container: azul_java |
| 37 | + image: azul/zulu-openjdk-debian:11 |
| 38 | + # Container for inlining Jacoco assets as Azure DevOps strips them |
| 39 | + # https://github.com/microsoft/azure-pipelines-tasks/issues/3027 |
| 40 | + - container: node |
| 41 | + image: amidostacks/node:0.0.3 |
| 42 | + # Container for Sonar Scanner |
| 43 | + - container: sonar_scanner |
| 44 | + image: amidostacks/ci-sonarscanner:0.0.1 |
| 45 | + # Container for Kubernetes Deployment |
| 46 | + - container: k8s_deploy |
| 47 | + image: amidostacks/ci-k8s:0.0.10 |
| 48 | + # Container for Terraform deployments |
| 49 | + - container: terraform_custom |
| 50 | + image: amidostacks/ci-tf:0.0.4 |
| 51 | + |
| 52 | +variables: |
| 53 | + company: amido |
| 54 | + project: stacks |
| 55 | + domain: api-java |
| 56 | + role: backend |
| 57 | + # |
| 58 | + # SelfConfig |
| 59 | + # If you haven't specified source_repo at cli runtime please ensure you replace it here |
| 60 | + # It is case sensitive for TFS based repos |
| 61 | + self_repo: stacks-java |
| 62 | + self_repo_src: java |
| 63 | + self_repo_tf_src: deploy/azure/app |
| 64 | + self_generic_name: stacks-api |
| 65 | + # TF STATE CONFIG |
| 66 | + tf_state_rg: amido-stacks-rg-uks |
| 67 | + tf_state_storage: amidostackstfstategbl |
| 68 | + tf_state_container: tfstate |
| 69 | + # Stacks operates Terraform states based on workspaces **IT IS VERY IMPORTANT** that you ensure a unique name for each application definition |
| 70 | + # Furthermore **IT IS VERY IMPORTANT** that you change the name of a workspace for each deployment stage |
| 71 | + # there are some best practices around this if you are going for feature based environments |
| 72 | + # - we suggest you create a runtime variable that is dynamically set based on a branch currently running |
| 73 | + # **`terraform_state_workspace: `** |
| 74 | + # avoid running anything past dev that is not on master |
| 75 | + # sample value: company-webapp |
| 76 | + tf_state_key: stacks-api-java |
| 77 | + # Versioning |
| 78 | + version_major: 0 |
| 79 | + version_minor: 0 |
| 80 | + version_revision: $[counter(variables['version_minor'], 0)] |
| 81 | + # Docker Config |
| 82 | + docker_dockerfile_path: "." |
| 83 | + docker_image_name: $(self_generic_name) |
| 84 | + docker_image_tag: "$(version_major).$(version_minor).$(version_revision)-$(build.sourcebranchname)" |
| 85 | + # TODO: Change to `core` before releasing... |
| 86 | + docker_container_registry_name: $(company)$(project)nonprodeuwjava |
| 87 | + k8s_docker_registry: $(docker_container_registry_name).azurecr.io |
| 88 | + # BUILD ARTIFACTS across stages |
| 89 | + build_artifact_deploy_path: $(Agent.BuildDirectory)/s/$(self_repo)/deploy/k8s/app |
| 90 | + build_artifact_deploy_name: $(self_generic_name) |
| 91 | + # AKS/AZURE |
| 92 | + # This will always be predictably named by setting your company - project - compnonent names in the infra-pipeline |
| 93 | + aks_clusterrg: $(company)-$(project)-nonprod-euw-$(domain) |
| 94 | + aks_clustername: $(company)-$(project)-nonprod-euw-$(domain) |
| 95 | + # Infra |
| 96 | + conventional_resource_namer: $(company)-$(project)-nonprod-euw-$(domain) |
| 97 | + base_domain: java.nonprod.amidostacks.com |
| 98 | + base_domain_internal: java.nonprod.amidostacks.internal |
| 99 | + # Dynamic vars for downstream purposes |
| 100 | + # tf_workspace_suffix: $[] |
| 101 | + # dns_suffix: "" |
| 102 | + # DEFAULT IMAGE RUNNER |
| 103 | + pool_vm_image: ubuntu-18.04 |
| 104 | + # Test setup |
| 105 | + # ADD Vars here |
| 106 | + # TestCafe E2E Tests |
| 107 | + testcafe_e2e_test: true |
| 108 | + # Lighthouse Audit |
| 109 | + lighthouse_audit: true |
| 110 | + |
| 111 | +stages: |
| 112 | + - stage: CI |
| 113 | + variables: |
| 114 | + # You can find notes in the READMEs around which values to use for each ENV variable group |
| 115 | + - group: amido-stacks-infra-credentials-nonprod |
| 116 | + - group: amido-stacks-java-api |
| 117 | + jobs: |
| 118 | + - job: ApiBuild |
| 119 | + pool: |
| 120 | + vmImage: ubuntu-18.04 |
| 121 | + steps: |
| 122 | + - checkout: self |
| 123 | + |
| 124 | + - checkout: templates |
| 125 | + persistCredentials: true |
| 126 | + |
| 127 | + - template: templates/steps/build-java.yml |
| 128 | + parameters: |
| 129 | + # Docker Config |
| 130 | + build_on_server: false |
| 131 | + docker_build: true |
| 132 | + # TODO: normalize this |
| 133 | + docker_build_additional_args: "." |
| 134 | + docker_workdir: "$(Agent.BuildDirectory)/s/$(self_repo)/$(self_repo_src)" |
| 135 | + docker_imagename: "$(docker_image_name)" |
| 136 | + docker_imagetag: "$(docker_image_tag)" |
| 137 | + docker_containerregistryname: $(docker_container_registry_name) |
| 138 | + # Vulnerability Scanning |
| 139 | + vulnerability_scan: false |
| 140 | + vulnerability_workdir: "$(Build.ArtifactStagingDirectory)" |
| 141 | + # Sonar settings |
| 142 | + static_code_analysis: true |
| 143 | + sonar_container: sonar_scanner |
| 144 | + #Linting and formatting validation |
| 145 | + lint_formatting: false |
| 146 | + shared_eslint_config: "@amidostacks/eslint-config@latest" |
| 147 | + # Should be hardcoded in your sonar-project.properties file |
| 148 | + unit_test: false |
| 149 | + project_root_dir: "$(Agent.BuildDirectory)/s/$(self_repo)/$(self_repo_src)" |
| 150 | + unit_test_project: "$(Test.UnitTestProjectPath)" |
| 151 | + # Build Output File |
| 152 | + # files to be persisted across stages |
| 153 | + build_file: true |
| 154 | + build_file_path: "$(build_artifact_deploy_path)" |
| 155 | + build_file_artefact: "$(build_artifact_deploy_name)" |
| 156 | + # Git Tag release |
| 157 | + git_do_tag_release: false |
| 158 | + git_release_tag: "$(version_major).$(version_minor).$(version_revision)-$(Build.SourceBranchName)" |
| 159 | + # you can define additional steps here |
| 160 | + # you can define additional jobs here |
| 161 | + |
| 162 | + # - stage: dev |
| 163 | + # variables: |
| 164 | + # - group: amido-stacks-infra-credentials-nonprod |
| 165 | + # - group: amido-stacks-demo-api |
| 166 | + # jobs: |
| 167 | + # - job: ApiInfraDev |
| 168 | + # pool: |
| 169 | + # vmImage: ubuntu-18.04 |
| 170 | + # container: terraform_custom |
| 171 | + # steps: |
| 172 | + # - checkout: self |
| 173 | + |
| 174 | + # - checkout: templates |
| 175 | + # persistCredentials: true |
| 176 | + # env: |
| 177 | + # ARM_SUBSCRIPTION_ID: $(azure_subscription_id) |
| 178 | + # ARM_CLIENT_ID: $(azure_client_id) |
| 179 | + # ARM_CLIENT_SECRET: $(azure_client_secret) |
| 180 | + # ARM_TENANT_ID: $(azure_tenant_id) |
| 181 | + |
| 182 | + # # Create TF infra |
| 183 | + # - template: azDevOps/azure/templates/v2/steps/deploy-terraform-resource.yml@templates |
| 184 | + # parameters: |
| 185 | + # # Terraform Basic Config |
| 186 | + # terraform_working_dir: '$(Agent.BuildDirectory)/s/$(self_repo)/$(self_repo_tf_src)' |
| 187 | + # # changing this would require changing the downstream consumers of these outputs |
| 188 | + # # |
| 189 | + # terraform_output_artefact: 'tfoutputs' |
| 190 | + # # Terraform State Config |
| 191 | + # terraform_backend_client_id: $(azure_client_id) |
| 192 | + # terraform_backend_client_secret: $(azure_client_secret) |
| 193 | + # terraform_backend_tenant_id: $(azure_tenant_id) |
| 194 | + # terraform_backend_subscription_id: $(azure_subscription_id) |
| 195 | + # terraform_state_rg: $(tf_state_rg) |
| 196 | + # terraform_state_storage: $(tf_state_storage) |
| 197 | + # terraform_state_container: $(tf_state_container) |
| 198 | + # terraform_state_key: $(tf_state_key) |
| 199 | + # # for branch based builds this can be $(Build.SourceBranchName) |
| 200 | + # terraform_state_workspace: dev |
| 201 | + # # Global Config |
| 202 | + # company: $(company) |
| 203 | + # project: $(project) |
| 204 | + # environment: '' |
| 205 | + # azure_cli_providers: [ |
| 206 | + # { name: MSIPreview, namespace: Microsoft.ContainerService }, |
| 207 | + # ] |
| 208 | + # # Azure config |
| 209 | + # tags: '' |
| 210 | + # # Terraform Resource Specific Config |
| 211 | + # terraform_extra_properties: { |
| 212 | + # TF_VAR_resource_group_location: euwouth, |
| 213 | + # TF_VAR_resource_group_name: $(conventional_resource_namer), |
| 214 | + # TF_VAR_name_company: $(company), |
| 215 | + # TF_VAR_name_project: $(project), |
| 216 | + # TF_VAR_name_component: $(component), |
| 217 | + # TF_VAR_create_cosmosdb: true, |
| 218 | + # TF_VAR_name_environment: dev, |
| 219 | + # TF_VAR_app_gateway_frontend_ip_name: $(conventional_resource_namer), |
| 220 | + # TF_VAR_dns_record: java-api, |
| 221 | + # TF_VAR_dns_zone_name: $(base_domain), |
| 222 | + # TF_VAR_internal_dns_zone_name: $(base_domain_internal), |
| 223 | + # } |
| 224 | + # terraform_output_commands: "" |
| 225 | + |
| 226 | + # - deployment: DeployDev |
| 227 | + # dependsOn: AppInfraDev |
| 228 | + # container: k8s_deploy |
| 229 | + # variables: |
| 230 | + # GLOBAL_VAR: FOO |
| 231 | + # pool: |
| 232 | + # vmImage: ubuntu-18.04 |
| 233 | + # environment: dev |
| 234 | + # strategy: |
| 235 | + # runOnce: |
| 236 | + # deploy: |
| 237 | + # steps: |
| 238 | + # - checkout: self |
| 239 | + # - checkout: templates |
| 240 | + # persistCredentials: true |
| 241 | + # target: k8s_deploy |
| 242 | + # # Deploy Dev |
| 243 | + # # TODO: change this to steps and feed upstream |
| 244 | + # - template: azDevOps/azure/templates/v2/steps/aux-k8s-scripts.yml@templates |
| 245 | + # parameters: |
| 246 | + # scripts_dir: $(Agent.BuildDirectory)/s/stacks-pipeline-templates/azDevOps/azure/templates/v2 |
| 247 | + |
| 248 | + # - template: azDevOps/azure/templates/v2/steps/yaml-k8s-templater.yml@templates |
| 249 | + # parameters: |
| 250 | + # scripts_dir: $(Agent.BuildDirectory)/s/stacks-pipeline-templates/azDevOps/azure/templates/v2/scripts |
| 251 | + # template_input: [ |
| 252 | + # { |
| 253 | + # base: $(Agent.BuildDirectory)/s/$(self_repo)/deploy/k8s/app/base_api-deploy.yml, |
| 254 | + # displayName: AppDeployment, |
| 255 | + # env_vars: { |
| 256 | + # namespace: dev-stacks-api, |
| 257 | + # dns_pointer: api.$(base_domain), |
| 258 | + # tls_domain: $(base_domain), |
| 259 | + # k8s_app_path: /api/menu, |
| 260 | + # k8s_image: '$(k8s_docker_registry)/$(docker_image_name):$(docker_image_tag)', |
| 261 | + # version: $(docker_image_tag), |
| 262 | + # role: $(role), |
| 263 | + # company: $(company), |
| 264 | + # project: $(project), |
| 265 | + # domain: $(domain), |
| 266 | + # component: api, |
| 267 | + # app_name: yumido-api, |
| 268 | + # resource_def_name: xx-replace-me, |
| 269 | + # environment: dev, |
| 270 | + # aadpodidentitybinding: stacks-webapp-identity, |
| 271 | + # APPINSIGHTS_INSTRUMENTATIONKEY: $(APPINSIGHTS_INSTRUMENTATIONKEY), |
| 272 | + # cosmosdb_key: $(COSMOSDB_KEY_DEV) |
| 273 | + # } |
| 274 | + # } |
| 275 | + # ] |
| 276 | + |
| 277 | + # - template: azDevOps/azure/templates/v2/steps/deploy-k8s-app-kubectl.yml@templates |
| 278 | + # parameters: |
| 279 | + # environment: "dev" |
| 280 | + # scripts_dir: $(Agent.BuildDirectory)/s/stacks-pipeline-templates/azDevOps/azure/templates/v2/scripts |
| 281 | + # download_deploy_artefact: true |
| 282 | + # deploy_artifact_name: $(build_artifact_deploy_name) |
| 283 | + # test_artefact: "tests" |
| 284 | + # test_baseurl: "" |
| 285 | + # functional_test: false |
| 286 | + # performance_test: false |
| 287 | + # smoke_test: false |
| 288 | + # # Kubernetes Config |
| 289 | + # kubernetes_clusterrg: $(aks_clusterrg) |
| 290 | + # kubernetes_clustername: $(aks_clustername) |
| 291 | + # # Mutation Information |
| 292 | + # kubectl_filepath: $(Agent.BuildDirectory)/s/$(self_repo)/deploy/k8s/app/api-deploy.yml |
| 293 | + # kubectl_working_dir: $(Agent.BuildDirectory)/s/$(self_repo)/deploy/k8s/app # unnecessary |
| 294 | + # appinsights_enabled: false |
| 295 | + # appinsights_accountName: "" |
| 296 | + # secureFile: "" |
| 297 | + # # ReleaseNote Information |
| 298 | + # releasenote: false |
0 commit comments