From 58920eefaf21d164a30d498cbb95dc9fa68cbc59 Mon Sep 17 00:00:00 2001 From: Jan Schutte Date: Wed, 14 Jun 2023 08:09:48 +0200 Subject: [PATCH 1/4] Added scripts back --- .../docker/Dockerfile | 21 + .../docker/dockerignore | 25 + .../pipeline/nox-project/azure-pipelines.yml | 104 ++++ .../pipeline/nox-project/global.yaml | 20 + .../pipeline/nox-project/preprod-we-test.yaml | 7 + .../terraform/env-vars.tf | 149 +++++ .../heimdall-ms-microservice-prod-vars.tf | 149 +++++ .../heimdall-ms-microservice-test-vars.tf | 149 +++++ .../heimdall-ms-microservice-uat-vars.tf | 149 +++++ .../terraform/heimdall-ms-microservice.tf | 9 + .../terraform/outputs.tf | 6 + .../terraform/tfc-workspace.tf | 22 + .../terraform/variables.tf | 12 + .../InitSln_Connect.steps.nox.yaml | 33 + .../InitSln_DevopsProject.steps.nox.yaml | 11 + .../InitSln_DirSetup.steps.nox.yaml | 293 +++++++++ .../InitSln_NoxProject.steps.nox.yaml | 11 + .../InitSln_OutputTable.steps.nox.yaml | 10 + .../InitSln_ServerInit.steps.nox.yaml | 60 ++ .../InitSln_SyncRepos.steps.nox.yaml | 34 ++ .../InitSolution.workflow.nox.yaml | 56 ++ .../Manifest.cli.nox.yaml | 33 + .../NewNoxService.workflow.nox.yaml | 74 +++ .../SyncAzureActiveDirectory.steps.nox.yaml | 161 +++++ ...SyncAzureActiveDirectory.workflow.nox.yaml | 335 ++++++++++ .../SyncDatabaseScript.workflow.nox.yaml | 160 +++++ .../SyncDns.steps.nox.yaml | 24 + .../SyncElasticAlerts.workflow.nox.yaml | 215 +++++++ .../SyncHelmChart.steps.nox.yaml | 204 +++++++ .../SyncHelmChart.workflow.nox.yaml | 93 +++ .../SyncHelmPipeline.steps.nox.yaml | 236 ++++++++ .../SyncHelmPipeline.workflow.nox.yaml | 61 ++ .../SyncInfrastructure.steps.nox.yaml | 573 ++++++++++++++++++ .../SyncInfrastructure.workflow.nox.yaml | 92 +++ .../SyncKeyVault.steps.nox.yaml | 48 ++ .../SyncKeyVault.workflow.nox.yaml | 27 + .../SyncLocalRepo.workflow.nox.yaml | 18 + .../SyncProjectPipeline.steps.nox.yaml | 249 ++++++++ .../SyncProjectPipeline.workflow.nox.yaml | 61 ++ .../SyncSolution.workflow.nox.yaml | 156 +++++ .../SyncVersionControl.steps.nox.yaml | 280 +++++++++ .../SyncVersionControl.workflow.nox.yaml | 90 +++ .../files/NoxCliCache.json | 10 + .../Test.find-cname-record.workflow.nox.yaml | 38 ++ 44 files changed, 4568 insertions(+) create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/Dockerfile create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/dockerignore create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/azure-pipelines.yml create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/global.yaml create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/preprod-we-test.yaml create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/env-vars.tf create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-prod-vars.tf create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-test-vars.tf create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-uat-vars.tf create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice.tf create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/outputs.tf create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/tfc-workspace.tf create mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/variables.tf create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_Connect.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DevopsProject.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DirSetup.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_NoxProject.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_OutputTable.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_ServerInit.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_SyncRepos.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSolution.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/Manifest.cli.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/NewNoxService.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDatabaseScript.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDns.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncElasticAlerts.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncLocalRepo.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncSolution.workflow.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.steps.nox.yaml create mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.workflow.nox.yaml create mode 100644 tests/Nox.Cli.Server.Tests/files/NoxCliCache.json create mode 100644 tests/workflows/Test.find-cname-record.workflow.nox.yaml diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/Dockerfile b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/Dockerfile new file mode 100644 index 00000000..e655a5de --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/Dockerfile @@ -0,0 +1,21 @@ +FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +WORKDIR /app + +FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build + +COPY [".//.csproj", "/"] +RUN dotnet restore ".//.csproj" +COPY . . +WORKDIR "/" +RUN dotnet build ".csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish ".csproj" -c Release -o /app/publish + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . + +ENV ASPNETCORE_URLS http://0.0.0.0:8080 + +ENTRYPOINT ["dotnet", ".dll"] \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/dockerignore b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/dockerignore new file mode 100644 index 00000000..af50df1a --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/dockerignore @@ -0,0 +1,25 @@ +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/.idea +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/azure-pipelines.yml b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/azure-pipelines.yml new file mode 100644 index 00000000..1c8d0e4e --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/azure-pipelines.yml @@ -0,0 +1,104 @@ +parameters: + - name: skipBuild + displayName: Skip build? + type: boolean + default: false + - name: imageTag + displayName: 'Enter existing image tag you want to deploy e.g. `branchFolder-buildNumber` format (i.e. feature-20221109.7)' + type: string + default: 'latest' + +resources: + repositories: + - repository: templates + type: git + name: 'IWG.DevOps/devops-build-templates' + - repository: scripts + type: git + name: IWG.DevOps/devops-scripts + - repository: heimdallTemplates + type: git + name: 'Heimdall.Core/Templates.Pipeline' + pipelines: + - pipeline: helmChart + source: .HelmChart + trigger: + branches: + include: + - main + +trigger: + branches: + include: + - main + - develop + - release/* + - hotfix/* + +pool: + vmImage: ubuntu-latest + +variables: + - template: common/branch-names.yaml@templates + - template: variables/global.yml@heimdallTemplates + - template: pipeline/variables/global.yaml + +stages: + - stage: CI_Build + displayName: 'Build' + condition: and(succeeded(), eq(${{ parameters.skipBuild }}, false)) + jobs: + # - job: CI_Build + # displayName: 'Build' + # steps: + # - template: build-template.yml@heimdallTemplates + # parameters: + # SonarcloudProjectKey: $(SonarcloudProjectKey) + # SourceFolder: $(SourceFolder) + # runSonarCloud: false + # ignoreSonarGate: true + # skipComponentTests: true + - job: CI_Build_Docker + displayName: 'Docker Build/Push' + # dependsOn: 'CI_Build' + # condition: succeeded() + pool: + vmImage: 'ubuntu-latest' + steps: + - template: build-docker.yml@heimdallTemplates + parameters: + dockerfile: $(dockerfilePath) + buildContext: $(buildContext) + repository: $(service_name) + pushImage: ${{ not(contains(variables['Build.Reason'], 'PullRequest')) }} + pushInPlatformN: true + pushInPlatformP: false + + - stage: CD_Test + displayName: 'Test Deployment WE' + ${{ if eq(parameters.skipBuild, false)}}: + dependsOn: CI_Build + condition: | + and( + or(succeeded(), ${{ parameters.skipBuild }}), + or(eq(variables.isMain, 'true'),eq(variables.isFeature, 'true')) + ) + jobs: + - deployment: CD_Test + displayName: 'Deployment' + pool: + name: $(poolName) + environment: -we + variables: + - template: pipeline/variables/preprod-we-test.yaml + - template: variables/APPS_EU_PLATFORM_N_WE.yml@heimdallTemplates + strategy: + runOnce: + deploy: + steps: + - template: deployment.yml@heimdallTemplates + parameters: + runMigration: false + envKeyVaultName: $(ENV_KEYVAULT_NAME) + imageTag: ${{ parameters.imageTag }} + skipBuild: ${{ parameters.skipBuild }} diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/global.yaml b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/global.yaml new file mode 100644 index 00000000..6eccd6d0 --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/global.yaml @@ -0,0 +1,20 @@ +variables: + # SonarCloud related + - name: SonarcloudProjectKey + value: '' + - name: SourceFolder + value: '' + + # ACR repo name | Don't rename the variable because it's linked with CD template + - name: service_name + value: ''.api.v1 + + # Docker related - required + - name: buildContext + value: '' + - name: dockerfilePath + value: '$(Build.SourcesDirectory)' + + # Helm Chart name + - name: helm_chart_name + value: \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/preprod-we-test.yaml b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/preprod-we-test.yaml new file mode 100644 index 00000000..cb3ece8e --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/preprod-we-test.yaml @@ -0,0 +1,7 @@ +variables: + namespace: -test + + helm_install_name: + + HELM_CHART_VALUE_FILE: values-test.yaml + HELM_CHART_VERSION: "1.0.0" diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/env-vars.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/env-vars.tf new file mode 100644 index 00000000..695bbe8f --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/env-vars.tf @@ -0,0 +1,149 @@ +module "_variables" { + source = "app.terraform.io/iwgplc/tfc-variable/tfe" + version = "1.0.0" + + variable_params = { + # ------------------------------ West Europe --------------------------------- + we_var01 = { + key = "env" + value = "" + category = "terraform" + description = "Name of the environment." + variable_set_id = null + workspace_id = module._we.workspaces["${local.app_name}__we"].id + hcl = null + sensitive = null + } + we_var02 = { + key = "region" + value = "West Europe" + category = "terraform" + description = "Location where resources are being deployed." + variable_set_id = null + workspace_id = module._we.workspaces["${local.app_name}__we"].id + hcl = null + sensitive = null + } + we_var03 = { + key = "rp" + value = "we" + category = "terraform" + description = "Location prefix." + variable_set_id = null + workspace_id = module._we.workspaces["${local.app_name}__we"].id + hcl = null + sensitive = null + } + we_var04 = { + key = "tag_application_sla" + value = "NOSLA" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module._we.workspaces["${local.app_name}__we"].id + hcl = null + sensitive = null + } + we_var05 = { + key = "tag_business_criticality" + value = "BC1" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module._we.workspaces["${local.app_name}__we"].id + hcl = null + sensitive = null + } + we_var06 = { + key = "parent_workspace_name" + value = var.heimdall_workspace_preprod_we + category = "terraform" + description = "TFC parent workspace name, for reading state output." + variable_set_id = null + workspace_id = module._we.workspaces["${local.app_name}__we"].id + hcl = null + sensitive = null + } + we_var07 = { + key = "k8s_namespace" + value = "" + category = "terraform" + description = "K8s namespace of the environment" + variable_set_id = null + workspace_id = module._we.workspaces["${local.app_name}__we"].id + hcl = null + sensitive = null + }, + # ------------------------------ North Europe --------------------------------- + ne_var01 = { + key = "env" + value = "" + category = "terraform" + description = "Name of the environment." + variable_set_id = null + workspace_id = module._ne.workspaces["${local.app_name}__ne"].id + hcl = null + sensitive = null + } + ne_var02 = { + key = "region" + value = "North Europe" + category = "terraform" + description = "Location where resources are being deployed." + variable_set_id = null + workspace_id = module._ne.workspaces["${local.app_name}__ne"].id + hcl = null + sensitive = null + } + ne_var03 = { + key = "rp" + value = "ne" + category = "terraform" + description = "Location prefix." + variable_set_id = null + workspace_id = module._ne.workspaces["${local.app_name}__ne"].id + hcl = null + sensitive = null + } + ne_var04 = { + key = "tag_application_sla" + value = "NOSLA" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module._ne.workspaces["${local.app_name}__ne"].id + hcl = null + sensitive = null + } + ne_var05 = { + key = "tag_business_criticality" + value = "BC1" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module._ne.workspaces["${local.app_name}__ne"].id + hcl = null + sensitive = null + } + ne_var06 = { + key = "parent_workspace_name" + value = var.heimdall_workspace_preprod_ne + category = "terraform" + description = "TFC parent workspace name, for reading state output." + variable_set_id = null + workspace_id = module._ne.workspaces["${local.app_name}__ne"].id + hcl = null + sensitive = null + } + ne_var07 = { + key = "k8s_namespace" + value = "" + category = "terraform" + description = "K8s namespace of the environment" + variable_set_id = null + workspace_id = module._ne.workspaces["${local.app_name}__ne"].id + hcl = null + sensitive = null + } + } +} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-prod-vars.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-prod-vars.tf new file mode 100644 index 00000000..c50ba0d8 --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-prod-vars.tf @@ -0,0 +1,149 @@ +module "heimdall__prod_variables" { + source = "app.terraform.io/iwgplc/tfc-variable/tfe" + version = "1.0.0" + + variable_params = { + # ------------------------------ West Europe --------------------------------- + we_var01 = { + key = "env" + value = "prod" + category = "terraform" + description = "Name of the environment." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id + hcl = null + sensitive = null + } + we_var02 = { + key = "region" + value = "West Europe" + category = "terraform" + description = "Location where resources are being deployed." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id + hcl = null + sensitive = null + } + we_var03 = { + key = "rp" + value = "we" + category = "terraform" + description = "Location prefix." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id + hcl = null + sensitive = null + } + we_var04 = { + key = "tag_application_sla" + value = "NOSLA" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id + hcl = null + sensitive = null + } + we_var05 = { + key = "tag_business_criticality" + value = "BC1" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id + hcl = null + sensitive = null + } + we_var06 = { + key = "parent_workspace_name" + value = module.Heimdall_Workspaces.workspaces["prod_we"].name + category = "terraform" + description = "TFC parent workspace name, for reading state output." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id + hcl = null + sensitive = null + } + we_var07 = { + key = "k8s_namespace" + value = "-prod" + category = "terraform" + description = "K8s namespace of the environment" + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id + hcl = null + sensitive = null + }, + # ------------------------------ North Europe --------------------------------- + ne_var01 = { + key = "env" + value = "prod" + category = "terraform" + description = "Name of the environment." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id + hcl = null + sensitive = null + } + ne_var02 = { + key = "region" + value = "North Europe" + category = "terraform" + description = "Location where resources are being deployed." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id + hcl = null + sensitive = null + } + ne_var03 = { + key = "rp" + value = "ne" + category = "terraform" + description = "Location prefix." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id + hcl = null + sensitive = null + } + ne_var04 = { + key = "tag_application_sla" + value = "NOSLA" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id + hcl = null + sensitive = null + } + ne_var05 = { + key = "tag_business_criticality" + value = "BC1" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id + hcl = null + sensitive = null + } + ne_var06 = { + key = "parent_workspace_name" + value = module.Heimdall_Workspaces.workspaces["prod_ne"].name + category = "terraform" + description = "TFC parent workspace name, for reading state output." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id + hcl = null + sensitive = null + } + ne_var07 = { + key = "k8s_namespace" + value = "-prod" + category = "terraform" + description = "K8s namespace of the environment" + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id + hcl = null + sensitive = null + } + } +} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-test-vars.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-test-vars.tf new file mode 100644 index 00000000..aa7bb023 --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-test-vars.tf @@ -0,0 +1,149 @@ +module "heimdall__test_variables" { + source = "app.terraform.io/iwgplc/tfc-variable/tfe" + version = "1.0.0" + + variable_params = { + # ------------------------------ West Europe --------------------------------- + we_var01 = { + key = "env" + value = "test" + category = "terraform" + description = "Name of the environment." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id + hcl = null + sensitive = null + } + we_var02 = { + key = "region" + value = "West Europe" + category = "terraform" + description = "Location where resources are being deployed." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id + hcl = null + sensitive = null + } + we_var03 = { + key = "rp" + value = "we" + category = "terraform" + description = "Location prefix." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id + hcl = null + sensitive = null + } + we_var04 = { + key = "tag_application_sla" + value = "NOSLA" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id + hcl = null + sensitive = null + } + we_var05 = { + key = "tag_business_criticality" + value = "BC1" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id + hcl = null + sensitive = null + } + we_var06 = { + key = "parent_workspace_name" + value = module.Heimdall_Workspaces.workspaces["preprod_we"].name + category = "terraform" + description = "TFC parent workspace name, for reading state output." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id + hcl = null + sensitive = null + } + we_var07 = { + key = "k8s_namespace" + value = "-test" + category = "terraform" + description = "K8s namespace of the environment" + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id + hcl = null + sensitive = null + }, + # ------------------------------ North Europe --------------------------------- + ne_var01 = { + key = "env" + value = "test" + category = "terraform" + description = "Name of the environment." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id + hcl = null + sensitive = null + } + ne_var02 = { + key = "region" + value = "North Europe" + category = "terraform" + description = "Location where resources are being deployed." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id + hcl = null + sensitive = null + } + ne_var03 = { + key = "rp" + value = "ne" + category = "terraform" + description = "Location prefix." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id + hcl = null + sensitive = null + } + ne_var04 = { + key = "tag_application_sla" + value = "NOSLA" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id + hcl = null + sensitive = null + } + ne_var05 = { + key = "tag_business_criticality" + value = "BC1" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id + hcl = null + sensitive = null + } + ne_var06 = { + key = "parent_workspace_name" + value = module.Heimdall_Workspaces.workspaces["preprod_ne"].name + category = "terraform" + description = "TFC parent workspace name, for reading state output." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id + hcl = null + sensitive = null + } + ne_var07 = { + key = "k8s_namespace" + value = "-test" + category = "terraform" + description = "K8s namespace of the environment" + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id + hcl = null + sensitive = null + } + } +} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-uat-vars.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-uat-vars.tf new file mode 100644 index 00000000..1ee9ac64 --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-uat-vars.tf @@ -0,0 +1,149 @@ +module "heimdall__uat_variables" { + source = "app.terraform.io/iwgplc/tfc-variable/tfe" + version = "1.0.0" + + variable_params = { + # ------------------------------ West Europe --------------------------------- + we_var01 = { + key = "env" + value = "uat" + category = "terraform" + description = "Name of the environment." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id + hcl = null + sensitive = null + } + we_var02 = { + key = "region" + value = "West Europe" + category = "terraform" + description = "Location where resources are being deployed." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id + hcl = null + sensitive = null + } + we_var03 = { + key = "rp" + value = "we" + category = "terraform" + description = "Location prefix." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id + hcl = null + sensitive = null + } + we_var04 = { + key = "tag_application_sla" + value = "NOSLA" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id + hcl = null + sensitive = null + } + we_var05 = { + key = "tag_business_criticality" + value = "BC1" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id + hcl = null + sensitive = null + } + we_var06 = { + key = "parent_workspace_name" + value = module.Heimdall_Workspaces.workspaces["prod_we"].name + category = "terraform" + description = "TFC parent workspace name, for reading state output." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id + hcl = null + sensitive = null + } + we_var07 = { + key = "k8s_namespace" + value = "-uat" + category = "terraform" + description = "K8s namespace of the environment" + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id + hcl = null + sensitive = null + }, + # ------------------------------ North Europe --------------------------------- + ne_var01 = { + key = "env" + value = "uat" + category = "terraform" + description = "Name of the environment." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id + hcl = null + sensitive = null + } + ne_var02 = { + key = "region" + value = "North Europe" + category = "terraform" + description = "Location where resources are being deployed." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id + hcl = null + sensitive = null + } + ne_var03 = { + key = "rp" + value = "ne" + category = "terraform" + description = "Location prefix." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id + hcl = null + sensitive = null + } + ne_var04 = { + key = "tag_application_sla" + value = "NOSLA" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id + hcl = null + sensitive = null + } + ne_var05 = { + key = "tag_business_criticality" + value = "BC1" + category = "terraform" + description = "TAG attribute." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id + hcl = null + sensitive = null + } + ne_var06 = { + key = "parent_workspace_name" + value = module.Heimdall_Workspaces.workspaces["prod_ne"].name + category = "terraform" + description = "TFC parent workspace name, for reading state output." + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id + hcl = null + sensitive = null + } + ne_var07 = { + key = "k8s_namespace" + value = "-uat" + category = "terraform" + description = "K8s namespace of the environment" + variable_set_id = null + workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id + hcl = null + sensitive = null + } + } +} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice.tf new file mode 100644 index 00000000..54433787 --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice.tf @@ -0,0 +1,9 @@ +module "heimdall__workspaces" { + source = "./heimdall-ms-" + + heimdall_workspace_preprod_we = module.Heimdall_Workspaces.workspaces["preprod_we"].name + heimdall_workspace_preprod_ne = module.Heimdall_Workspaces.workspaces["preprod_ne"].name + heimdall_workspace_prod_we = module.Heimdall_Workspaces.workspaces["prod_we"].name + heimdall_workspace_prod_ne = module.Heimdall_Workspaces.workspaces["prod_ne"].name + +} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/outputs.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/outputs.tf new file mode 100644 index 00000000..5bb1673e --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/outputs.tf @@ -0,0 +1,6 @@ + + + + + + diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/tfc-workspace.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/tfc-workspace.tf new file mode 100644 index 00000000..782bf342 --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/tfc-workspace.tf @@ -0,0 +1,22 @@ +locals { + app_name = "" +} + +module "test_we" { + source = "../module" + + app_name = local.app_name + vcs_repo_identifier = "iwgplc//_git/-infrastructure-tf" + environment = "test" + region = "we" + +} +module "test_ne" { + source = "../module" + + app_name = local.app_name + vcs_repo_identifier = "iwgplc//_git/-infrastructure-tf" + environment = "test" + region = "ne" + +} diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/variables.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/variables.tf new file mode 100644 index 00000000..740ed064 --- /dev/null +++ b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/variables.tf @@ -0,0 +1,12 @@ +variable "heimdall_workspace_preprod_we" { + type = string +} +variable "heimdall_workspace_preprod_ne" { + type = string +} +variable "heimdall_workspace_prod_we" { + type = string +} +variable "heimdall_workspace_prod_ne" { + type = string +} diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_Connect.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_Connect.steps.nox.yaml new file mode 100644 index 00000000..1d73c205 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_Connect.steps.nox.yaml @@ -0,0 +1,33 @@ +steps: + - name: Connect to Azure Active Directory + id: connect-aad + uses: azuread/connect@v1 + with: + tenant-id: ${{ server.secrets.AZURE_TENANT_ID }} + client-id: ${{ server.secrets.AZURE_CLIENT_ID }} + client-secret: ${{ server.secrets.AZURE_CLIENT_SECRET }} + display: + success: Successfully connected to Azure Active Directory + error: Unable to connect to Azure Active Directory + run-at-server: true + + - name: Locate the DevOps server + id: locate-devops + uses: network/ping@v1 + with: + host: ${{ project.versionControl.server }} + display: + success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds + error: The DevOps server is not accessible. Are you connected to the Internet? + run-at-server: true + + - name: Connect to the DevOps server + id: connect-devops + uses: azdevops/connect@v1 + with: + server: ${{ project.versionControl.server }} + personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} + display: + success: Connected to the DevOps server + error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) + run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DevopsProject.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DevopsProject.steps.nox.yaml new file mode 100644 index 00000000..95c9ea0a --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DevopsProject.steps.nox.yaml @@ -0,0 +1,11 @@ +steps: + - name: Get the DevOps project + id: get-devops-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: IWG.DevOps + display: + success: Got the DevOps project + error: Unable to get the DevOps project (${{ steps.get-devops-project.error-message }}) + run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DirSetup.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DirSetup.steps.nox.yaml new file mode 100644 index 00000000..edd747c9 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DirSetup.steps.nox.yaml @@ -0,0 +1,293 @@ +steps: + - name: Get the current directory + id: get-start-dir + uses: file/get-current-directory@v1 + + - name: Store current directory + id: store-start-dir + uses: core/add-variables@v1 + with: + start-dir: ${{ steps.get-start-dir.outputs.path }} + + - name: Ensure the .nox folder exists + id: ensure-nox-folder + uses: file/ensure-folder@v1 + with: + path: ./ + folder-name: .nox + display: + success: Ensured that the .nox folder exists + error: Unable to ensure that the .nox folder exists (${{ steps.ensure-nox-folder.error-message }}) + + - name: Ensure that the .nox/design folder exists + id: ensure-design-folder + uses: file/ensure-folder@v1 + with: + path: ./.nox + folder-name: design + display: + success: Ensured that the .nox/design folder exists + error: Unable to ensure that the .nox/design folder exists (${{ steps.ensure-design-folder.error-message }}) + + - name: Search for a Nox yaml definition + id: find-nox-yaml + uses: file/find-file@v1 + with: + path: ./.nox/design + file-name: "*.service.nox.yaml" + + - name: Get the project name + if: '"${{ steps.find-nox-yaml.outputs.is-found }}" == "False"' + id: create-nox-yaml + uses: console/prompt-schema@v1 + with: + schema: | + { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string", + "description": "The name of the NOX solution", + "default": "${{ steps.get-start-dir.outputs.directory-name }}" + } + } + } + + - name: Create a nox yaml definition + id: add-nox-options + if: '"${{ steps.find-nox-yaml.outputs.is-found }}" == "False"' + uses: console/prompt-schema@v1 + with: + schema-url: https://noxorg.dev/schemas/NoxConfiguration.json + include-prompts: [ "description","database","versionControl","team" ] + exclude-prompts: + - team.developers[0].mobilePhoneNumber + - database.provider + - database.options + - database.connectionString + - database.connectionStringVariable + - versionControl.provider + defaults: + name: ${{ steps.create-nox-yaml.outputs.name }} + description: The ${{ steps.create-nox-yaml.outputs.name }} service + database.name: ${{ steps.create-nox-yaml.outputs.name }}Db + database.server: "localhost" + database.provider: "postgres" + database.port: 5432 + database.user: sa + database.password: Developer*123 + versionControl.provider: azureDevOps + versionControl.server: https://dev.azure.com/iwgplc + versionControl.project: ${{ steps.create-nox-yaml.outputs.name }} + versionControl.repository: ${{ steps.create-nox-yaml.outputs.name }}.Api.V1 + team.developers[0].name: ${{ cache.username }} + team.developers[0].userName: ${{ cache.upn }} + team.developers[0].isProductOwner: n + output-file: + folder: ./.nox/design + filename: ${{ steps.create-nox-yaml.outputs.name }}.service.nox.yaml + display: + success: Created nox yaml definition ${{ steps.add-nox-options.outputs.file-path }} + error: Unable to create a yaml definition for your solution (${{ steps.add-nox-options.error-message }}) + + - name: Load the new Nox solution configuration + id: load-nox-config + if: '"${{ steps.find-nox-yaml.outputs.is-found }}" == "False"' + uses: core/load-nox-configuration@v1 + with: + path: ./.nox/design + display: + success: Loaded the newly created Nox solution configuration + error: Unable to load the newly created Nox solution configuration (${{ steps.load-nox-config.error-message }}) + + - name: Find the .git folder + id: find-git-folder + uses: file/find-folder@v1 + with: + path: ./.git + + - name: Perform a git init + id: git-init + if: '"${{ steps.find-git-folder.outputs.is-found }}" == "False"' + uses: powershell/script@v1 + with: + script: git init -b main + display: + success: Performed a git init + error: Unable to perform a git init (${{ steps.git-init.error-message }}) + + - name: Find the .gitignore file + id: find-gitignore + uses: file/find-file@v1 + with: + path: ./ + file-name: .gitignore + + - name: Create a gitignore file + id: create-gitignore + if: '"${{ steps.find-gitignore.outputs.is-found }}" == "False"' + uses: powershell/script@v1 + with: + script: dotnet new gitignore + display: + success: Created a gitignore file + error: Unable to create a gitignore file (${{ steps.create-gitignore.error-message }}) + + - name: Ensure the src folder exists + id: ensure-src-folder + uses: file/ensure-folder@v1 + with: + path: ./ + folder-name: src + display: + success: Ensured that the src folder exists + error: Unable to ensure that the src folder exists (${{ steps.ensure-src-folder.error-message }}) + + - name: Ensure the tests folder exists + id: ensure-tests-folder + uses: file/ensure-folder@v1 + with: + path: ./ + folder-name: tests + display: + success: Ensured that the tests folder exists + error: Unable to ensure that the tests folder exists (${{ steps.ensure-tests-folder.error-message }}) + + - name: Set src as current directory + id: set-src-current + uses: file/set-current-directory@v1 + with: + path: ./src + + - name: Find the sln file + id: find-sln + uses: file/find-file@v1 + with: + path: ./ + file-name: ${{ project.versionControl.project }}.sln + + - name: Create the sln file + id: create-sln + if: '"${{ steps.find-sln.outputs.is-found }}" == "False"' + uses: powershell/script@v1 + with: + script: dotnet new solution -n ${{ project.versionControl.project }} + display: + success: Created a new dotnet solution + error: Unable to create a new dotnet solution (${{ steps.create-sln.error-message }}) + + - name: Find the proj file + id: find-proj + uses: file/find-file@v1 + with: + path: ./${{ project.versionControl.repository }} + file-name: ${{ project.versionControl.repository }}.csproj + + - name: Create a dotnet webapi project + id: create-proj + if: '"${{ steps.find-proj.outputs.is-found }}" == "False"' + uses: powershell/script@v1 + with: + script: dotnet new webapi -n ${{ project.versionControl.repository }} + display: + success: Created a new dotnet webapi project + error: Unable to create a new dotnet webapi project (${{ steps.create-proj.error-message }}) + + - name: Add the webapi to the solution + id: add-proj-to-sln + uses: powershell/script@v1 + with: + script: dotnet sln add ${{ project.versionControl.repository }} + display: + success: Added the webapi to the solution + error: Unable to add the webapi to the solution (${{ steps.add-proj-to-sln.error-message }}) + + - name: Search for a .dockerignore file + id: find-dockerignore + uses: file/find-file@v1 + with: + path: ./ + file-name: .dockerignore + + - name: Load the dockerignore template + id: load-dockerignore-template + if: '"${{ steps.find-dockerignore.outputs.is-found }}" == "False"' + uses: core/load-template@v1 + with: + path: docker/dockerignore + display: + success: Loaded the dockerignore template + error: Unable to load the dockerignore template (${{ steps.load-dockerignore-template.error-message }}) + + - name: Create a .dockerignore for the project + id: create-dockerignore + if: '"${{ steps.find-dockerignore.outputs.is-found }}" == "False"' + uses: file/write-text@v1 + with: + path: ./.dockerignore + text-to-write: ${{ steps.load-dockerignore-template.outputs.result }} + display: + success: Created a .docker ignore file + error: Unable to create a .dockerignore file (${{ steps.create-dockerignore.error-message }}) + + - name: Search for a Docker file + id: find-docker-file + uses: file/find-file@v1 + with: + path: ./ + file-name: Dockerfile + + - name: Load the Dockerfile template + id: load-dockerfile-template + if: '"${{ steps.find-docker-file.outputs.is-found }}" == "False"' + uses: core/load-template@v1 + with: + path: docker/Dockerfile + display: + success: Loaded the Dockerfile template + error: Unable to load the Dockerfile template (${{ steps.load-dockerfile-template.error-message }}) + + - name: Interpolate Dockerfile template variables + id: interpolate-docker-file + if: '"${{ steps.find-docker-file.outputs.is-found }}" == "False"' + uses: core/replace-strings@v1 + with: + source-string: ${{ steps.load-dockerfile-template.outputs.result }} + replacements: + "": ${{ project.versionControl.repository }} + display: + success: Interpolated Dockerfile template variables + error: Unable to interpolated Dockerfile template variables ${{ steps.interpolate-docker-file.error-message }} + + - name: Create a Dockerfile for the project + id: create-docker-file + if: '"${{ steps.find-docker-file.outputs.is-found }}" == "False"' + uses: file/write-text@v1 + with: + path: ./Dockerfile + text-to-write: ${{ steps.interpolate-docker-file.outputs.result }} + display: + success: Created a .Dockerfile file + error: Unable to create a Dockerfile (${{ steps.create-docker-file.error-message }}) + + - name: Add the project files to git + id: git-add-files + if: '"${{ steps.find-proj.outputs.is-found }}" == "False"' + uses: powershell/script@v1 + with: + script: git add --all + display: + success: Added the project files to git + error: Unable to add the project files to git (${{ steps.git-add-files.error-message }}) + + - name: Perform an initial commit + id: git-initial-commit + if: '"${{ steps.find-proj.outputs.is-found }}" == "False"' + uses: powershell/script@v1 + with: + script: git commit -m "Initial Commit" + display: + success: Performed an initial commit + error: Unable to perform an initial commit (${{ steps.git-initial-commit.error-message }}) diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_NoxProject.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_NoxProject.steps.nox.yaml new file mode 100644 index 00000000..15874dee --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_NoxProject.steps.nox.yaml @@ -0,0 +1,11 @@ +steps: + - name: Get the Nox project + id: get-nox-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: ${{ project.versionControl.project }} + display: + success: Got the ${{ project.versionControl.project }} DevOps project + error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) + run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_OutputTable.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_OutputTable.steps.nox.yaml new file mode 100644 index 00000000..fe23f9df --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_OutputTable.steps.nox.yaml @@ -0,0 +1,10 @@ +steps: + - name: Notable properties of the deployment + id: output-table + uses: console/write-table@v1 + with: + lines: + "DevOps Project": "${{ project.versionControl.server }}/${{ project.versionControl.project }}" + "Code Repository": "${{ project.versionControl.server }}/${{ project.versionControl.project }}/_git/${{ project.versionControl.repository }}" + "Internal Api Endpoint": "https://${{ vars.project-dash-name }}-test.ingena-int.work" + "External Api Endpoint": "https://${{ vars.project-dash-name }}-test.ingena.work" \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_ServerInit.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_ServerInit.steps.nox.yaml new file mode 100644 index 00000000..240851e0 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_ServerInit.steps.nox.yaml @@ -0,0 +1,60 @@ +steps: + - name: Get Project dash case name + id: get-project-dash-name + uses: core/to-dash-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project dash case name + error: Unable to get the Project dash case name (${{ steps.get-project-dash-name.error-message }}) + + - name: Get the project snake case name + id: get-project-snake-name + uses: core/to-snake-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project snake case name + error: Unable to get the Project snake case name (${{ steps.get-project-snake-name.error-message }}) + + - name: Get Project Short Name + id: get-project-short-name + uses: core/get-string-capitals@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the project short name. + error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) + + - name: Get the Team Member user name list + id: get-team-uname-list + uses: project/get-team-user-names@v1 + with: + team-members: ${{ project.team.developers }} + display: + success: Got the team user name list + error: Unable to get the team user name list (${{ steps.get-team-uname-list.error-message }}) + + - name: Get the Team Admins user name list + id: get-project-admin-uname-list + uses: project/get-admin-user-names@v1 + with: + team-members: ${{ project.team.developers }} + display: + success: Got the project admins user name list + error: Unable to get the project admins user name list (${{ steps.get-project-admin-list.error-message }}) + + - name: Store setup variables + id: add-setup-vars + uses: core/add-variables@v1 + with: + project-name: ${{ project.versionControl.project }} + project-dash-name: ${{ steps.get-project-dash-name.outputs.result }} + project-snake-name: ${{ steps.get-project-snake-name.outputs.result }} + project-short-name: ${{ steps.get-project-short-name.outputs.lower-result }} + team-user-names: ${{ steps.get-team-uname-list.outputs.user-names }} + admin-user-names: ${{ steps.get-project-admin-uname-list.outputs.user-names }} + tf-folder: heimdall-ms-${{ steps.get-project-dash-name.outputs.result }} + display: + success: Variables stored + error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_SyncRepos.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_SyncRepos.steps.nox.yaml new file mode 100644 index 00000000..655dbb4e --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_SyncRepos.steps.nox.yaml @@ -0,0 +1,34 @@ +steps: + - name: Add the remote repo to local git + id: git-add-remote + uses: powershell/script@v1 + with: + script: git remote add iwgplc ${{ project.versionControl.server }}/${{ project.versionControl.project }}/_git/${{ project.versionControl.repository }} + display: + success: Added the remote repo to local git + error: Unable to add the remote repo to local git (${{ steps.git-add-remote.error-message }}) + + - name: Get a AzDevOps PAT + id: get-devops-pat + uses: azdevops/get-pat@v1 + with: + organization: iwgplc + access-token: ${{ cache.aztoken }} + + - name: Pull the remote repo + id: git-pull-remote + uses: powershell/script@v1 + with: + script: "git -c http.extraHeader=\"Authorization: Basic ${{ steps.get-devops-pat.outputs.base64-result }}\" pull --rebase iwgplc main" + display: + success: Pulled the remote repository + error: Unable to pull the remote repository (${{ steps.git-pull-remote.error-message }}) + + - name: Push local repo to remote + id: git-push-local + uses: powershell/script@v1 + with: + script: "git -c http.extraHeader=\"Authorization: Basic ${{ steps.get-devops-pat.outputs.base64-result }}\" push --set-upstream iwgplc main" + display: + success: Pushed the local changes to remote + error: Unable to push the local changes to remote (${{ steps.git-push-local.error-message }}) \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSolution.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSolution.workflow.nox.yaml new file mode 100644 index 00000000..b6cb913f --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSolution.workflow.nox.yaml @@ -0,0 +1,56 @@ +# NOX Init Solution Command + +name: Initialize a Nox Solution +description: This workflow will initialize a Nox solution and sync it with with Azure AD, Terraform and DevOps + +cli: + branch: init + command: solution + command-alias: sln + description: "|np - Initialize a Nox solution." + examples: + - ["init solution", "--path "] + - ["init sln", "--path "] + +jobs: + local-initialize: + $ref: InitSln_DirSetup.steps.nox.yaml + + server-initialize: + $ref: InitSln_ServerInit.steps.nox.yaml + + connect: + $ref: InitSln_Connect.steps.nox.yaml + + sync-active-directory: + $ref: SyncAzureActiveDirectory.steps.nox.yaml + + sync-version-control: + $ref: SyncVersionControl.steps.nox.yaml + + nox-project: + $ref: InitSln_NoxProject.steps.nox.yaml + + sync-infrastructure: + $ref: SyncInfrastructure.steps.nox.yaml + + sync-helm-chart: + $ref: SyncHelmChart.steps.nox.yaml + + devops-project: + $ref: InitSln_DevopsProject.steps.nox.yaml + + sync-helm-chart-pipeline: + $ref: SyncHelmPipeline.steps.nox.yaml + + sync-project-pipeline: + $ref: SyncProjectPipeline.steps.nox.yaml + + sync-repos: + $ref: InitSln_SyncRepos.steps.nox.yaml + + output-table: + $ref: InitSln_OutputTable.steps.nox.yaml + + + \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/Manifest.cli.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/Manifest.cli.nox.yaml new file mode 100644 index 00000000..73a31b19 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/Manifest.cli.nox.yaml @@ -0,0 +1,33 @@ +# Manifest.cli.nox.yaml + +cli-commands: + - name: new + description: Create new services, entities, loaders, api's, and more + - name: sync + description: Synchronize your project with version control and remote environments + - name: init + description: Initialize your project + +authentication: + provider: azure + tenant-id: 88155c28-f750-4013-91d3-8347ddb3daa7 + +local-task-executor: + secrets: + valid-for: + hours: 12 + providers: + - provider: azure-keyvault + url: https://nox-EDA1DB500EBCEB02.vault.azure.net/ + +remote-task-executor: +# url: https://nox-cli-test.ingena.work + url: http://localhost:8000 + application-id: 750b96e1-e772-48f8-b6b3-84bac1961d9b + secrets: + valid-for: + hours: 12 + providers: + - provider: azure-keyvault + url: https://nox-14356B22BB785E44.vault.azure.net/ + diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/NewNoxService.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/NewNoxService.workflow.nox.yaml new file mode 100644 index 00000000..eb3ff490 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/NewNoxService.workflow.nox.yaml @@ -0,0 +1,74 @@ +# NOX New Service Command + +name: Creates a new NOX service + +cli: + branch: new + command: service + command-alias: sv + description: "|sv - Creates a new NOX app/service" + examples: + - ["new service", "--path "] + +jobs: + new-service: + steps: + - name: Ensuring service definition doesn't exist + id: check-exists + uses: core/add-variables@v1 + with: + service-yaml-exists: ${{ config.name }} != "" + validate: + that: '"${{ config.name }}" == ""' + display: + error: A service definition '${{ config.name }}' already exists in this repo + + - name: Create a new app/service + id: add-new-service + uses: console/prompt-schema@v1 + with: + schema: | + { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "required": ["name"], + "properties": { + "name": { + "type": "string", + "description": "The name of the NOX service", + "default": "MyNoxService" + } + } + } + + - name: Specify the require app/service options + id: add-new-service-options + uses: console/prompt-schema@v1 + with: + schema-url: https://noxorg.dev/schemas/NoxConfiguration.json + include-prompts: ["description","database","versionControl","team"] + exclude-prompts: + - team.developers[0].mobilePhoneNumber + - database.provider + - database.options + - database.connectionString + - database.connectionStringVariable + - versionControl.provider + defaults: + name: ${{ steps.add-new-service.outputs.name }} + description: The ${{ steps.add-new-service.outputs.name }} service + database.name: ${{ steps.add-new-service.outputs.name }}Db + database.server: "localhost" + database.provider: "postgres" + database.port: 5432 + database.user: sa + database.password: Developer*123 + versionControl.provider: azureDevOps + versionControl.server: https://dev.azure.com/iwgplc + versionControl.project: Nox.${{ steps.add-new-service.outputs.name }} + versionControl.repository: ${{ steps.add-new-service.outputs.name }}.Api.V1 + team.developers[0].name: ${{ user.name }} + team.developers[0].userName: ${{ user.upn }} + output-file: + path: ./nox/design + filename: ${{ steps.add-new-service.outputs.name }}.service.nox.yaml diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.steps.nox.yaml new file mode 100644 index 00000000..551bc05e --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.steps.nox.yaml @@ -0,0 +1,161 @@ +steps: + - name: Find the project AAD group + id: find-project-group + uses: azuread/find-group@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + group-name: NOX_PROJECT_${{ project.name }} + display: + success: Searched for the NOX_PROJECT_${{ project.name }} AAD Group + error: Unable to search for the NOX_PROJECT_${{ project.name }} AAD Group (${{ steps.find-project-group.error-message }}) + run-at-server: true + + - name: Store project group id variable + if: '"${{ steps.find-project-group.outputs.is-found }}" == "True"' + id: store-project-group-id + uses: core/add-variables@v1 + with: + project-group-id: ${{ steps.find-project-group.outputs.group-id }} + display: + success: Project group id stored + error: Unable to store project group id ${{ steps.store-project-group-id.error-message }} + + - name: Create the project AAD group if it does not exist + if: '"${{ steps.find-project-group.outputs.is-found }}" == "False"' + id: create-project-group + uses: azuread/create-group@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + group-name: NOX_PROJECT_${{ project.name }} + group-description: ${{ project.description }} + display: + success: Created the NOX_PROJECT_${{ project.name }} AAD group + error: Unable to create the NOX_PROJECT_${{ project.name }} AAD group (${{ steps.create-project-group.error-message }}) + run-at-server: true + + - name: Update project group id variable + if: '"${{ steps.find-project-group.outputs.is-found }}" == "False"' + id: update-project-group-id + uses: core/add-variables@v1 + with: + project-group-id: ${{ steps.create-project-group.outputs.group-id }} + display: + success: Project group id updated + error: Unable to update the project group id ${{ steps.update-project-group-id.error-message }} + + - name: Find the NOX_PROJECTS_ALL AAD group + id: find-nox_projects_all-group + uses: azuread/find-group@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + group-name: NOX_PROJECTS_ALL + display: + success: Searched for the NOX_PROJECTS_ALL AAD Group + error: Unable to search for the NOX_PROJECTS_ALL AAD Group (${{ steps.find-nox_projects_all-group.error-message }}) + run-at-server: true + + - name: Store NOX_PROJECTS_ALL group id variable + id: store-all-group-id + uses: core/add-variables@v1 + with: + all-group-id: ${{ steps.find-nox_projects_all-group.outputs.group-id }} + display: + success: NOX_PROJECTS_ALL group id stored + error: Unable to store NOX_PROJECTS_ALL group id ${{ steps.store-all-group-id.error-message }} + + - name: Create the NOX_PROJECTS_ALL AAD security group + if: '"${{ steps.find-nox_projects_all-group.outputs.is-found }}" == "False"' + id: create-nox-projects-all-group + uses: azuread/create-group@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + group-name: NOX_PROJECTS_ALL + group-description: Nox Projects - Security Group + display: + success: Created the AAD security group + error: Unable to create the AAD security group (${{ steps.create-security-group.error-message }}) + run-at-server: true + + - name: Update NOX_PROJECTS_ALL group id variable + if: '"${{ steps.find-nox_projects_all-group.outputs.is-found }}" == "False"' + id: update-all-group-id + uses: core/add-variables@v1 + with: + all-group-id: ${{ steps.create-nox-projects-all-group.outputs.group-id }} + display: + success: NOX_PROJECTS_ALL group id updated + error: Unable to update NOX_PROJECTS_ALL group id ${{ steps.update-all-group-id.error-message }} + + - name: Add the project group as a member of NOX_PROJECTS_ALL + id: add-project-group-to-all-group + uses: azuread/add-group-to-group@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + child-group-id: ${{ vars.project-group-id }} + parent-group-id: ${{ vars.all-group-id }} + display: + success: Added NOX_PROJECT_${{ project.name }} to NOX_PROJECTS_ALL + error: Unable to add NOX_PROJECT_${{ project.name }} to NOX_PROJECTS_ALL (${{ steps.add-project-group-to-all-group.error-message }}) + run-at-server: true + + - name: Get Team member user object Id list + if: '"${{ steps.get-team-uname-list.outputs.user-names }}" != ""' + id: get-team-obj-id-list + uses: azuread/get-users-object-id-list@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + user-names: ${{ vars.team-user-names }} + display: + success: Got the Team members object ids + error: Unable to get the team members object ids (${{ steps.get-team-obj-id-list.error-message }}) + run-at-server: true + + - name: Get the team admins user object Id list + id: get-team-admin-obj-id-list + uses: azuread/get-users-object-id-list@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + user-names: ${{ vars.admin-user-names }} + display: + success: Got the Team admins object ids + error: Unable to get the team admins object ids (${{ steps.get-team-admin-obj-id-list.error-message }}) + run-at-server: true + + - name: Add project team members to project group + if: '"${{ steps.get-team-uname-list.outputs.user-names }}" != ""' + id: add-members-to-aad-group + uses: azuread/add-users-to-group@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + group-id: ${{ vars.project-group-id }} + user-object-ids: ${{ steps.get-team-obj-id-list.outputs.object-ids }} + display: + success: Added project team members to project group + error: Unable to add project team members to project group (${{ steps.add-members-to-aad-group.error-message }}) + run-at-server: true + + - name: Add project admins to project group + id: add-admins-to-aad-group + uses: azuread/add-users-to-group@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + group-id: ${{ vars.project-group-id }} + user-object-ids: ${{ steps.get-team-admin-obj-id-list.outputs.object-ids }} + is-owner: true + display: + success: Added project team admins to project AAD group + error: Unable to add project admins to project AAD group (${{ steps.add-admins-to-aad-group.error-message }}) + run-at-server: true + + - name: Add Nox.Cli to project group + id: add-cli-to-project-group + uses: azuread/add-user-to-group@v1 + with: + aad-client: ${{ steps.connect-aad.outputs.aad-client }} + group-id: ${{ vars.project-group-id }} + user-object-id: 081ed5f0-1bdf-406a-a2c5-b4f7341bf3ee + is-owner: true + display: + success: Added Nox.Cli to project AAD group + error: Unable to add Nox.Cli to project AAD group (${{ steps.add-cli-to-project-group.error-message }}) + run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.workflow.nox.yaml new file mode 100644 index 00000000..c3d5a9c6 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.workflow.nox.yaml @@ -0,0 +1,335 @@ +# NOX Azure Active Directory Sync Command + +name: Synchronise NOX definition with Azure Active Directory + +cli: + branch: sync + command: azure-active-directory + command-alias: ad + description: "|ad - Synchronises NOX team definition with your Azure Active Directory (AAD)." + examples: + - ["sync azure-active-directory", "--path "] + - ["sync azad", "--path "] + +jobs: + main-setup: + steps: + - name: Get the Team Member user name list + id: get-team-uname-list + uses: project/get-team-user-names@v1 + with: + team-members: ${{ project.team.developers }} + display: + success: Got the team user name list + error: Unable to get the team user name list (${{ steps.get-team-uname-list.error-message }}) + + - name: Get the Team Admins user name list + id: get-project-admin-uname-list + uses: project/get-admin-user-names@v1 + with: + team-members: ${{ project.team.developers }} + display: + success: Got the project admins user name list + error: Unable to get the project admins user name list (${{ steps.get-project-admin-list.error-message }}) + + - name: Store setup variables + id: add-setup-vars + uses: core/add-variables@v1 + with: + project-name: ${{ project.versionControl.project }} + team-user-names: ${{ steps.get-team-uname-list.outputs.user-names }} + admin-user-names: ${{ steps.get-project-admin-uname-list.outputs.user-names }} + display: + success: Setup variables stored + error: Unable to store setup variables (${{ steps.add-setup-vars.error-message }}) + + connect: + steps: + - name: Connect to Azure Active Directory + id: connect-aad + uses: azuread/connect@v1 + with: + tenant-id: ${{ server.secrets.AZURE_TENANT_ID }} + client-id: ${{ server.secrets.AZURE_CLIENT_ID }} + client-secret: ${{ server.secrets.AZURE_CLIENT_SECRET }} + display: + success: Successfully connected to Azure Active Directory + error: Unable to connect to Azure Active Directory + run-at-server: true + + sync-active-directory: + $ref: SyncAzureActiveDirectory.steps.nox.yaml + +#MS Teams +# - name: Find the Project MS Teams, team +# id: find-ms-team +# uses: azuread/find-group@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# group-name: NOX_${{ project.name }} Team +# display: +# success: Searched for the NOX_${{ project.name }} Team +# error: Unable to search for the NOX_${{ project.name }} Team (${{ steps.find-ms-team.error-message }}) +# run-at-server: true +# +# - name: Save the MS Teams, Team Id +# if: '"${{ steps.find-ms-team.outputs.is-found }}" == "True"' +# id: save-team-id +# uses: core/add-variables@v1 +# with: +# team-id: ${{ steps.find-ms-team.outputs.group-id }} +# display: +# success: Saved the Team Id +# error: Unable to save the Team Id (${{ steps.save-team-id.error-message }}) +# +# - name: Create an MS teams, team for the project if it does not exist +# if: '"${{ steps.find-ms-team.outputs.is-found }}" == "False"' +# id: create-ms-team +# uses: teams/create-team@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# aad-group-id: ${{ vars.project-group-id }} +# team-name: NOX_${{ project.name }} Team +# team-description: Team for members of the Nox ${{ project.name }} project +# display: +# success: Created an MS Teams, team for the project +# error: Unable to create an MS Teams, team for the project ($${{ steps.create-ms-team.error-message }}) +# run-at-server: true +# +# - name: Update the MS Teams, Team Id +# if: '"${{ steps.find-ms-team.outputs.is-found }}" == "False"' +# id: update-team-id +# uses: core/add-variables@v1 +# with: +# team-id: ${{ steps.create-ms-team.outputs.team-id }} +# display: +# success: Updated the Team Id +# error: Unable to update the Team Id (${{ steps.update-team-id.error-message }}) +# +# - name: Add Project team members to MS Team +# id: add-members-to-ms-team +# uses: teams/add-members@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# user-object-ids: ${{ steps.get-team-obj-id-list.outputs.object-ids }} +# display: +# success: Added team members to MS Teams, team +# error: Unable to add team members to MS Teams, team (${{ steps.add-members-to-ms-team.error-message }}) +# run-at-server: true +# +# - name: Add Project Admins to MS Team +# id: add-admins-to-ms-team +# uses: teams/add-members@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# user-object-ids: ${{ steps.get-team-admin-obj-id-list.outputs.object-ids }} +# is-owner: true +# display: +# success: Added team admins to MS Teams, team +# error: Unable to add team admins to MS Teams, team (${{ steps.add-admins-to-ms-team.error-message }}) +# run-at-server: true +# +# - name: Add Nox.Cli to MS Team +# id: add-cli-to-ms-team +# uses: teams/add-member@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# object-id: 081ed5f0-1bdf-406a-a2c5-b4f7341bf3ee +# is-owner: true +# display: +# success: Added Nox.Cli to MS Teams, team +# error: Unable to add Nox.Cli to MS Teams, team (${{ steps.add-cli-to-ms-team.error-message }}) +# run-at-server: true +# +# - name: Find the DevOps Team +# id: find-devops-team +# uses: azuread/find-group@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# group-name: IWG DevOps Team +# display: +# success: Searched for the IWG DevOps Team +# error: Unable to search for the IWG DevOps Team (${{ steps.find-devops-team.error-message }}) +# run-at-server: true +# +# - name: Get the DevOps team members +# if: '"${{ steps.find-devops-team.outputs.is-found }}" == "True"' +# id: get-devops-members +# uses: azuread/get-group-member-ids@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# group-id: ${{ steps.find-devops-team.outputs.group-id }} +# display: +# success: Got the DevOps team members +# error: Unable to get the DevOps team members (${{ steps.get-devops-members.error-message }}) +# run-at-server: true +# +# - name: Add DevOps group to MS Team +# if: '"${{ steps.find-devops-team.outputs.is-found }}" == "True"' +# id: add-devops-to-ms-team +# uses: teams/add-members@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# user-object-ids: ${{ steps.get-devops-members.outputs.member-ids }} +# display: +# success: Added DevOps to MS Teams, team +# error: Unable to add DevOps to MS Teams, team (${{ steps.add-devops-to-ms-team.error-message }}) +# run-at-server: true +# +# - name: Find the Cli channel on the MS Teams team +# id: find-cli-channel +# uses: teams/find-channel@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-name: Nox Cli message channel +# display: +# success: Searched for the Cli channel on the MS Teams team (${{ steps.find-cli-channel.outputs.is-found }}) +# error: Unable to search for the Cli channel on the MS Teams team (${{ steps.find-cli-channel.error-message }}) +# run-at-server: true +# +# - name: Save the Channel Id +# if: '"${{ steps.find-cli-channel.outputs.is-found }}" == "True"' +# id: save-channel-id +# uses: core/add-variables@v1 +# with: +# channel-id: ${{ steps.find-cli-channel.outputs.channel-id }} +# display: +# success: Saved the Channel Id in a variable +# error: Unable to save the Channel Id in a variable (${{ steps.save-channel-id.error-message }}) +# +# - name: Create a channel on the MS Team +# if: '"${{ steps.find-cli-channel.outputs.is-found }}" == "False"' +# id: create-cli-channel +# uses: teams/create-channel@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-name: Nox Cli message channel +# channel-description: Channel used by Nox.Cli to message members of the project team +# display: +# success: Created the Cli channel on the MS Teams team +# error: Unable to create the Cli channel on the MS Teams team (${{ steps.create-cli-channel.error-message }}) +# run-at-server: true +# +# - name: Update the Channel Id +# if: '"${{ steps.find-cli-channel.outputs.is-found }}" == "False"' +# id: update-channel-id +# uses: core/add-variables@v1 +# with: +# channel-id: steps.create-cli-channel.outputs.channel-id +# display: +# success: Updated Channel Id +# error: Unable to update Channel Id (${{ steps.update-channel-id.error-message }}) + +# - name: Add Nox.Cli to channel +# id: add-cli-to-channel +# uses: teams/add-channel-member@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-id: ${{ steps.create-cli-channel.outputs.channel-id }} +# object-id: 081ed5f0-1bdf-406a-a2c5-b4f7341bf3ee +# is-owner: true +# display: +# success: Added Nox.Cli to the project team channel +# error: Unable to add Nox.Cli to the project team channel (${{ steps.add-cli-to-channel.error-message }}) +# run-at-server: true + +# - name: Add team members to channel +# id: add-team-to-channel +# uses: teams/add-channel-members@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-id: ${{ steps.create-cli-channel.outputs.channel-id }} +# object-ids: ${{ steps.get-team-obj-id-list.outputs.object-ids }} +# display: +# success: Added project members to the project team channel +# error: Unable to add project members to the project team channel (${{ steps.add-team-to-channel.error-message }}) +# run-at-server: true +# +# - name: Add admins to channel +# id: add-admins-to-channel +# uses: teams/add-channel-members@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-id: ${{ steps.create-cli-channel.outputs.channel-id }} +# object-ids: ${{ steps.get-admin-obj-id-list.outputs.object-ids }} +# is-owner: true +# display: +# success: Added project admins to the project team channel +# error: Unable to add project admins to the project team channel (${{ steps.add-admins-to-channel.error-message }}) +# run-at-server: true + +# - name: Send Test message on project channel +# id: send-project-test-message +# uses: teams/send-channel-message@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-id: ${{ vars.channel-id }} +# message-body: Welcome to the ${{ project.name }} project team! +# display: +# success: Sent a test message to the project team channel +# error: Unable to send a test message to the project team channel (${{ steps.send-project-test-message.error-message }}) +# run-at-server: true +# +# - name: Create a DevOps channel on the MS Team +# id: create-devops-channel +# uses: teams/create-channel@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-name: ${{ project.name }} - DevOps channel +# channel-description: Channel used by Nox.Cli to message DevOps members. +# display: +# success: Created the DevOps channel on the MS Teams team +# error: Unable to create the DevOps channel on the MS Teams team (${{ steps.create-devops-channel.error-message }}) +# run-at-server: true +# +# - name: Add Nox.Cli toDevOps channel +# id: add-cli-to-devops-channel +# uses: teams/add-channel-member@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-id: ${{ steps.create-devops-channel.outputs.channel-id }} +# object-id: 081ed5f0-1bdf-406a-a2c5-b4f7341bf3ee +# is-owner: true +# display: +# success: Added Nox.Cli to the devops channel +# error: Unable to add Nox.Cli to the devops channel (${{ steps.add-cli-to-devops-channel.error-message }}) +# run-at-server: true +# +# - name: Add DevOps group to devops channel +# id: add-devops-to-devops-channel +# uses: teams/add-channel-member@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-id: ${{ steps.create-devops-channel.outputs.channel-id }} +# object-id: e00e4ac2-4318-472b-8c78-8cd8c3a54685 +# display: +# success: Added DevOps to DevOps channel +# error: Unable to add DevOps to DevOps channel (${{ steps.add-devops-to-devops-channel.error-message }}) +# run-at-server: true +# +# - name: Send Test message on DevOps channel +# id: send-devops-test-message +# uses: teams/send-channel-message@v1 +# with: +# aad-client: ${{ steps.connect.outputs.aad-client }} +# team-id: ${{ vars.team-id }} +# channel-id: ${{ steps.create-devops-channel.outputs.channel-id }} +# message-body: Welcome to the ${{ project.name }} DevOps team! +# display: +# success: Sent a test message to the devops team channel +# error: Unable to send a test message to the devops team channel (${{ steps.send-devops-test-message.error-message }}) +# run-at-server: true + diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDatabaseScript.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDatabaseScript.workflow.nox.yaml new file mode 100644 index 00000000..aa2cbdd1 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDatabaseScript.workflow.nox.yaml @@ -0,0 +1,160 @@ +# NOX Database Sync Command + +name: Synchronise NOX Definition with Postgres database + +cli: + branch: sync + command: database + command-alias: db + description: "|db - Ensures hosted database and roles exist for your NOX definition." + examples: + - ["sync database", "--path "] + - ["sync db", "--path "] + +jobs: + sync-database: + steps: + + - name: Locating the database server + id: locate-server + uses: network/ping@v1 + with: + host: ${{ secrets.NOX_PG_SERVER }} + display: + success: Found the database server in ${{ steps.locate-server.outputs.roundtrip-time }} milliseconds + error: The database server is not accesable. Are you connected to the VPN? + + - name: Connecting to the database server + id: connect-server + uses: postgres/connect@v1 + with: + server: ${{ secrets.NOX_PG_SERVER }} + port: 5432 + user: ${{ secrets.NOX_PG_ADMIN_USER }} + password: ${{ secrets.NOX_PG_ADMIN_PASSWORD }} + database: postgres + display: + success: Connected to the database server + error: There was a problem connecting to the database. (${{ steps.connect-server.error-message }}) + + - name: Checking the database version + id: check-version + uses: postgres/execute-scalar@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + sql: SELECT version(); + display: + success: ${{ steps.check-version.outputs.result }} + error: There was a problem with the version check (${{ steps.check-version.error-message }}) + + - name: Sanitizing the database name to avoid Sql injection + id: get-dbname + uses: postgres/sanitize-sql-string@v1 + with: + input-string: NOX_${{ config.Database.Name }} + display: + success: The database name is ${{ steps.get-dbname.outputs.result }} + + - name: Storing the database name in a variable + id: add-var-dbname + uses: core/add-variables@v1 + with: + db-name: ${{ steps.get-dbname.outputs.result }} + display: + success: Variable 'db-name' set to '${{ vars.db-name }}' + + - name: Checking that the project database does not exist + id: db-not-exist + uses: postgres/execute-scalar@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + sql: SELECT datname FROM pg_database WHERE datname=($1); + parameters: ['${{ vars.db-name }}'] + validate: + that: '"${{ steps.db-not-exist.outputs.result }}" != "${{ vars.db-name }}"' + #that: ${{ steps.db-not-exist.outputs.result }} != ${{ vars.db-name }} + display: + success: The database does not exist yet + error: The database already exists + continue-on-error: true + + - name: Creating the project database + id: create-db + #if: ${{ steps.db-not-exist.was-valid }} + if: '"${{ steps.db-not-exist.outputs.result }}" != "${{ vars.db-name }}"' + uses: postgres/execute-nonquery@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + sql: CREATE DATABASE "${{ vars.db-name }}"; + display: + success: The database was succesfully created + error: Failed to create the database (${{ steps.create-db.error-message }}) + + - name: Connecting to the project database + id: connect-db + uses: postgres/connect@v1 + with: + server: ${{ secrets.NOX_PG_SERVER }} + port: 5432 + user: ${{ secrets.NOX_PG_ADMIN_USER }} + password: ${{ secrets.NOX_PG_ADMIN_PASSWORD }} + database: ${{ vars.db-name }} + display: + success: Connected to the project database + error: There was a problem connecting to the project database. (${{ steps.connect-db.error-message }}) + + - name: Creating variables for the database role, admin and password + id: add-other-vars + uses: core/add-variables@v1 + with: + db-role: ${{ vars.db-name }}_owneraccess + db-admin: ${{vars.db-name }}_pg_admin + db-password: ${{ vars.db-name }}_$123 + #db-password: ${{ env.SOME_VARIABLE }}_$123 + display: + success: Variables created succesfully + + - name: Creating admin user and role if needed and assign to admin user + id: create-role + uses: postgres/execute-nonquery@v1 + with: + connection: ${{ steps.connect-db.outputs.connection }} + sql: | + DO + $do$ + BEGIN + IF EXISTS( + SELECT FROM pg_catalog.pg_roles + WHERE rolname = LOWER('${{vars.db-role}}')) THEN + + RAISE NOTICE 'Role "${{vars.db-role}}" already exists. Skipping.'; + ELSE + CREATE ROLE ${{vars.db-role}} WITH LOGIN; + END IF; + END + $do$; + GRANT ALL ON DATABASE "${{vars.db-name}}" TO ${{vars.db-role}}; + GRANT ALL ON SCHEMA public TO ${{vars.db-role}}; + GRANT ALL ON ALL TABLES IN SCHEMA public TO ${{vars.db-role}}; + GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO ${{vars.db-role}}; + GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO ${{vars.db-role}}; + DO + $do$ + BEGIN + IF EXISTS( + SELECT FROM pg_catalog.pg_user + WHERE usename = LOWER('${{vars.db-admin}}')) THEN + + RAISE NOTICE 'User "${{vars.db-admin}}" already exists. Skipping.'; + ELSE + CREATE USER ${{vars.db-admin}} WITH PASSWORD '${{vars.db-password}}'; + END IF; + END + $do$; + -- GRANT ${{vars.db-role}} TO ${{vars.db-admin}}; + ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO ${{vars.db-role}}; + ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO ${{vars.db-role}}; + ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO ${{vars.db-role}}; + display: + success: The admin user and role was created and assigned + error: Failed to create user and role (${{ steps.create-role.error-message }}) diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDns.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDns.steps.nox.yaml new file mode 100644 index 00000000..cb11c956 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDns.steps.nox.yaml @@ -0,0 +1,24 @@ +steps: + - name: Connect to AAD + id: connect + uses: azuread/connect_v1 + with: + tenant-id: ${{ server.secrets.AZURE_TENANT_ID }} + client-id: ${{ server.secrets.AZURE_CLIENT_ID }} + client-secret: ${{ server.secrets.AZURE_CLIENT_SECRET }} + display: + success: Connected to Azure AD + error: Failed to connect to Azure AD ${{ steps.connect.error-message }} + run-at-server: true + + - name: Find CName + id: find-cname + uses: azuread/find-cname-record@v1 + with: + aad-client: ${{ steps.connect.outputs.aad-client }} + resource-group-name: rg_dns_common_prod + zone-name: ingena.work + display: + success: Searched for CName record + error: Unable to search for CName record (${{ steps.find-cname.error-message }}) + run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncElasticAlerts.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncElasticAlerts.workflow.nox.yaml new file mode 100644 index 00000000..f8d0dc7e --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncElasticAlerts.workflow.nox.yaml @@ -0,0 +1,215 @@ +# NOX Elastic APM Alerts Sync Command + +name: Synchronise NOX definition with Elastic APM Alerts + +cli: + branch: sync + command: elastic-apm-alerts + command-alias: apm + description: "|ea - Creates or updates your Elastic APM alerts with NOX definition." + examples: + - ["sync elastic-apm-alerts", "--path "] + - ["sync apm", "--path "] + +jobs: + sync-elastic-apm: + steps: + + - name: Locate the DevOps server + id: locate-server + uses: network/ping@v1 + with: + host: ${{ project.versionControl.server }} + display: + success: Found the DevOps server in ${{ steps.locate-server.outputs.roundtrip-time }} milliseconds + error: The DevOps server is not accesable. Are you connected to the Internet? + run-at-server: true + + - name: Connect to the DevOps server + id: connect-server + uses: azdevops/connect@v1 + with: + server: ${{ project.versionControl.server }} + personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} + display: + success: Connected to the DevOps server + error: There was a problem connecting to the DevOps server. (${{ steps.connect-server.error-message }}) + run-at-server: true + + - name: Get the Nox Team project + id: get-nox-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + project-name: ${{ project.versionControl.project }} + display: + success: Got the ${{ project.versionControl.project }} DevOps project + error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) + run-at-server: true + + - name: Ensure the Project APM Repository exists + id: ensure-nox-apm-repo + uses: azdevops/ensure-repo-exists@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + repository-name: elastic-alert-config + display: + success: Ensured that the project elastic-alert-config repository exists + error: There was a problem ensuring that the project elastic-alert-config repository exists. ${{ steps.ensure-nox-apm-repo.error-message }} + run-at-server: true + + - name: Find the APM main branch + id: find-main + uses: azdevops/find-branch@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} + branch-name: main + display: + success: Sucessfully got the main branch of repo elastic-alert-config + error: There was a problem getting the main branch for repo elastic-alert-config + run-at-server: true + + - name: Get the IWG.APM project + id: get-apm-project + if: '"${{ steps.find-main.outputs.is-found }}" == "False"' + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + project-name: IWG.APM + display: + success: Got the IWG.APM project + error: There was a problem getting the IWG.APM project (${{ steps.get-apm-project.error-message }}) + run-at-server: true + + - name: Get the APM alert config repo + id: get-apm-alert-repo + if: '"${{ steps.find-main.outputs.is-found }}" == "False"' + uses: azdevops/get-repo@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + project-id: ${{ steps.get-apm-project.outputs.project-id }} + repository-name: elastic-alert-config + display: + success: Successfully got the APM alert config repo + error: There was a problem getting the APM alert config repository (${{ steps.get-apm-alert-repo.error-message }}) + run-at-server: true + + - name: Download the APM alert config repo + id: download-apm-repo + if: '"${{ steps.find-main.outputs.is-found }}" == "False"' + uses: azdevops/download-repo-branch@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + repository-id: ${{ steps.get-apm-alert-repo.outputs.repository-id }} + branch-name: main + display: + success: Successfully downloaded branch 'main' of the APM alert config repo to ${{ steps.download-apm-repo.outputs.local-repository-path }} + error: There was a problem downloading the repository (${{ steps.download-apm-repo.error-message }}) + run-at-server: true + + - name: Push APM repo to project main branch + id: push-apm-repo-to-main + if: '"${{ steps.find-main.outputs.is-found }}" == "False"' + uses: azdevops/push-folder@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} + source-path: ${{ steps.download-apm-repo.outputs.local-repository-path }} + display: + success: Push elastic-alert-config to project ${{ project.name }} success + error: Push elastic-alert-config to project ${{ project.name }} failed. (${{ steps.push-apm-repo-to-main.error-message }}) + run-at-server: true + + - name: Create new APM alerts branch + id: create-new-apm-branch + uses: azdevops/create-branch@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} + display: + success: Successfully created new APM alerts branch -> ${{ steps.create-new-apm-branch.outputs.branch-name }} + error: Failed to create new APM alerts branch -> ${{ steps.create-new-apm-branch.outputs.branch-name }} + run-at-server: true + + - name: Download the new APM alerts branch + id: download-apm-branch + uses: azdevops/download-repo-branch@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} + branch-name: ${{ steps.create-new-apm-branch.outputs.branch-name }} + display: + success: Successfully downloaded branch '${{ steps.create-new-apm-branch.outputs.branch-name }}' of the project APM alert config repo to ${{ steps.download-project-apm-repo.outputs.local-repository-path }} + error: There was a problem downloading the project APM config branch (${{ steps.download-apm-branch.error-message }}) + run-at-server: true + + - name: Get team email address list + id: get-team-email-list + uses: core/concatenate-list-property@v1 + with: + source-list: ${{ project.team.developers }} + property-name: Email + display: + success: Successfully created support email address list + error: There was a problem creating the support email address list (${{ steps.get-team-email-list.error-message }}) + + +# Replace apm_anomaly_detected.json + - name: apm_anomaly_detected Replace + id: replace-anomaly + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-apm-branch.outputs.local-repository-path }}/apm_anomaly_detected.json + replacements: + "": ${{ project.versionControl.project }}, + "": ${{ env.ASPNETCORE_ENVIRONMENT }}, + "": ${{ steps.get-team-email-list.outputs.result }} + display: + success: Strings successfully Replaced in anomaly alert + error: Strings Replace in anomaly alert failed. (${{ steps.replace-anomaly.error-message }}) + run-at-server: true + +# Replace apm_high_error_rate.json + - name: apm_high_error_rate Replace + id: replace-high-error + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-apm-branch.outputs.local-repository-path }}/apm_high_error_rate.json + replacements: + "": ${{ project.versionControl.project }}, + "": ${{ env.ASPNETCORE_ENVIRONMENT }}, + "": ${{ steps.get-team-email-list.outputs.result }} + display: + success: Strings successfully Replaced in high error rate alert + error: Strings Replace high error rate alert failed. (${{ steps.replace-high-error.error-message }}) + run-at-server: true + +# Replace apm_high_p95_response_time.json + - name: apm_high_p95_response_time Replace + id: replace-p95 + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-apm-branch.outputs.local-repository-path }}/apm_high_p95_response_time.json + replacements: + "": ${{ project.versionControl.project }}, + "": ${{ env.ASPNETCORE_ENVIRONMENT }}, + "": ${{ steps.get-team-email-list.outputs.result }} + display: + success: Strings successfully Replaced in p95 alert + error: Strings Replace p95 alert failed. (${{ steps.replace-p95.error-message }}) + run-at-server: true + + - name: Push updated apm branch to project apm repo + id: merge-apm-repo + uses: azdevops/merge-folder@v1 + with: + connection: ${{ steps.connect-server.outputs.connection }} + repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} + branch-name: ${{ steps.create-new-apm-branch.outputs.branch-name }} + source-path: ${{ steps.download-apm-branch.outputs.local-repository-path }} + display: + success: Push updated elastic-alert-config to project ${{ project.name }} success + error: Push updated elastic-alert-config to project ${{ project.name }} failed. (${{ steps.merge-apm-repo.error-message }}) + run-at-server: true diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.steps.nox.yaml new file mode 100644 index 00000000..a35474af --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.steps.nox.yaml @@ -0,0 +1,204 @@ +steps: + - name: Ensure the Project helm-chart Repository exists + id: ensure-nox-helm-repo + uses: azdevops/ensure-repo-exists@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + repository-name: ${{ project.versionControl.project }}.Helmchart + display: + success: Ensured that the project helm-chart repository exists + error: There was a problem ensuring that the project helm-chart repository exists. ${{ steps.ensure-nox-helm-repo.error-message }} + run-at-server: true + + - name: Find the helm-chart main branch + id: find-helm-main + uses: azdevops/find-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} + branch-name: main + display: + success: Successfully got the main branch for the helm-chart repo + error: There was a problem getting the main branch for the helm-chart repo ${{ steps.find-helm-main.error-message }} + run-at-server: true + + #Helmchart Project + - name: Get the Cli project + id: get-microservices-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: Heimdall.Microservices + display: + success: Got the Heimdall.Microservices project + error: There was a problem getting the Heimdall.Microservices project (${{ steps.get-microservices-project.error-message }}) + run-at-server: true + + - name: Get the helm chart reference repo + id: get-helm-ref-repo + uses: azdevops/get-repo@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-microservices-project.outputs.project-id }} + repository-name: Template.Helmchart + display: + success: Successfully got the the helm chart reference repo + error: There was a problem getting the helm chart reference repo (${{ steps.get-helm-ref-repo.error-message }}) + run-at-server: true + + - name: Download the helm chart repo + id: download-helm-ref-repo + uses: azdevops/download-repo-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.get-helm-ref-repo.outputs.repository-id }} + branch-name: main + display: + success: Successfully downloaded branch 'main' of the Heimdall helm chart to ${{ steps.download-helm-chart-repo.outputs.local-repository-path }} + error: There was a problem downloading the repository (${{ steps.download-helm-ref-repo.error-message }}) + run-at-server: true + + - name: Push Helm-chart to project main branch + id: push-helm-repo-to-main + if: '"${{ steps.find-helm-main.outputs.is-found }}" == "False"' + uses: azdevops/push-folder@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} + source-path: ${{ steps.download-helm-ref-repo.outputs.local-repository-path }} + display: + success: Push helm-chart to project ${{ project.name }} success + error: Push helm-chart to project ${{ project.name }} failed. (${{ steps.push-helm-repo-to-main.error-message }}) + run-at-server: true + + - name: Create new helm-chart branch + id: create-new-helm-branch + uses: azdevops/create-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} + display: + success: Successfully created new helm-chart branch -> ${{ steps.create-new-helm-branch.outputs.branch-name }} + error: Failed to create new helm-chart branch -> ${{ steps.create-new-helm-branch.outputs.branch-name }} + run-at-server: true + + - name: Download the new helm-chart branch + id: download-helm-branch + uses: azdevops/download-repo-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} + branch-name: ${{ steps.create-new-helm-branch.outputs.branch-name }} + display: + success: Successfully downloaded branch '${{ steps.create-new-helm-branch.outputs.branch-name }}' of the repo to ${{ steps.download-helm-branch.outputs.local-repository-path }} + error: There was a problem downloading the project helm-chart branch (${{ steps.download-helm-branch.error-message }}) + run-at-server: true + + # Copy the reference repo branch over the project branch + - name: Copy reference repo to project repo + id: copy-helm-to-project + uses: file/copy-folder@v1 + with: + source-path: ${{ steps.download-helm-ref-repo.outputs.local-repository-path }} + target-path: ${{ steps.download-helm-branch.outputs.local-repository-path }} + display: + success: Copied reference repo to project repo + error: Unable to copy reference repo to project repo (${{ steps.copy-helm-to-project.error-message }}) + run-at-server: true + + # Replace values.yaml + - name: Values.yaml Replace + id: replace-values-yaml + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values.yaml + replacements: + "servicePlaceholderName": ${{ vars.project-dash-name }} + "serviceVaultName": we-test-mp-kv-${{ vars.project-short-name }} + display: + success: Strings Replace in values.yaml success + error: Strings Replace in values.yaml failed. (${{ steps.replace-values-yaml.error-message }}) + run-at-server: true + + # Replace chart.yaml + - name: Chart.yaml Replace + id: replace-chart-yaml + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/Chart.yaml + replacements: + "servicePlaceholderName": ${{ vars.project-dash-name }} + display: + success: Strings Replace in Chart.yaml success + error: Strings Replace in Chart.yaml failed. (${{ steps.replace-chart-yaml.error-message }}) + run-at-server: true + + + # Replace values-local.yaml + - name: Values-local.yaml Replace + id: replace-values-local-yaml + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values-local.yaml + replacements: + "servicePlaceholderName": ${{ vars.project-dash-name }} + display: + success: Strings Replace values-local.yaml success + error: Strings Replace values-local.yaml failed. (${{ steps.replace-values-local-yaml.error-message }}) + run-at-server: true + + # Replace values-production.yaml + - name: Values-production.yaml Replace + id: replace-values-production-yaml + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values-production.yaml + replacements: + "servicePlaceholderName": ${{ vars.project-dash-name }} + "serviceVaultName": we-prod-mp-kv-${{ vars.project-short-name }} + display: + success: Strings Replace values-production.yaml success + error: Strings Replace values-production.yaml failed. (${{ steps.replace-values-production-yaml.error-message }}) + run-at-server: true + + # Replace values-test.yaml + - name: Values-test.yaml Replace + id: replace-values-test-yaml + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values-test.yaml + replacements: + "servicePlaceholderName": ${{ vars.project-dash-name }} + "serviceVaultName": we-test-mp-kv-${{ vars.project-short-name }} + display: + success: Strings Replace values-test.yaml success + error: Strings Replace values-test.yaml failed. (${{ steps.replace-values-test-yaml.error-message }}) + run-at-server: true + + # Replace values-uat.yaml + - name: Values-uat.yaml Replace + id: replace-values-uat-yaml + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values-uat.yaml + replacements: + "servicePlaceholderName": ${{ vars.project-dash-name }} + "serviceVaultName": we-uat-mp-kv-${{ vars.project-short-name }} + display: + success: Strings Replace values-uat.yaml success + error: Strings Replace values-uat.yaml failed. (${{ steps.replace-values-uat-yaml.error-message }}) + run-at-server: true + + - name: Push updated helm branch to project helm-chart repo + id: merge-helm-repo + uses: azdevops/merge-folder@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} + branch-name: ${{ steps.create-new-helm-branch.outputs.branch-name }} + source-path: ${{ steps.download-helm-branch.outputs.local-repository-path }} + display: + success: Push updated helm-chart to project ${{ project.name }} success + error: Push updated helm-chart to project ${{ project.name }} failed. (${{ steps.merge-helm-repo.error-message }}) + run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.workflow.nox.yaml new file mode 100644 index 00000000..500cdb07 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.workflow.nox.yaml @@ -0,0 +1,93 @@ +# NOX Heimdall Helm Chart Sync Command + +name: Synchronise NOX definition with Heimdall Helm Chart + +cli: + branch: sync + command: helm-chart + command-alias: hc + description: "|hc - Creates or updates your Heimdall Helm Chart with NOX definition." + examples: + - ["sync helm-chart", "--path "] + - ["sync hc", "--path "] + +jobs: + main-setup: + steps: + - name: Get Project dash case name + id: get-project-dash-name + uses: core/to-dash-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project dash case name + error: Unable to get the Project dash case name (${{ steps.get-project-dash-name.error-message }}) + + - name: Get the project snake case name + id: get-project-snake-name + uses: core/to-snake-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project snake case name + error: Unable to get the Project snake case name (${{ steps.get-project-snake-name.error-message }}) + + - name: Get Project Short Name + id: get-project-short-name + uses: core/get-string-capitals@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the project short name. + error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) + + - name: Store setup variables + id: add-setup-vars + uses: core/add-variables@v1 + with: + project-name: ${{ project.versionControl.project }} + project-dash-name: ${{ steps.get-project-dash-name.outputs.result }} + project-snake-name: ${{ steps.get-project-snake-name.outputs.result }} + project-short-name: ${{ steps.get-project-short-name.outputs.lower-result }} + display: + success: Variables stored + error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} + + connect: + steps: + - name: Locate the DevOps server + id: locate-devops + uses: network/ping@v1 + with: + host: ${{ project.versionControl.server }} + display: + success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds + error: The DevOps server is not accessible. Are you connected to the Internet? + run-at-server: true + + - name: Connect to the DevOps server + id: connect-devops + uses: azdevops/connect@v1 + with: + server: ${{ project.versionControl.server }} + personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} + display: + success: Connected to the DevOps server + error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) + run-at-server: true + + - name: Get the Nox Team project + id: get-nox-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: ${{ project.versionControl.project }} + display: + success: Got the ${{ project.versionControl.project }} DevOps project + error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) + run-at-server: true + + + sync-heimdall-helm-chart: + $ref: SyncHelmChart.steps.nox.yaml + diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.steps.nox.yaml new file mode 100644 index 00000000..9b983da0 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.steps.nox.yaml @@ -0,0 +1,236 @@ +steps: + - name: Get the Project helm-chart Repository + id: get-helm-repo + uses: azdevops/get-repo@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + repository-name: ${{ project.versionControl.project }}.Helmchart + display: + success: Got the project helm-chart repository + error: Unable to get the project helm-chart repository. ${{ steps.ensure-nox-helm-repo.error-message }} + run-at-server: true + + #Service Endpoints + #APPS_EU_PLATFORM_N service endpoint + - name: Check if the APPS_EU_PLATFORM_N service endpoint exists + id: verify-platform-n-se-helm + uses: azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + service-endpoint-name: APPS_EU_PLATFORM_N + display: + success: Checked if APPS_EU_PLATFORM_N service endpoint exists + error: Unable to check if APPS_EU_PLATFORM_N service endpoint exists (${{ steps.verify-platform-n-se-helm.error-message }}) + run-at-server: true + + - name: Find the APPS_EU_PLATFORM_N service endpoint + if: '"${{ steps.verify-platform-n-se-helm.outputs.is-found }}" == "False"' + id: find-platform-n-se-helm + uses: + azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-devops-project.outputs.project-id }} + service-endpoint-name: APPS_EU_PLATFORM_N + display: + success: Searched for APPS_EU_PLATFORM_N service endpoint in Nox.Cli + error: Unable to search for APPS_EU_PLATFORM_N service endpoint in Nox.Cli (${{ steps.find-platform-n-se-helm.error-message }}) + run-at-server: true + + - name: Share the APPS_EU_PLATFORM_N service endpoint + if: '"${{ steps.verify-platform-n-se-helm.outputs.is-found }}" == "False"' + id: share-platform-n-se-helm + uses: azdevops/share-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + service-endpoint-id: ${{ steps.find-platform-n-se-helm.outputs.service-endpoint-id }} + service-endpoint-name: APPS_EU_PLATFORM_N + project-id: ${{ steps.get-nox-project.outputs.project-id }} + project-name: ${{ project.versionControl.project }} + display: + success: Shared the APPS_EU_PLATFORM_N service connection with ${{ project.name }} + error: Unable to share the APPS_EU_PLATFORM_N service connection with ${{ project.name }} (${{ steps.share-platform-n-se-helm.error-message }}) + run-at-server: true + + #APPS_EU_PLATFORM_P service endpoint + - name: Check if the APPS_EU_PLATFORM_P service endpoint exists + id: verify-platform-p-se-helm + uses: azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + service-endpoint-name: APPS_EU_PLATFORM_P + display: + success: Checked if APPS_EU_PLATFORM_P service endpoint exists + error: Unable to check if APPS_EU_PLATFORM_P service endpoint exists (${{ steps.verify-platform-p-se-helm.error-message }}) + run-at-server: true + + - name: Find the APPS_EU_PLATFORM_P service endpoint + if: '"${{ steps.verify-platform-p-se-helm.outputs.is-found }}" == "False"' + id: find-platform-p-se-helm + uses: + azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-devops-project.outputs.project-id }} + service-endpoint-name: APPS_EU_PLATFORM_P + display: + success: Searched for APPS_EU_PLATFORM_P service endpoint in Nox.Cli + error: Unable to search for APPS_EU_PLATFORM_P service endpoint in Nox.Cli (${{ steps.find-platform-p-se-helm.error-message }}) + run-at-server: true + + - name: Share the APPS_EU_PLATFORM_P service endpoint + if: '"${{ steps.verify-platform-p-se-helm.outputs.is-found }}" == "False"' + id: share-platform-p-se-helm-helm + uses: azdevops/share-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + service-endpoint-id: ${{ steps.find-platform-p-se-helm.outputs.service-endpoint-id }} + service-endpoint-name: APPS_EU_PLATFORM_P + project-id: ${{ steps.get-nox-project.outputs.project-id }} + project-name: ${{ project.versionControl.project }} + display: + success: Shared the APPS_EU_PLATFORM_P service connection with ${{ project.name }} + error: Unable to share the APPS_EU_PLATFORM_P service connection with ${{ project.name }} (${{ steps.share-platform-p-se-helm-helm.error-message }}) + run-at-server: true + + #SonarCloud service endpoint + - name: Check if the SonarCloud service endpoint exists + id: verify-sonarcloud-se-helm + uses: azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + service-endpoint-name: SonarCloud + display: + success: Checked if SonarCloud service endpoint exists + error: Unable to check if SonarCloud service endpoint exists (${{ steps.verify-sonarcloud-se-helm.error-message }}) + run-at-server: true + + - name: Find the SonarCloud service endpoint + if: '"${{ steps.verify-sonarcloud-se-helm.outputs.is-found }}" == "False"' + id: find-sonarcloud-se-helm + uses: + azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-devops-project.outputs.project-id }} + service-endpoint-name: SonarCloud + display: + success: Searched for SonarCloud service endpoint in Nox.Cli + error: Unable to search for SonarCloud service endpoint in Nox.Cli (${{ steps.find-sonarcloud-se-helm.error-message }}) + run-at-server: true + + - name: Share the SonarCloud service endpoint + if: '"${{ steps.verify-sonarcloud-se-helm.outputs.is-found }}" == "False"' + id: share-sonarcloud-se-helm + uses: azdevops/share-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + service-endpoint-id: ${{ steps.find-sonarcloud-se-helm.outputs.service-endpoint-id }} + service-endpoint-name: SonarCloud + project-id: ${{ steps.get-nox-project.outputs.project-id }} + project-name: ${{ project.versionControl.project }} + display: + success: Shared the SonarCloud service connection with ${{ project.name }} + error: Unable to share the SonarCloud service connection with ${{ project.name }} (${{ steps.share-sonarcloud-se-helm.error-message }}) + run-at-server: true + + #weacrheimdallpreprod service endpoint + - name: Check if the weacrheimdallpreprod service endpoint exists + id: verify-weacrheimdallpreprod-se-helm + uses: azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + service-endpoint-name: weacrheimdallpreprod + display: + success: Checked if weacrheimdallpreprod service endpoint exists + error: Unable to check if weacrheimdallpreprod service endpoint exists (${{ steps.verify-weacrheimdallpreprod-se-helm.error-message }}) + run-at-server: true + + - name: Find the weacrheimdallpreprod service endpoint + if: '"${{ steps.verify-weacrheimdallpreprod-se-helm.outputs.is-found }}" == "False"' + id: find-weacrheimdallpreprod-se-helm + uses: + azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-devops-project.outputs.project-id }} + service-endpoint-name: weacrheimdallpreprod + display: + success: Searched for weacrheimdallpreprod service endpoint in Nox.Cli + error: Unable to search for weacrheimdallpreprod service endpoint in Nox.Cli (${{ steps.find-weacrheimdallpreprod-se-helm.error-message }}) + run-at-server: true + + - name: Share the weacrheimdallpreprod service endpoint + if: '"${{ steps.verify-weacrheimdallpreprod-se-helm.outputs.is-found }}" == "False"' + id: share-weacrheimdallpreprod-se-helm + uses: azdevops/share-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + service-endpoint-id: ${{ steps.find-weacrheimdallpreprod-se-helm.outputs.service-endpoint-id }} + service-endpoint-name: weacrheimdallpreprod + project-id: ${{ steps.get-nox-project.outputs.project-id }} + project-name: ${{ project.versionControl.project }} + display: + success: Shared the weacrheimdallpreprod service connection with ${{ project.name }} + error: Unable to share the weacrheimdallpreprod service connection with ${{ project.name }} (${{ steps.share-weacrheimdallpreprod-se-helm.error-message }}) + run-at-server: true + + #Helm-chart pipeline + - name: Find Helm Chart pipeline + id: find-helm-pipeline + uses: azdevops/find-build-definition@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + build-name: ${{ project.versionControl.project }}.HelmChart + display: + success: Searched for the helm chart pipeline + error: Unable to search for the helm chart pipeline (${{ steps.find-helm-pipeline.error-message }}) + run-at-server: true + + - name: Authorize the Helm Chart pipeline + id: auth-helm-pipeline-update + if: '"${{ steps.find-helm-pipeline.outputs.is-found }}" == "True"' + uses: azdevops/authorize-build-definition@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + build-definition-id: ${{ steps.find-helm-pipeline.outputs.build-definition-id }} + display: + success: Authorized the Helm Chart build definition endpoints + error: Unable to authorize the Helm Chart build definition endpoints (${{ steps.auth-helm-pipeline-update.error-message }}) + run-at-server: true + + - name: Create the Helm Chart pipeline if it does not exist + id: create-helm-pipeline + if: '"${{ steps.find-helm-pipeline.outputs.is-found }}" == "False"' + uses: azdevops/create-build-definition@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + repository-id: ${{ steps.get-helm-repo.outputs.repository-id }} + yaml-file-path: azure-pipelines.yml + build-name: ${{ project.versionControl.project }}.HelmChart + agent-pool: Azure Pipelines + display: + success: Created the Helm Chart build pipeline + error: Unable to create the Helm Chart build pipeline (${{ steps.create-helm-pipeline.error-message }}) + run-at-server: true + + - name: Authorize the Helm Chart pipeline + id: auth-helm-pipeline-new + if: '"${{ steps.find-helm-pipeline.outputs.is-found }}" == "False"' + uses: azdevops/authorize-build-definition@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + build-definition-id: ${{ steps.create-helm-pipeline.outputs.build-definition-id }} + display: + success: Authorized the Helm Chart build definition endpoints + error: Unable to authorize the Helm Chart build definition endpoints (${{ steps.auth-helm-pipeline-new.error-message }}) + run-at-server: true diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.workflow.nox.yaml new file mode 100644 index 00000000..05e0c338 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.workflow.nox.yaml @@ -0,0 +1,61 @@ +# NOX Helm Chart Pipeline Sync Command + +name: Synchronise the Helm Chart ADO pipeline of your Nox project + +cli: + branch: sync + command: helmchart-pipeline + command-alias: hcpipe + description: "|helmchart-pipeline - Synchronise the Helm Chart ADO pipeline of your Nox project." + examples: + - ["sync helmchart-pipeline", "--path "] + - ["sync hcpipe", "--path "] + +jobs: + connect: + steps: + - name: Locate the DevOps server + id: locate-server + uses: network/ping@v1 + with: + host: ${{ project.versionControl.server }} + display: + success: Found the DevOps server in ${{ steps.locate-server-hc.outputs.roundtrip-time }} milliseconds + error: The DevOps server is not accessible. Are you connected to the Internet? + run-at-server: true + + - name: Connect to the DevOps server + id: connect-devops + uses: azdevops/connect@v1 + with: + server: ${{ project.versionControl.server }} + personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} + display: + success: Connected to the DevOps server + error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops-hc.error-message }}) + run-at-server: true + + - name: Get the current Nox project + id: get-nox-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: ${{ project.versionControl.project }} + display: + success: Got the ${{ project.versionControl.project }} DevOps project + error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) + run-at-server: true + + - name: Get the DevOps project + id: get-devops-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: IWG.DevOps + display: + success: Got the DevOps project + error: Unable to get the DevOps project (${{ steps.get-devops-project.error-message }}) + run-at-server: true + + sync-pipeline: + $ref: SyncHelmPipeline.steps.nox.yaml \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.steps.nox.yaml new file mode 100644 index 00000000..4324b0fe --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.steps.nox.yaml @@ -0,0 +1,573 @@ +steps: + - name: Get the Heimdall.Microservices project + id: get-heimdall-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: Heimdall.Microservices + display: + success: Got the Heimdall.Microservices project + error: There was a problem getting the Heimdall.Microservices project (${{ steps.get-heimdall-project.error-message }}) + run-at-server: true + + - name: Get the Terraform project + id: get-terraform-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: Terraform + display: + success: Got the Terraform project + error: There was a problem getting the Terraform project (${{ steps.get-heimdall-project.error-message }}) + run-at-server: true + + - name: Ensure the Infrastructure Repository exists + id: ensure-infra-repo + uses: azdevops/ensure-repo-exists@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + repository-name: ${{ vars.project-dash-name }}-infrastructure-tf + display: + success: Ensured that the project infrastructure repository exists + error: There was a problem ensuring that the project infrastructure repository exists. ${{ steps.ensure-infra-repo.error-message }} + run-at-server: true + + - name: Find the project infra main branch + id: find-infra-main + uses: azdevops/find-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} + branch-name: main + display: + success: Successfully got the main branch for the infrastructure repo + error: There was a problem getting the main branch for the infrastructure repo ${{ steps.find-infra-main.error-message }} + run-at-server: true + + - name: Get the Heimdall.Microservices Template.Terraform.Microservices repo + id: get-ref-infra-repo + uses: azdevops/get-repo@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-heimdall-project.outputs.project-id }} + repository-name: Template.Terraform.Microservices + display: + success: Successfully got the reference infrastructure repo + error: There was a problem getting the reference infrastructure repository (${{ steps.get-ref-infra-repo.error-message }}) + run-at-server: true + + - name: Download the reference infrastructure repo + id: download-ref-infra-repo + uses: azdevops/download-repo-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.get-ref-infra-repo.outputs.repository-id }} + branch-name: main + display: + success: Successfully downloaded branch 'main' of the reference infrastructure repo to ${{ steps.download-ref-infra-repo.outputs.local-repository-path }} + error: There was a problem downloading the reference infrastructure repository (${{ steps.download-ref-infra-repo.error-message }}) + run-at-server: true + + - name: Push the reference infra repo to Nox project infra main branch + if: '"${{ steps.find-infra-main.outputs.is-found }}" == "False"' + id: push-infra-repo-to-main + uses: azdevops/push-folder@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} + source-path: ${{ steps.download-ref-infra-repo.outputs.local-repository-path }} + display: + success: Push the reference infrastructure repo to Nox project ${{ project.name }} success + error: Unable to push the reference infrastructure repo to Nox project ${{ project.name }} failed. (${{ steps.push-infra-repo-to-main.error-message }}) + run-at-server: true + + - name: Create a new Infrastructure branch + id: create-new-infra-branch + uses: azdevops/create-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} + display: + success: Successfully created new Infrastructure branch -> ${{ steps.create-new-infra-branch.outputs.branch-name }} + error: Failed to create new Infrastructure branch -> ${{ steps.create-new-infra-branch.outputs.branch-name }} + run-at-server: true + + - name: Download the new Infrastructure branch + id: download-infra-branch + uses: azdevops/download-repo-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} + branch-name: ${{ steps.create-new-infra-branch.outputs.branch-name }} + display: + success: Successfully downloaded branch '${{ steps.create-new-infra-branch.outputs.branch-name }}' of the repo to ${{ steps.download-infra-branch.outputs.local-repository-path }} + error: There was a problem downloading the project helm-chart branch (${{ steps.download-infra-branch.error-message }}) + run-at-server: true + + # Copy the reference repo branch over the project infra branch + - name: Copy reference repo to project repo + id: copy-infra-to-project + uses: file/copy-folder@v1 + with: + source-path: ${{ steps.download-ref-infra-repo.outputs.local-repository-path }} + target-path: ${{ steps.download-infra-branch.outputs.local-repository-path }} + display: + success: Copied reference repo to project repo + error: Unable to copy reference repo to project repo (${{ steps.copy-infra-to-project.error-message }}) + run-at-server: true + + - name: Get the project product owner email addresses + id: get-product-owners + uses: project/get-owner-emails@v1 + with: + team-members: ${{ project.team.developers }} + display: + success: Got the project product owner email addresses + error: Unable to the project product owner email addresses (${{ steps.get-product-owners.outputs.error-message }}) + + # Replace variables.tf + - name: variables.tf Replace + id: replace-variables-tf + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-infra-branch.outputs.local-repository-path }}/variables.tf + replacements: + "": ${{ steps.get-product-owners.outputs.owner-emails }} + "": ${{ vars.project-short-name }} + "": ${{ vars.project-dash-name }} + "": ${{ project.description }} + "": NOX_PROJECT_${{ project.name }} + display: + success: Strings Replace in values.yaml success + error: Strings Replace in values.yaml failed. (${{ steps.replace-values-yaml.error-message }}) + run-at-server: true + + - name: Push updated infra branch to project repo + id: merge-infra-branch + uses: azdevops/merge-folder@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} + branch-name: ${{ steps.create-new-infra-branch.outputs.branch-name }} + source-path: ${{ steps.download-infra-branch.outputs.local-repository-path }} + reference-date-time: ${{ steps.download-infra-branch.outputs.download-date-time }} + display: + success: Push updated infrastructure branch to terraform success + error: Push updated infrastructure branch to terraform failed. (${{ steps.merge-infra-branch.error-message }}) + run-at-server: true + + # tfe section + - name: Get the Terraform tfe-manage-workspaces repo + id: get-terraform-tfe-manage-workspaces-repo + uses: azdevops/get-repo@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-terraform-project.outputs.project-id }} + repository-name: tfe-manage-workspaces + display: + success: Successfully got the Terraform tfe-manage-workspaces repo + error: There was a problem getting the Terraform tfe-manage-workspacesrepository (${{ steps.get-terraform-tfe-manage-workspaces-repo.error-message }}) + run-at-server: true + + - name: Create a new tfe-manage-workspaces branch + id: create-new-tfe-manage-workspaces-branch + uses: azdevops/create-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.get-terraform-tfe-manage-workspaces-repo.outputs.repository-id }} + display: + success: Successfully created new tfe-manage-workspaces branch -> ${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }} + error: Failed to create new tfe-manage-workspaces branch -> ${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }} + run-at-server: true + + - name: Download the new tfe-manage-workspaces branch + id: download-tfe-manage-workspaces-branch + uses: azdevops/download-repo-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.get-terraform-tfe-manage-workspaces-repo.outputs.repository-id }} + branch-name: ${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }} + display: + success: Successfully downloaded branch '${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }}' of the repo to ${{ steps.download-tfe-manage-workspaces-branch.outputs.local-repository-path }} + error: There was a problem downloading the tfe-manage-workspaces branch (${{ steps.download-tfe-manage-workspaces-branch.error-message }}) + run-at-server: true + + - name: Store tfe variables + id: add-tfe-vars + uses: core/add-variables@v1 + with: + branch-folder: ${{ steps.download-tfe-manage-workspaces-branch.outputs.local-repository-path }} + display: + success: Save the tfe Variables + error: Unable to store tfe variables (${{ steps.add-tfe-vars.error-message }}) + + - name: Ensure microservice sub folder exists + id: ensure-tf-sub-folder + uses: file/ensure-folder@v1 + with: + path: ${{ vars.branch-folder }} + folder-name: ${{ vars.tf-folder }} + display: + success: Ensured that microservice sub folder exists + error: Unable to ensure that the microservice sub folder exists ${{ steps.ensure-tf-sub-folder.error-message }} + run-at-server: true + + #outputs.tf + - name: Delete outputs.tf terraform file if it exists + id: delete-outputs-tf-file + uses: file/delete-file@v1 + with: + path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/outputs.tf + display: + success: Ensured that outputs.tf terraform file does not exist + error: unable to delete outputs.tf terraform file (${{ steps.delete-outputs-tf-file.error-message }}) + run-at-server: true + + - name: Load outputs.tf terraform file template + id: load-outputs-tf-template + uses: core/load-template@v1 + with: + path: terraform/outputs.tf + display: + success: Loaded outputs.tf terraform template + error: Unable to load outputs.tf template (${{ steps.load-outputs-tf-template.error-message }}) + run-at-server: true + + - name: Interpolate outputs.tf template variables + id: interpolate-outputs-tf-file-template + uses: core/replace-strings@v1 + with: + source-string: ${{ steps.load-outputs-tf-template.outputs.result }} + replacements: + "": output "test_we" { value = module.test_we.workspaces["${local.app_name}_test_we"].id } + "": output "test_ne" { value = module.test_ne.workspaces["${local.app_name}_test_ne"].id } + "": "" + "": "" + "": "" + "": "" + display: + success: Interpolated outputs.tf template variables + error: Unable to interpolated outputs.tf template variables ${{ steps.interpolate-outputs-tf-file-template.error-message }} + run-at-server: true + + - name: Save outputs.tf terraform file + id: save-outputs-tf-file + uses: file/write-text@v1 + with: + path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/outputs.tf + text-to-write: ${{ steps.interpolate-outputs-tf-file-template.outputs.result }} + display: + success: Saved outputs.tf + error: Unable to save outputs.tf ${{ steps.save-outputs-tf-file.error-message }} + run-at-server: true + + #Add test-vars.tf + - name: Delete test-vars.tf terraform file if it exists + id: delete-test-tf-file + uses: file/delete-file@v1 + with: + path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/test-vars.tf + display: + success: Ensured that test-vars.tf terraform file does not exist + error: Unable to delete test-vars.tf terraform file (${{ steps.delete-test-tf-file.error-message }}) + run-at-server: true + + - name: Load test-vars.tf terraform file template + id: load-vars-tf-template + uses: core/load-template@v1 + with: + path: terraform/env-vars.tf + display: + success: Loaded env-vars.tf terraform template + error: Unable to load env-vars.tf terraform template (${{ steps.load-vars-tf-template.error-message }}) + run-at-server: true + + - name: replace env-vars.tf template variables + id: interpolate-test-tf-file-template + uses: core/replace-strings@v1 + with: + source-string: ${{ steps.load-vars-tf-template.outputs.result }} + replacements: + "": test + "": ${{ vars.project-dash-name }}-test + display: + success: Interpolated test-vars.tf template variables + error: Unable to interpolated test-vars.tf template variables ${{ steps.interpolate-test-tf-file-template.error-message }} + run-at-server: true + + - name: Save test-vars.tf terraform file + id: save-test-tf-file + uses: file/write-text@v1 + with: + path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/test-vars.tf + text-to-write: ${{ steps.interpolate-test-tf-file-template.outputs.result }} + display: + success: Saved test-vars.tf terraform file + error: Unable to save test-vars.tf (${{ steps.save-test-tf-file.error-message }}) + run-at-server: true + + #Add tfc-workspace.tf + - name: Delete tfc-workspace.tf terraform file if it exists + id: delete-tfc-workspace-tf-file + uses: file/delete-file@v1 + with: + path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/tfc-workspace.tf + display: + success: Ensured that tfc-workspace.tf terraform file does not exist + error: Unable to delete tfc-workspace.tf terraform file (${{ steps.delete-tfc-workspace-tf-file.error-message }}) + run-at-server: true + + - name: Load tfc-workspace.tf terraform file template + id: load-tfc-workspace-template + uses: core/load-template@v1 + with: + path: terraform/tfc-workspace.tf + display: + success: Loaded tfc-workspace.tf terraform template + error: Unable to load tfc-workspace.tf terraform template (${{ steps.load-tfc-workspace-template.error-message }}) + run-at-server: true + + - name: replace tfc-workspace.tf template variables + id: interpolate-tfc-workspace-template + uses: core/replace-strings@v1 + with: + source-string: ${{ steps.load-tfc-workspace-template.outputs.result }} + replacements: + "": ${{ vars.project-name }} + "": ${{ vars.project-snake-name }} + "": ${{ vars.project-dash-name }} + display: + success: Interpolated tfc-workspace.tf template variables + error: Unable to interpolated tfc-workspace.tf template variables ${{ steps.interpolate-tfc-workspace-template.error-message }} + run-at-server: true + + - name: Save tfc-workspace.tf terraform file + id: save-tfc-workspace-file + uses: file/write-text@v1 + with: + path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/tfc-workspace.tf + text-to-write: ${{ steps.interpolate-tfc-workspace-template.outputs.result }} + display: + success: Saved tfc-workspace.tf terraform file + error: Unable to save tfc-workspace.tf (${{ steps.save-tfc-workspace-file.error-message }}) + run-at-server: true + + #Add variables.tf + - name: Delete variables.tf terraform file if it exists + id: delete-infra-variables-tf-file + uses: file/delete-file@v1 + with: + path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/variables.tf + display: + success: Ensured that variables.tf terraform file does not exist + error: Unable to delete variables.tf terraform file (${{ steps.delete-infra-variables-tf-file.error-message }}) + run-at-server: true + + - name: Load variables.tf terraform file template + id: load-variables-template + uses: core/load-template@v1 + with: + path: terraform/variables.tf + display: + success: Loaded variables.tf terraform template + error: Unable to load variables.tf terraform template (${{ steps.load-variables-template.error-message }}) + run-at-server: true + + - name: Save variables.tf terraform file + id: save-variables-file + uses: file/write-text@v1 + with: + path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/variables.tf + text-to-write: ${{ steps.load-variables-template.outputs.result }} + display: + success: Saved variables.tf terraform file + error: Unable to save variables.tf (${{ steps.save-variables-file.error-message }}) + run-at-server: true + + #Add heimdall-ms-microservice.tf + - name: Delete heimdall-ms-.tf terraform file if it exists + id: delete-microservice-tf-file + uses: file/delete-file@v1 + with: + path: ${{ vars.branch-folder }}/heimdall-ms-${{ vars.project-dash-name }}.tf + display: + success: Ensured that heimdall-ms-.tf terraform file does not exist + error: Unable to delete heimdall-ms-.tf terraform file (${{ steps.delete-microservice-tf-file.error-message }}) + run-at-server: true + + - name: Load heimdall-ms-microservice.tf terraform file template + id: load-microservice-template + uses: core/load-template@v1 + with: + path: terraform/heimdall-ms-microservice.tf + display: + success: Loaded heimdall-ms-microservice.tf terraform template + error: Unable to load heimdall-ms-microservice.tf terraform template (${{ steps.load-microservice-template.error-message }}) + run-at-server: true + + - name: replace heimdall-ms-microservice.tf template variables + id: interpolate-microservice-template + uses: core/replace-strings@v1 + with: + source-string: ${{ steps.load-microservice-template.outputs.result }} + replacements: + "": ${{ vars.project-dash-name }} + "": ${{ vars.project-snake-name }} + display: + success: Interpolated heimdall-ms-microservice.tf template variables + error: Unable to interpolated heimdall-ms-microservice.tf template variables ${{ steps.interpolate-microservice-template.error-message }} + run-at-server: true + + - name: Save microservice-template terraform file + id: save-microservice-file + uses: file/write-text@v1 + with: + path: ${{ vars.branch-folder }}/heimdall-ms-${{ vars.project-dash-name }}.tf + text-to-write: ${{ steps.interpolate-microservice-template.outputs.result }} + display: + success: Saved variables.tf terraform file + error: Unable to save variables.tf (${{ steps.save-microservice-file.error-message }}) + run-at-server: true + + #Add workspaces ids to tfe_variable_set.tf + - name: Read the tfe_variable_set.tf file + id: load-tfe-variable-set-file + uses: file/read-text@v1 + with: + path: ${{ vars.branch-folder }}/tfe_variable_set.tf + display: + success: Loaded the tfe_variable_set.tf file + error: Unable to load the tfe_variable_set.tf file ${{ steps.load-tfe-variable-set-file.error-message }} + run-at-server: true + + #tenant workspace ids + - name: Add the tenant workspace ids if they do not exist + id: add-workspace-ids + uses: hcl/add-values@v1 + with: + source-hcl: ${{ steps.load-tfe-variable-set-file.outputs.result-string }} + path: variable_set_params/azure_tenant/workspace_ids + values-to-add: + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne + display: + success: Added the workspace ids + error: Unable to add the workspace ids (${{ steps.add-workspace-ids.error-message }}) + run-at-server: true + + #platform-n workspace ids + - name: Add the platform-n workspace ids if they do not exist + id: add-platform-n-workspace-ids + uses: hcl/add-values@v1 + with: + source-hcl: ${{ steps.add-workspace-ids.outputs.result-hcl }} + path: variable_set_params/azure_sub_platform_n/workspace_ids + values-to-add: + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne + display: + success: Added the platform-n workspace ids + error: Unable to add the platform-n workspace ids (${{ steps.add-platform-n-workspace-ids.error-message }}) + run-at-server: true + + #devops_sp workspace ids + - name: Add the devops_sp workspace ids if they do not exist + id: add-devops-sp-workspace-ids + uses: hcl/add-values@v1 + with: + source-hcl: ${{ steps.add-platform-n-workspace-ids.outputs.result-hcl }} + path: variable_set_params/devops_sp/workspace_ids + values-to-add: + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne + display: + success: Added the devops_sp workspace ids + error: Unable to add the devops_sp workspace ids (${{ steps.add-devops-sp-workspace-ids.error-message }}) + run-at-server: true + + #devops_nonprod workspace ids + - name: Add the devops_nonprod workspace ids if they do not exist + id: add-devops-nonprod-workspace-ids + uses: hcl/add-values@v1 + with: + source-hcl: ${{ steps.add-devops-sp-workspace-ids.outputs.result-hcl }} + path: variable_set_params/devops_nonprod/workspace_ids + values-to-add: + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne + display: + success: Added the devops_nonprod workspace ids + error: Unable to add the devops_nonprod workspace ids (${{ steps.add-devops-nonprod-workspace-ids.error-message }}) + run-at-server: true + + #dev_team workspace ids + - name: Add the dev_team workspace ids if they do not exist + id: add-dev-team-workspace-ids + uses: hcl/add-values@v1 + with: + source-hcl: ${{ steps.add-devops-nonprod-workspace-ids.outputs.result-hcl }} + path: variable_set_params/dev_team/workspace_ids + values-to-add: + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne + display: + success: Added the dev_team workspace ids + error: Unable to add the dev_team workspace ids (${{ steps.add-add-dev-team-workspace-ids-workspace-ids.error-message }}) + run-at-server: true + + #azure_creds workspace ids + - name: Add the azure_creds workspace ids if they do not exist + id: add-azure-creds-workspace-ids + uses: hcl/add-values@v1 + with: + source-hcl: ${{ steps.add-dev-team-workspace-ids.outputs.result-hcl }} + path: variable_set_params/azure_creds/workspace_ids + values-to-add: + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne + display: + success: Added the azure_creds workspace ids + error: Unable to add the azure_creds workspace ids (${{ steps.add-azure-creds-workspace-ids-workspace-ids.error-message }}) + run-at-server: true + + #devops_nonprod_creds workspace ids + - name: Add the devops_nonprod_creds workspace ids if they do not exist + id: add-devops-nonprod-creds-workspace-ids + uses: hcl/add-values@v1 + with: + source-hcl: ${{ steps.add-azure-creds-workspace-ids.outputs.result-hcl }} + path: variable_set_params/devops_nonprod_creds/workspace_ids + values-to-add: + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we + - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne + display: + success: Added the devops_nonprod_creds workspace ids + error: Unable to add the devops_nonprod_creds workspace ids (${{ steps.add-devops-nonprod-creds-workspace-ids.error-message }}) + run-at-server: true + + - name: Save the tfe_variable_set.tf file + id: save-tfe-variable-set-file + uses: file/write-text@v1 + with: + path: ${{ vars.branch-folder }}/tfe_variable_set.tf + text-to-write: ${{ steps.add-devops-nonprod-creds-workspace-ids.outputs.result-hcl }} + display: + success: Saved the tfe_variable_set.tf file + error: unable to save the tfe_variable_set.tf file ${{ steps.save-tfe-variable-set-file.error-message }} + run-at-server: true + + - name: Push updated branch to tfe-manage-workspaces-repo + id: merge-tfe-repo + uses: azdevops/merge-folder@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.get-terraform-tfe-manage-workspaces-repo.outputs.repository-id }} + branch-name: ${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }} + source-path: ${{ steps.download-tfe-manage-workspaces-branch.outputs.local-repository-path }} + reference-date-time: ${{ steps.download-tfe-manage-workspaces-branch.outputs.download-date-time }} + auto-complete: false + display: + success: Pushed updated tfe config to Terraform Project. + error: Unable to push updated tfe branch to Terraform project. (${{ steps.merge-tfe-repo.error-message }}) + run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.workflow.nox.yaml new file mode 100644 index 00000000..88c504eb --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.workflow.nox.yaml @@ -0,0 +1,92 @@ +# NOX Version Control Sync Command + +name: Synchronise NOX project definition with Terraform Infrastructure + +cli: + branch: sync + command: infrastructure + command-alias: iac + description: "|iac - Sets up or synchronizes the infrastructure repos on Azure Devops for your NOX project." + examples: + - ["sync infrastructure", "--path "] + - ["sync iac", "--path "] + +jobs: + main-setup: + steps: + - name: Get Project dash case name + id: get-project-dash-case-name + uses: core/to-dash-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project dash case name + error: Unable to get the Project dash case name (${{ steps.get-project-dash-case-name.error-message }}) + + - name: Get the project snake case name + id: get-project-snake-case-name + uses: core/to-snake-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project snake case name + error: Unable to get the Project snake case name (${{ steps.get-project-snake-case-name.error-message }}) + + - name: Get Project Short Name + id: get-project-short-name + uses: core/get-string-capitals@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the project short name. + error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) + + - name: Store setup variables + id: add-setup-vars + uses: core/add-variables@v1 + with: + project-name: ${{ project.versionControl.project }} + project-dash-name: ${{ steps.get-project-dash-case-name.outputs.result }} + project-snake-name: ${{ steps.get-project-snake-case-name.outputs.result }} + project-short-name: ${{ steps.get-project-short-name.outputs.lower-result }} + tf-folder: heimdall-ms-${{ steps.get-project-dash-case-name.outputs.result }} + display: + success: Variables stored + error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} + + connect: + steps: + - name: Locate the DevOps server + id: locate-devops + uses: network/ping@v1 + with: + host: ${{ project.versionControl.server }} + display: + success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds + error: The DevOps server is not accessible. Are you connected to the Internet? + run-at-server: true + + - name: Connect to the DevOps server + id: connect-devops + uses: azdevops/connect@v1 + with: + server: ${{ project.versionControl.server }} + personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} + display: + success: Connected to the DevOps server + error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) + run-at-server: true + + - name: Get the Nox project + id: get-nox-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: ${{ project.versionControl.project }} + display: + success: Got the ${{ project.versionControl.project }} DevOps project + error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) + run-at-server: true + + sync-infrastructure: + $ref: SyncInfrastructure.steps.nox.yaml \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.steps.nox.yaml new file mode 100644 index 00000000..ed56aabe --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.steps.nox.yaml @@ -0,0 +1,48 @@ +- name: Connect to the Arm Client + id: connect-arm + uses: arm/connect@v1 + with: + subscription-id: 03d6460a-7ea8-4d54-a64a-69db6e5823d8 + display: + success: Connected to the Azure Subscription + error: There was a problem connecting to the Azure Subscription. (${{ steps.connect-arm.error-message }}) + run-at-server: true + +- name: Find the Helm Chart key vault + id: find-hc-kv + uses: arm/find-key-vault@v1 + with: + subscription: ${{ steps.connect-arm.outputs.subscription }} + resource-group-name: RG_WE_APPS_HEIMDALL_PREPROD + key-vault-name: we-test-mp-kv-${{ steps.get-project-short-name.outputs.lower-result }} + display: + success: Found the Helm Chart Key Vault + error: There was a problem finding the Helm Chart Key Vault (${{ steps.find-hc-kv.error-message }}) + run-at-server: true + +- name: Create the Helm Chart key vault + id: create-hc-kv + if: '"${{ steps.find-hc-kv.outputs.is-found }}" == "False"' + uses: arm/create-key-vault@v1 + with: + subscription: ${{ steps.connect-arm.outputs.subscription }} + resource-group-name: RG_WE_APPS_HEIMDALL_PREPROD + key-vault-name: we-test-mp-kv-${{ steps.get-project-short-name.outputs.lower-result }} + display: + success: Created the Helm Chart key vault + error: Unable to create the Helm Chart key vault (${{ steps.create-hc-kv.error-message }}) + run-at-server: true + +- name: Save the db-connection-string secret + id: save-db-connection-string + uses: arm/save-secret@v1 + with: + key-vault-name: we-test-mp-kv-${{ steps.get-project-short-name.outputs.lower-result }} + secret-name: db-connection-string + secret-value: not-set + display: + success: Saved the Db connection string secret + error: Unable to save the Db connection string secret (${{ steps.save-db-connection-string.error-message }}) + + + \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.workflow.nox.yaml new file mode 100644 index 00000000..d31c1a0a --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.workflow.nox.yaml @@ -0,0 +1,27 @@ +# NOX Helm Chart Key Vault Sync Command + +name: Synchronise NOX definition with the Helm Chart key vault + +cli: + branch: sync + command: helm-key-vault + command-alias: hkv + description: "|hkv - Creates or updates your Heimdall Helm Chart with NOX definition." + examples: + - ["sync helm-key-vault", "--path "] + - ["sync hkv", "--path "] + +jobs: + sync-helm-chart-key-vault: + steps: + - name: Get Project Short Name + id: get-project-short-name + uses: core/get-string-capitals@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the project short name. + error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) + + $ref: SyncKeyVault.steps.nox.yaml + diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncLocalRepo.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncLocalRepo.workflow.nox.yaml new file mode 100644 index 00000000..18b56581 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncLocalRepo.workflow.nox.yaml @@ -0,0 +1,18 @@ +# NOX Init Solution Command + +name: Sync local project repository with remote Azure DevOps +description: This workflow will sync your local git repository with the project's remote Azure DevOps repository + +cli: + branch: sync + command: local-repo + command-alias: repo + description: "|np - Sync local repository with remote." + examples: + - ["sync local-repo", "--path "] + - ["sync repo", "--path "] + +jobs: + sync-repos: + $ref: InitSln_SyncRepos.steps.nox.yaml + diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.steps.nox.yaml new file mode 100644 index 00000000..dda30938 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.steps.nox.yaml @@ -0,0 +1,249 @@ +steps: + - name: Get the current Nox project repository + id: get-nox-repo + uses: azdevops/get-repo@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + repository-name: ${{ project.versionControl.repository }} + display: + success: Got the current Nox project repository + error: Unable to get the current Nox project repository (${{ steps.get-nox-repo.error-message }}) + run-at-server: true + + #Service Endpoints + #APPS_EU_PLATFORM_N service endpoint + - name: Check if the APPS_EU_PLATFORM_N service endpoint exists + id: verify-platform-n-se-proj + uses: azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + service-endpoint-name: APPS_EU_PLATFORM_N + display: + success: Checked if APPS_EU_PLATFORM_N service endpoint exists + error: Unable to check if APPS_EU_PLATFORM_N service endpoint exists (${{ steps.verify-platform-n-se-proj.error-message }}) + run-at-server: true + + - name: Find the APPS_EU_PLATFORM_N service endpoint + if: '"${{ steps.verify-platform-n-se-proj.outputs.is-found }}" == "False"' + id: find-platform-n-se-proj + uses: + azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-devops-project.outputs.project-id }} + service-endpoint-name: APPS_EU_PLATFORM_N + display: + success: Searched for APPS_EU_PLATFORM_N service endpoint in Nox.Cli + error: Unable to search for APPS_EU_PLATFORM_N service endpoint in Nox.Cli (${{ steps.find-platform-n-se-proj.error-message }}) + run-at-server: true + + - name: Share the APPS_EU_PLATFORM_N service endpoint + if: '"${{ steps.verify-platform-n-se-proj.outputs.is-found }}" == "False"' + id: share-platform-n-se-proj-proj + uses: azdevops/share-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + service-endpoint-id: ${{ steps.find-platform-n-se-proj.outputs.service-endpoint-id }} + service-endpoint-name: APPS_EU_PLATFORM_N + project-id: ${{ steps.get-nox-project.outputs.project-id }} + project-name: ${{ project.versionControl.project }} + display: + success: Shared the APPS_EU_PLATFORM_N service connection with ${{ project.name }} + error: Unable to share the APPS_EU_PLATFORM_N service connection with ${{ project.name }} (${{ steps.share-platform-n-se-proj-proj.error-message }}) + run-at-server: true + + #APPS_EU_PLATFORM_P service endpoint + - name: Check if the APPS_EU_PLATFORM_P service endpoint exists + id: verify-platform-p-se-proj + uses: azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + service-endpoint-name: APPS_EU_PLATFORM_P + display: + success: Checked if APPS_EU_PLATFORM_P service endpoint exists + error: Unable to check if APPS_EU_PLATFORM_P service endpoint exists (${{ steps.verify-platform-p-se-proj.error-message }}) + run-at-server: true + + - name: Find the APPS_EU_PLATFORM_P service endpoint + if: '"${{ steps.verify-platform-p-se-proj.outputs.is-found }}" == "False"' + id: find-platform-p-se-proj + uses: + azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-devops-project.outputs.project-id }} + service-endpoint-name: APPS_EU_PLATFORM_P + display: + success: Searched for APPS_EU_PLATFORM_P service endpoint in Nox.Cli + error: Unable to search for APPS_EU_PLATFORM_P service endpoint in Nox.Cli (${{ steps.find-platform-p-se-proj.error-message }}) + run-at-server: true + + - name: Share the APPS_EU_PLATFORM_P service endpoint + if: '"${{ steps.verify-platform-p-se-proj.outputs.is-found }}" == "False"' + id: share-platform-p-se-proj-proj + uses: azdevops/share-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + service-endpoint-id: ${{ steps.find-platform-p-se-proj.outputs.service-endpoint-id }} + service-endpoint-name: APPS_EU_PLATFORM_P + project-id: ${{ steps.get-nox-project.outputs.project-id }} + project-name: ${{ project.versionControl.project }} + display: + success: Shared the APPS_EU_PLATFORM_P service connection with ${{ project.name }} + error: Unable to share the APPS_EU_PLATFORM_P service connection with ${{ project.name }} (${{ steps.share-platform-p-se-proj-proj.error-message }}) + run-at-server: true + + #SonarCloud service endpoint + - name: Check if the SonarCloud service endpoint exists + id: verify-sonarcloud-se-proj + uses: azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + service-endpoint-name: SonarCloud + display: + success: Checked if SonarCloud service endpoint exists + error: Unable to check if SonarCloud service endpoint exists (${{ steps.verify-sonarcloud-se-proj.error-message }}) + run-at-server: true + + - name: Find the SonarCloud service endpoint + if: '"${{ steps.verify-sonarcloud-se-proj.outputs.is-found }}" == "False"' + id: find-sonarcloud-se-proj + uses: + azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-devops-project.outputs.project-id }} + service-endpoint-name: SonarCloud + display: + success: Searched for SonarCloud service endpoint in Nox.Cli + error: Unable to search for SonarCloud service endpoint in Nox.Cli (${{ steps.find-sonarcloud-se-proj.error-message }}) + run-at-server: true + + - name: Share the SonarCloud service endpoint + if: '"${{ steps.verify-sonarcloud-se-proj.outputs.is-found }}" == "False"' + id: share-sonarcloud-se-proj + uses: azdevops/share-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + service-endpoint-id: ${{ steps.find-sonarcloud-se-proj.outputs.service-endpoint-id }} + service-endpoint-name: SonarCloud + project-id: ${{ steps.get-nox-project.outputs.project-id }} + project-name: ${{ project.versionControl.project }} + display: + success: Shared the SonarCloud service connection with ${{ project.name }} + error: Unable to share the SonarCloud service connection with ${{ project.name }} (${{ steps.share-sonarcloud-se-proj.error-message }}) + run-at-server: true + + #weacrheimdallpreprod service endpoint + - name: Check if the weacrheimdallpreprod service endpoint exists + id: verify-weacrheimdallpreprod-se-proj + uses: azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + service-endpoint-name: weacrheimdallpreprod + display: + success: Checked if weacrheimdallpreprod service endpoint exists + error: Unable to check if weacrheimdallpreprod service endpoint exists (${{ steps.verify-weacrheimdallpreprod-se-proj.error-message }}) + run-at-server: true + + - name: Find the weacrheimdallpreprod service endpoint + if: '"${{ steps.verify-weacrheimdallpreprod-se-proj.outputs.is-found }}" == "False"' + id: find-weacrheimdallpreprod-se-proj + uses: + azdevops/find-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-devops-project.outputs.project-id }} + service-endpoint-name: weacrheimdallpreprod + display: + success: Searched for weacrheimdallpreprod service endpoint in Nox.Cli + error: Unable to search for weacrheimdallpreprod service endpoint in Nox.Cli (${{ steps.find-weacrheimdallpreprod-se-proj.error-message }}) + run-at-server: true + + - name: Share the weacrheimdallpreprod service endpoint + if: '"${{ steps.verify-weacrheimdallpreprod-se-proj.outputs.is-found }}" == "False"' + id: share-weacrheimdallpreprod-se-proj + uses: azdevops/share-service-endpoint@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + service-endpoint-id: ${{ steps.find-weacrheimdallpreprod-se-proj.outputs.service-endpoint-id }} + service-endpoint-name: weacrheimdallpreprod + project-id: ${{ steps.get-nox-project.outputs.project-id }} + project-name: ${{ project.versionControl.project }} + display: + success: Shared the weacrheimdallpreprod service connection with ${{ project.name }} + error: Unable to share the weacrheimdallpreprod service connection with ${{ project.name }} (${{ steps.share-weacrheimdallpreprod-se-proj.error-message }}) + run-at-server: true + + #Agent pools + - name: Add we-aks-agent-pool + id: add-aks-agent-pool + uses: azdevops/add-project-agent-pool@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + agent-pool-name: we-aks-preprod-agent + display: + success: Successfully added the we-aks-preprod-agent pool + error: Unable to add the we-aks-preprod-agent pool ${{ steps.add-agent-pool.error-message }} + run-at-server: true + + #Project Pipeline + - name: Find Project pipeline + id: find-project-pipeline + uses: azdevops/find-build-definition@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + build-name: ${{ project.versionControl.project }} + display: + success: Searched for the Project pipeline + error: Unable to search for the Project pipeline (${{ steps.find-project-pipeline.error-message }}) + run-at-server: true + + - name: Authorize the project pipeline endpoints + id: auth-project-pipeline-update + if: '"${{ steps.find-project-pipeline.outputs.is-found }}" == "True"' + uses: azdevops/authorize-build-definition@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + build-definition-id: ${{ steps.find-project-pipeline.outputs.build-definition-id }} + display: + success: Authorized the project pipeline endpoints + error: Unable to authorize the project pipeline endpoints (${{ steps.auth-project-pipeline-update.error-message }}) + run-at-server: true + + - name: Create the Project pipeline if it does not exist + id: create-project-pipeline + if: '"${{ steps.find-project-pipeline.outputs.is-found }}" == "False"' + uses: azdevops/create-build-definition@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + repository-id: ${{ steps.get-nox-repo.outputs.repository-id }} + yaml-file-path: azure-pipelines.yml + build-name: ${{ project.versionControl.project }} + agent-pool: Azure Pipelines + display: + success: Created the Project build pipeline + error: Unable to create the Project build pipeline (${{ steps.create-project-pipeline.error-message }}) + run-at-server: true + + - name: Authorize the project pipeline endpoints + id: auth-project-pipeline-new + if: '"${{ steps.find-project-pipeline.outputs.is-found }}" == "False"' + uses: azdevops/authorize-build-definition@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.get-nox-project.outputs.project-id }} + build-definition-id: ${{ steps.create-project-pipeline.outputs.build-definition-id }} + display: + success: Authorized the project pipeline endpoints + error: Unable to authorize the project pipeline endpoints (${{ steps.auth-project-pipeline-new.error-message }}) + run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.workflow.nox.yaml new file mode 100644 index 00000000..f34dc40e --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.workflow.nox.yaml @@ -0,0 +1,61 @@ +# NOX Project Pipeline Sync Command + +name: Synchronise the Project ADO pipeline of your Nox project + +cli: + branch: sync + command: project-pipeline + command-alias: projpipe + description: "|project-pipeline - Synchronise the Project ADO pipeline of your Nox project." + examples: + - ["sync project-pipeline", "--path "] + - ["sync projpipe", "--path "] + +jobs: + connect: + steps: + - name: Locate the DevOps server + id: locate-server + uses: network/ping@v1 + with: + host: ${{ project.versionControl.server }} + display: + success: Found the DevOps server in ${{ steps.locate-server-hc.outputs.roundtrip-time }} milliseconds + error: The DevOps server is not accessible. Are you connected to the Internet? + run-at-server: true + + - name: Connect to the DevOps server + id: connect-devops + uses: azdevops/connect@v1 + with: + server: ${{ project.versionControl.server }} + personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} + display: + success: Connected to the DevOps server + error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops-hc.error-message }}) + run-at-server: true + + - name: Get the current Nox project + id: get-nox-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: ${{ project.versionControl.project }} + display: + success: Got the ${{ project.versionControl.project }} DevOps project + error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) + run-at-server: true + + - name: Get the DevOps project + id: get-devops-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: IWG.DevOps + display: + success: Got the DevOps project + error: Unable to get the DevOps project (${{ steps.get-devops-project.error-message }}) + run-at-server: true + + sync-project-pipeline: + $ref: SyncProjectPipeline.steps.nox.yaml \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncSolution.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncSolution.workflow.nox.yaml new file mode 100644 index 00000000..47d0050e --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncSolution.workflow.nox.yaml @@ -0,0 +1,156 @@ +# NOX Sync Solution Command + +name: Initialize a Nox project +description: This workflow will sync your Nox solution with Azure AD, Terraform and DevOps + +cli: + branch: sync + command: solution + command-alias: sln + description: "|np - Synchronizes a Nox solution." + examples: + - ["sync solution", "--path "] + - ["sync sln", "--path "] + +jobs: + main-setup: + steps: + - name: Get Project dash case name + id: get-project-dash-name + uses: core/to-dash-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project dash case name + error: Unable to get the Project dash case name (${{ steps.get-project-dash-name.error-message }}) + + - name: Get the project snake case name + id: get-project-snake-name + uses: core/to-snake-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project snake case name + error: Unable to get the Project snake case name (${{ steps.get-project-snake-name.error-message }}) + + - name: Get Project Short Name + id: get-project-short-name + uses: core/get-string-capitals@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the project short name. + error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) + + - name: Get the Team Member user name list + id: get-team-uname-list + uses: project/get-team-user-names@v1 + with: + team-members: ${{ project.team.developers }} + display: + success: Got the team user name list + error: Unable to get the team user name list (${{ steps.get-team-uname-list.error-message }}) + + - name: Get the Team Admins user name list + id: get-project-admin-uname-list + uses: project/get-admin-user-names@v1 + with: + team-members: ${{ project.team.developers }} + display: + success: Got the project admins user name list + error: Unable to get the project admins user name list (${{ steps.get-project-admin-list.error-message }}) + + - name: Store setup variables + id: add-setup-vars + uses: core/add-variables@v1 + with: + project-name: ${{ project.versionControl.project }} + project-dash-name: ${{ steps.get-project-dash-name.outputs.result }} + project-snake-name: ${{ steps.get-project-snake-name.outputs.result }} + project-short-name: ${{ steps.get-project-short-name.outputs.lower-result }} + team-user-names: ${{ steps.get-team-uname-list.outputs.user-names }} + admin-user-names: ${{ steps.get-project-admin-uname-list.outputs.user-names }} + tf-folder: heimdall-ms-${{ steps.get-project-dash-name.outputs.result }} + display: + success: Variables stored + error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} + + connect: + steps: + - name: Connect to Azure Active Directory + id: connect-aad + uses: azuread/connect@v1 + with: + tenant-id: ${{ server.secrets.AZURE_TENANT_ID }} + client-id: ${{ server.secrets.AZURE_CLIENT_ID }} + client-secret: ${{ server.secrets.AZURE_CLIENT_SECRET }} + display: + success: Successfully connected to Azure Active Directory + error: Unable to connect to Azure Active Directory + run-at-server: true + + - name: Locate the DevOps server + id: locate-devops + uses: network/ping@v1 + with: + host: ${{ project.versionControl.server }} + display: + success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds + error: The DevOps server is not accessible. Are you connected to the Internet? + run-at-server: true + + - name: Connect to the DevOps server + id: connect-devops + uses: azdevops/connect@v1 + with: + server: ${{ project.versionControl.server }} + personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} + display: + success: Connected to the DevOps server + error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) + run-at-server: true + + sync-active-directory: + $ref: SyncAzureActiveDirectory.steps.nox.yaml + + sync-version-control: + $ref: SyncVersionControl.steps.nox.yaml + + nox-project: + steps: + - name: Get the Nox project + id: get-nox-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: ${{ project.versionControl.project }} + display: + success: Got the ${{ project.versionControl.project }} DevOps project + error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) + run-at-server: true + + sync-infrastructure: + $ref: SyncInfrastructure.steps.nox.yaml + + sync-helm-chart: + $ref: SyncHelmChart.steps.nox.yaml + + devops-project: + steps: + - name: Get the DevOps project + id: get-devops-project + uses: azdevops/get-project@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: IWG.DevOps + display: + success: Got the DevOps project + error: Unable to get the DevOps project (${{ steps.get-devops-project.error-message }}) + run-at-server: true + + sync-helm-chart-pipeline: + $ref: SyncHelmPipeline.steps.nox.yaml + + sync-project-pipeline: + $ref: SyncProjectPipeline.steps.nox.yaml + \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.steps.nox.yaml new file mode 100644 index 00000000..9c2ba1f1 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.steps.nox.yaml @@ -0,0 +1,280 @@ +steps: + #Current Project + - name: Ensure your Nox project exists + id: ensure-project-exists + uses: azdevops/ensure-project-exists@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-name: ${{ project.versionControl.project }} + project-description: ${{ project.description }} + display: + success: ${{ steps.ensure-project-exists.outputs.success-message }} + error: Unable to ensure the Nox project exists (${{ steps.ensure-project-exists.error-message }}) + run-at-server: true + + - name: Update Nox Project Settings + id: update-project-settings + uses: azdevops/update-build-general-settings@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.ensure-project-exists.outputs.project-id }} + enforce-job-auth-scope: false + enforce-referenced-repo-scoped-token: false + display: + success: Updated the Nox project build settings + error: Unable to update the Nox project build settings (${{ steps.update-project-settings.error-message }}) + run-at-server: true + + - name: Add the admins to the project + id: add-admins + if: '"${{ vars.admin-user-names }}" != ""' + uses: azdevops/add-project-admins@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.ensure-project-exists.outputs.project-id }} + admins: ${{ vars.admin-user-names }} + display: + success: Added administrators to the project + error: Unable to add administrators to the project (${{ steps.add-admins.error-message }}) + run-at-server: true + + - name: Add the team to the project + id: add-developers + if: '"${{ vars.team-user-names }}"!= ""' + uses: azdevops/add-team-members@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.ensure-project-exists.outputs.project-id }} + team-members: ${{ vars.team-user-names }} + display: + success: Added team members to the project + error: Unable to add team members to the project (${{ steps.add-developers.error-message }}) + run-at-server: true + + - name: Ensure the Project Repository exists + id: ensure-repo-exists + uses: azdevops/ensure-repo-exists@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.ensure-project-exists.outputs.project-id }} + repository-name: ${{ project.versionControl.repository }} + do-initialize: true + display: + success: ${{ steps.ensure-repo-exists.outputs.success-message }} + error: There was a problem ensuring that the repository exists. (${{ steps.ensure-repo-exists.error-message }}) + run-at-server: true + + - name: Find the Default Project Repository + if: '"${{ project.versionControl.repository }}" != "${{ project.versionControl.project }}"' + id: find-default-repo + uses: azdevops/find-repo@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.ensure-project-exists.outputs.project-id }} + repository-name: ${{ project.versionControl.project }} + display: + success: Searched for the default project repository + error: Unable to search for the default project repository ${{ steps.find-default-repo.error-message }} + run-at-server: true + + - name: Delete the Default Repository if it exists + if: '"${{ project.versionControl.repository }}" != "${{ project.versionControl.project }}" && "${{ steps.find-default-repo.outputs.is-found }}" == "True"' + id: delete-default-repo + uses: azdevops/delete-repo@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + project-id: ${{ steps.ensure-project-exists.outputs.project-id }} + repository-name: ${{ project.versionControl.project }} + display: + success: Deleted the default repository + error: Unable to delete the default repository ${{ steps.delete-default-repo.error-message }} + run-at-server: true + + - name: Find the project main branch + id: find-main + uses: azdevops/find-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-repo-exists.outputs.repository-id }} + branch-name: main + display: + success: Successfully searched for the main branch + error: There was a problem finding the main branch for repo (${{ steps.find-main.error-message }}) + run-at-server: true + + - name: Create new branch + id: create-branch + uses: azdevops/create-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-repo-exists.outputs.repository-id }} + display: + success: Successfully created new branch -> ${{ steps.create-branch.outputs.branch-name }} + error: Unable to create new branch -> ${{ steps.create-branch.error-message }} + run-at-server: true + + - name: Download the new branch + id: download-branch + uses: azdevops/download-repo-branch@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-repo-exists.outputs.repository-id }} + branch-name: ${{ steps.create-branch.outputs.branch-name }} + display: + success: Successfully downloaded branch '${{ steps.create-branch.outputs.branch-name }}' of the Project Repo + error: There was a problem downloading the repository (${{ steps.download-branch.error-message }}) + run-at-server: true + + # global.yaml + - name: Check if global.yaml exists + id: find-global-yaml + uses: file/find-file@v1 + with: + path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables + file-name: global.yaml + display: + success: Searched for global.yaml + error: Unable to search for global.yaml (${{ steps.find-global-yaml.error-message }}) + run-at-server: true + + - name: Load global.yaml template + id: load-global-yaml + uses: core/load-template@v1 + with: + path: pipeline/nox-project/global.yaml + display: + success: Loaded global.yaml + error: Unable to load global.yaml (${{ steps.load-global-yaml.error-message }}) + run-at-server: true + + - name: Save global.yaml to local repo + id: save-global-yaml + uses: file/write-text@v1 + with: + path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables/global.yaml + text-to-write: ${{ steps.load-global-yaml.outputs.result }} + display: + success: Saved global.yaml + error: unable to save global.yaml (${{ steps.save-global-yaml.error-message }}) + run-at-server: true + + - name: Replace global.yaml template + id: replace-global-yaml + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables/global.yaml + replacements: + "": ${{ vars.project-dash-name }} + "": "" + "": ${{ vars.project-dash-name }} + "": ${{ project.versionControl.relativeProjectSourceFolder }} + "": ${{ project.versionControl.relativeDockerFilePath }} + display: + success: Strings Replace global.yaml success + error: Strings Replace global.yaml failed. (${{ steps.replace-global-yaml.error-message }}) + run-at-server: true + + # preprod-we-test.yaml + - name: Check if preprod-we-test.yaml exists + id: find-preprod-we-test-yaml + uses: file/find-file@v1 + with: + path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables + file-name: preprod-we-test.yaml + display: + success: Searched for preprod-we-test.yaml + error: Unable to search for preprod-we-test.yaml (${{ steps.find-preprod-we-test-yaml.error-message }}) + run-at-server: true + + - name: Load preprod-we-test.yaml template + id: load-preprod-we-test-yaml + uses: core/load-template@v1 + with: + path: pipeline/nox-project/preprod-we-test.yaml + display: + success: Loaded preprod-we-test.yaml + error: Unable to load preprod-we-test.yaml (${{ steps.load-preprod-we-test-yaml.error-message }}) + run-at-server: true + + - name: Save preprod-we-test.yaml to local repo + id: save-preprod-we-test-yaml + uses: file/write-text@v1 + with: + path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables/preprod-we-test.yaml + text-to-write: ${{ steps.load-preprod-we-test-yaml.outputs.result }} + display: + success: Saved preprod-we-test.yaml + error: unable to save preprod-we-test.yaml (${{ steps.save-preprod-we-test.error-message }}) + run-at-server: true + + - name: Replace preprod-we-test.yaml template + id: replace-preprod-we-test-yaml + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables/preprod-we-test.yaml + replacements: + "": ${{ vars.project-dash-name }} + display: + success: Strings Replace preprod-we-test.yaml success + error: Strings Replace preprod-we-test.yaml failed. (${{ steps.replace-preprod-we-test-yaml.error-message }}) + run-at-server: true + + # azure-pipelines.yml + - name: Check if azure-pipelines.yml exists + id: find-azure-pipelines-yml + uses: file/find-file@v1 + with: + path: ${{ steps.download-branch.outputs.local-repository-path }} + file-name: azure-pipelines.yml + display: + success: Searched for azure-pipelines.yml + error: Unable to search for azure-pipelines.yml (${{ steps.find-azure-pipelines-yml.error-message }}) + run-at-server: true + + - name: Load azure-pipelines.yml template + id: load-azure-pipelines-yml + uses: core/load-template@v1 + with: + path: pipeline/nox-project/azure-pipelines.yml + display: + success: Loaded azure-pipelines.yml + error: Unable to load azure-pipelines.yml (${{ steps.load-azure-pipelines-yml.error-message }}) + run-at-server: true + + - name: Save azure-pipelines.yml to local repo + id: save-azure-pipelines + uses: file/write-text@v1 + with: + path: ${{ steps.download-branch.outputs.local-repository-path }}/azure-pipelines.yml + text-to-write: ${{ steps.load-azure-pipelines-yml.outputs.result }} + display: + success: Saved azure-pipelines.yml + error: unable to save azure-pipelines.yml (${{ steps.save-azure-pipelines.error-message }}) + run-at-server: true + + - name: Replace azure-pipelines.yml template + id: replace-azure-pipelines-yml + uses: file/replace-strings@v1 + with: + path: ${{ steps.download-branch.outputs.local-repository-path }}/azure-pipelines.yml + replacements: + "": ${{ vars.project-name }} + "": ${{ vars.project-dash-name }} + display: + success: Strings Replace azure-pipelines.yml success + error: Strings Replace azure-pipelines.yml failed. (${{ steps.replace-azure-pipelines-yml.error-message }}) + run-at-server: true + + - name: Push updated branch + id: merge-repo + uses: azdevops/merge-folder@v1 + with: + connection: ${{ steps.connect-devops.outputs.connection }} + repository-id: ${{ steps.ensure-repo-exists.outputs.repository-id }} + branch-name: ${{ steps.create-branch.outputs.branch-name }} + source-path: ${{ steps.download-branch.outputs.local-repository-path }} + reference-date-time: ${{ steps.download-branch.outputs.download-date-time }} + display: + success: Pushed updated branch to project repo + error: Unable to push updated branch to project repo. (${{ steps.merge-repo.error-message }}) + run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.workflow.nox.yaml new file mode 100644 index 00000000..ea0bb6d6 --- /dev/null +++ b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.workflow.nox.yaml @@ -0,0 +1,90 @@ +# NOX Version Control Sync Command + +name: Synchronise NOX definition with version control + +cli: + branch: sync + command: version-control + command-alias: vc + description: "|vc - Sets up or synchronizes a repository on Azure Devops for your NOX team." + examples: + - ["sync versionControl", "--path "] + - ["sync vc", "--path "] + +jobs: + main-setup: + steps: + - name: Get Project dash case name + id: get-project-dash-name + uses: core/to-dash-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project dash case name + error: Unable to get the Project dash case name (${{ steps.get-project-dash-name.error-message }}) + + - name: Get the project snake case name + id: get-project-snake-name + uses: core/to-snake-case@v1 + with: + source-string: ${{ project.versionControl.project }} + display: + success: Got the Project snake case name + error: Unable to get the Project snake case name (${{ steps.get-project-snake-name.error-message }}) + + - name: Get the Team Member user name list + id: get-team-uname-list + uses: project/get-team-user-names@v1 + with: + team-members: ${{ project.team.developers }} + display: + success: Got the team user name list + error: Unable to get the team user name list (${{ steps.get-team-uname-list.error-message }}) + + - name: Get the Team Admins user name list + id: get-project-admin-uname-list + uses: project/get-admin-user-names@v1 + with: + team-members: ${{ project.team.developers }} + display: + success: Got the project admins user name list + error: Unable to get the project admins user name list (${{ steps.get-project-admin-list.error-message }}) + + - name: Store setup variables + id: add-setup-vars + uses: core/add-variables@v1 + with: + project-name: ${{ project.versionControl.project }} + project-dash-name: ${{ steps.get-project-dash-name.outputs.result }} + project-snake-name: ${{ steps.get-project-snake-name.outputs.result }} + team-user-names: ${{ steps.get-team-uname-list.outputs.user-names }} + admin-user-names: ${{ steps.get-project-admin-uname-list.outputs.user-names }} + display: + success: Variables stored + error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} + + connect: + steps: + - name: Locate the DevOps server + id: locate-devops + uses: network/ping@v1 + with: + host: ${{ project.versionControl.server }} + display: + success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds + error: The DevOps server is not accessible. Are you connected to the Internet? + run-at-server: true + + - name: Connect to the DevOps server + id: connect-devops + uses: azdevops/connect@v1 + with: + server: ${{ project.versionControl.server }} + personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} + display: + success: Connected to the DevOps server + error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) + run-at-server: true + + sync-version-control: + $ref: SyncVersionControl.steps.nox.yaml \ No newline at end of file diff --git a/tests/Nox.Cli.Server.Tests/files/NoxCliCache.json b/tests/Nox.Cli.Server.Tests/files/NoxCliCache.json new file mode 100644 index 00000000..040be273 --- /dev/null +++ b/tests/Nox.Cli.Server.Tests/files/NoxCliCache.json @@ -0,0 +1,10 @@ +{ + "UserPrincipalName":"", + "TenantId":"88155c28-f750-4013-91d3-8347ddb3daa7", + "RemoteUrl":"http://localhost:9000", + "TemplateUrl":"http://localhost:9000/templates/", + "WorkflowUrl":"http://localhost:9000/workflows/", + "Expires":"2023-05-17T13:48:25.6161389+02:00", + "WorkflowInfo":[], + "TemplateInfo":[] +} \ No newline at end of file diff --git a/tests/workflows/Test.find-cname-record.workflow.nox.yaml b/tests/workflows/Test.find-cname-record.workflow.nox.yaml new file mode 100644 index 00000000..07ebac86 --- /dev/null +++ b/tests/workflows/Test.find-cname-record.workflow.nox.yaml @@ -0,0 +1,38 @@ +# NOX Test Find CName record + +name: Test Find CName record +cli: + branch: test + command: find-cname-record + command-alias: fcnrec + description: Test Find CName record + examples: + - ["sync find-cname-record", "--path "] + - ["sync fcnrec", "--path "] + +jobs: + sync-test: + steps: + - name: Connect to AAD + id: connect + uses: azuread/connect_v1 + with: + tenant-id: ${{ server.secrets.AZURE_TENANT_ID }} + client-id: ${{ server.secrets.AZURE_CLIENT_ID }} + client-secret: ${{ server.secrets.AZURE_CLIENT_SECRET }} + display: + success: Connected to Azure AD + error: Failed to connect to Azure AD ${{ steps.connect.error-message }} + run-at-server: true + + - name: Find CName + id: find-cname + uses: azuread/find-cname-record@v1 + with: + aad-client: ${{ steps.connect.outputs.aad-client }} + resource-group-name: rg_dns_common_prod + zone-name: ingena.work + display: + success: Searched for CName record + error: Unable to search for CName record (${{ steps.find-cname.error-message }}) + run-at-server: true \ No newline at end of file From fb4ac233d12763e42aab5eb3839f4c24880233ec Mon Sep 17 00:00:00 2001 From: Jan Schutte Date: Wed, 14 Jun 2023 08:17:51 +0200 Subject: [PATCH 2/4] Changed default scripts url to https://noxorg.dev --- src/Nox.Cli.Caching/NoxCliCacheManager.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Nox.Cli.Caching/NoxCliCacheManager.cs b/src/Nox.Cli.Caching/NoxCliCacheManager.cs index feb24947..e8ec1424 100755 --- a/src/Nox.Cli.Caching/NoxCliCacheManager.cs +++ b/src/Nox.Cli.Caching/NoxCliCacheManager.cs @@ -145,6 +145,14 @@ public void RefreshTemplate(string name) public NoxCliCacheManager(string remoteUrl, IPersistedTokenCache? tokenCache = null) { _buildLog = new List(); + if (string.IsNullOrEmpty(remoteUrl)) + { + _remoteUrl = remoteUrl; + } + else + { + _remoteUrl = "https://noxorg.dev"; + } _remoteUrl = remoteUrl; _cachePath = WellKnownPaths.CachePath; _workflowCachePath = WellKnownPaths.WorkflowsCachePath; From 9a906d7a4e31fc877b3ef95507c877f4224a9cfa Mon Sep 17 00:00:00 2001 From: Jan Schutte Date: Wed, 14 Jun 2023 08:28:17 +0200 Subject: [PATCH 3/4] - version 1.0.18 --- src/Nox.Cli/Nox.Cli.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Nox.Cli/Nox.Cli.csproj b/src/Nox.Cli/Nox.Cli.csproj index 04d27025..d5f9821a 100755 --- a/src/Nox.Cli/Nox.Cli.csproj +++ b/src/Nox.Cli/Nox.Cli.csproj @@ -18,9 +18,9 @@ false Copyright (c) Andre Sharpe 2022 true - 1.0.17.0 - 1.0.17.0 - 1.0.17 + 1.0.18.0 + 1.0.18.0 + 1.0.18 MIT https://github.com/NoxOrg/Nox.Cli https://github.com/NoxOrg/Nox.Cli.git From 9ed33dd3b667fc932f33f465742c6554a07c8c7e Mon Sep 17 00:00:00 2001 From: Jan Schutte Date: Wed, 14 Jun 2023 08:32:44 +0200 Subject: [PATCH 4/4] moved workflos and templates into .nox --- .../docker/Dockerfile | 21 - .../docker/dockerignore | 25 - .../pipeline/nox-project/azure-pipelines.yml | 104 ---- .../pipeline/nox-project/global.yaml | 20 - .../pipeline/nox-project/preprod-we-test.yaml | 7 - .../terraform/env-vars.tf | 149 ----- .../heimdall-ms-microservice-prod-vars.tf | 149 ----- .../heimdall-ms-microservice-test-vars.tf | 149 ----- .../heimdall-ms-microservice-uat-vars.tf | 149 ----- .../terraform/heimdall-ms-microservice.tf | 9 - .../terraform/outputs.tf | 6 - .../terraform/tfc-workspace.tf | 22 - .../terraform/variables.tf | 12 - .../InitSln_Connect.steps.nox.yaml | 33 - .../InitSln_DevopsProject.steps.nox.yaml | 11 - .../InitSln_DirSetup.steps.nox.yaml | 293 --------- .../InitSln_NoxProject.steps.nox.yaml | 11 - .../InitSln_OutputTable.steps.nox.yaml | 10 - .../InitSln_ServerInit.steps.nox.yaml | 60 -- .../InitSln_SyncRepos.steps.nox.yaml | 34 -- .../InitSolution.workflow.nox.yaml | 56 -- .../Manifest.cli.nox.yaml | 33 - .../NewNoxService.workflow.nox.yaml | 74 --- .../SyncAzureActiveDirectory.steps.nox.yaml | 161 ----- ...SyncAzureActiveDirectory.workflow.nox.yaml | 335 ---------- .../SyncDatabaseScript.workflow.nox.yaml | 160 ----- .../SyncDns.steps.nox.yaml | 24 - .../SyncElasticAlerts.workflow.nox.yaml | 215 ------- .../SyncHelmChart.steps.nox.yaml | 204 ------- .../SyncHelmChart.workflow.nox.yaml | 93 --- .../SyncHelmPipeline.steps.nox.yaml | 236 -------- .../SyncHelmPipeline.workflow.nox.yaml | 61 -- .../SyncInfrastructure.steps.nox.yaml | 573 ------------------ .../SyncInfrastructure.workflow.nox.yaml | 92 --- .../SyncKeyVault.steps.nox.yaml | 48 -- .../SyncKeyVault.workflow.nox.yaml | 27 - .../SyncLocalRepo.workflow.nox.yaml | 18 - .../SyncProjectPipeline.steps.nox.yaml | 249 -------- .../SyncProjectPipeline.workflow.nox.yaml | 61 -- .../SyncSolution.workflow.nox.yaml | 156 ----- .../SyncVersionControl.steps.nox.yaml | 280 --------- .../SyncVersionControl.workflow.nox.yaml | 90 --- 42 files changed, 4520 deletions(-) delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/Dockerfile delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/dockerignore delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/azure-pipelines.yml delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/global.yaml delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/preprod-we-test.yaml delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/env-vars.tf delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-prod-vars.tf delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-test-vars.tf delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-uat-vars.tf delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice.tf delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/outputs.tf delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/tfc-workspace.tf delete mode 100644 docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/variables.tf delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_Connect.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DevopsProject.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DirSetup.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_NoxProject.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_OutputTable.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_ServerInit.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_SyncRepos.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSolution.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/Manifest.cli.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/NewNoxService.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDatabaseScript.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDns.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncElasticAlerts.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncLocalRepo.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncSolution.workflow.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.steps.nox.yaml delete mode 100644 docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.workflow.nox.yaml diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/Dockerfile b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/Dockerfile deleted file mode 100644 index e655a5de..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base -WORKDIR /app - -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build - -COPY [".//.csproj", "/"] -RUN dotnet restore ".//.csproj" -COPY . . -WORKDIR "/" -RUN dotnet build ".csproj" -c Release -o /app/build - -FROM build AS publish -RUN dotnet publish ".csproj" -c Release -o /app/publish - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . - -ENV ASPNETCORE_URLS http://0.0.0.0:8080 - -ENTRYPOINT ["dotnet", ".dll"] \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/dockerignore b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/dockerignore deleted file mode 100644 index af50df1a..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/docker/dockerignore +++ /dev/null @@ -1,25 +0,0 @@ -**/.dockerignore -**/.env -**/.git -**/.gitignore -**/.project -**/.settings -**/.toolstarget -**/.vs -**/.vscode -**/.idea -**/*.*proj.user -**/*.dbmdl -**/*.jfm -**/azds.yaml -**/bin -**/charts -**/docker-compose* -**/Dockerfile* -**/node_modules -**/npm-debug.log -**/obj -**/secrets.dev.yaml -**/values.dev.yaml -LICENSE -README.md \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/azure-pipelines.yml b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/azure-pipelines.yml deleted file mode 100644 index 1c8d0e4e..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/azure-pipelines.yml +++ /dev/null @@ -1,104 +0,0 @@ -parameters: - - name: skipBuild - displayName: Skip build? - type: boolean - default: false - - name: imageTag - displayName: 'Enter existing image tag you want to deploy e.g. `branchFolder-buildNumber` format (i.e. feature-20221109.7)' - type: string - default: 'latest' - -resources: - repositories: - - repository: templates - type: git - name: 'IWG.DevOps/devops-build-templates' - - repository: scripts - type: git - name: IWG.DevOps/devops-scripts - - repository: heimdallTemplates - type: git - name: 'Heimdall.Core/Templates.Pipeline' - pipelines: - - pipeline: helmChart - source: .HelmChart - trigger: - branches: - include: - - main - -trigger: - branches: - include: - - main - - develop - - release/* - - hotfix/* - -pool: - vmImage: ubuntu-latest - -variables: - - template: common/branch-names.yaml@templates - - template: variables/global.yml@heimdallTemplates - - template: pipeline/variables/global.yaml - -stages: - - stage: CI_Build - displayName: 'Build' - condition: and(succeeded(), eq(${{ parameters.skipBuild }}, false)) - jobs: - # - job: CI_Build - # displayName: 'Build' - # steps: - # - template: build-template.yml@heimdallTemplates - # parameters: - # SonarcloudProjectKey: $(SonarcloudProjectKey) - # SourceFolder: $(SourceFolder) - # runSonarCloud: false - # ignoreSonarGate: true - # skipComponentTests: true - - job: CI_Build_Docker - displayName: 'Docker Build/Push' - # dependsOn: 'CI_Build' - # condition: succeeded() - pool: - vmImage: 'ubuntu-latest' - steps: - - template: build-docker.yml@heimdallTemplates - parameters: - dockerfile: $(dockerfilePath) - buildContext: $(buildContext) - repository: $(service_name) - pushImage: ${{ not(contains(variables['Build.Reason'], 'PullRequest')) }} - pushInPlatformN: true - pushInPlatformP: false - - - stage: CD_Test - displayName: 'Test Deployment WE' - ${{ if eq(parameters.skipBuild, false)}}: - dependsOn: CI_Build - condition: | - and( - or(succeeded(), ${{ parameters.skipBuild }}), - or(eq(variables.isMain, 'true'),eq(variables.isFeature, 'true')) - ) - jobs: - - deployment: CD_Test - displayName: 'Deployment' - pool: - name: $(poolName) - environment: -we - variables: - - template: pipeline/variables/preprod-we-test.yaml - - template: variables/APPS_EU_PLATFORM_N_WE.yml@heimdallTemplates - strategy: - runOnce: - deploy: - steps: - - template: deployment.yml@heimdallTemplates - parameters: - runMigration: false - envKeyVaultName: $(ENV_KEYVAULT_NAME) - imageTag: ${{ parameters.imageTag }} - skipBuild: ${{ parameters.skipBuild }} diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/global.yaml b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/global.yaml deleted file mode 100644 index 6eccd6d0..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/global.yaml +++ /dev/null @@ -1,20 +0,0 @@ -variables: - # SonarCloud related - - name: SonarcloudProjectKey - value: '' - - name: SourceFolder - value: '' - - # ACR repo name | Don't rename the variable because it's linked with CD template - - name: service_name - value: ''.api.v1 - - # Docker related - required - - name: buildContext - value: '' - - name: dockerfilePath - value: '$(Build.SourcesDirectory)' - - # Helm Chart name - - name: helm_chart_name - value: \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/preprod-we-test.yaml b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/preprod-we-test.yaml deleted file mode 100644 index cb3ece8e..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/pipeline/nox-project/preprod-we-test.yaml +++ /dev/null @@ -1,7 +0,0 @@ -variables: - namespace: -test - - helm_install_name: - - HELM_CHART_VALUE_FILE: values-test.yaml - HELM_CHART_VERSION: "1.0.0" diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/env-vars.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/env-vars.tf deleted file mode 100644 index 695bbe8f..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/env-vars.tf +++ /dev/null @@ -1,149 +0,0 @@ -module "_variables" { - source = "app.terraform.io/iwgplc/tfc-variable/tfe" - version = "1.0.0" - - variable_params = { - # ------------------------------ West Europe --------------------------------- - we_var01 = { - key = "env" - value = "" - category = "terraform" - description = "Name of the environment." - variable_set_id = null - workspace_id = module._we.workspaces["${local.app_name}__we"].id - hcl = null - sensitive = null - } - we_var02 = { - key = "region" - value = "West Europe" - category = "terraform" - description = "Location where resources are being deployed." - variable_set_id = null - workspace_id = module._we.workspaces["${local.app_name}__we"].id - hcl = null - sensitive = null - } - we_var03 = { - key = "rp" - value = "we" - category = "terraform" - description = "Location prefix." - variable_set_id = null - workspace_id = module._we.workspaces["${local.app_name}__we"].id - hcl = null - sensitive = null - } - we_var04 = { - key = "tag_application_sla" - value = "NOSLA" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module._we.workspaces["${local.app_name}__we"].id - hcl = null - sensitive = null - } - we_var05 = { - key = "tag_business_criticality" - value = "BC1" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module._we.workspaces["${local.app_name}__we"].id - hcl = null - sensitive = null - } - we_var06 = { - key = "parent_workspace_name" - value = var.heimdall_workspace_preprod_we - category = "terraform" - description = "TFC parent workspace name, for reading state output." - variable_set_id = null - workspace_id = module._we.workspaces["${local.app_name}__we"].id - hcl = null - sensitive = null - } - we_var07 = { - key = "k8s_namespace" - value = "" - category = "terraform" - description = "K8s namespace of the environment" - variable_set_id = null - workspace_id = module._we.workspaces["${local.app_name}__we"].id - hcl = null - sensitive = null - }, - # ------------------------------ North Europe --------------------------------- - ne_var01 = { - key = "env" - value = "" - category = "terraform" - description = "Name of the environment." - variable_set_id = null - workspace_id = module._ne.workspaces["${local.app_name}__ne"].id - hcl = null - sensitive = null - } - ne_var02 = { - key = "region" - value = "North Europe" - category = "terraform" - description = "Location where resources are being deployed." - variable_set_id = null - workspace_id = module._ne.workspaces["${local.app_name}__ne"].id - hcl = null - sensitive = null - } - ne_var03 = { - key = "rp" - value = "ne" - category = "terraform" - description = "Location prefix." - variable_set_id = null - workspace_id = module._ne.workspaces["${local.app_name}__ne"].id - hcl = null - sensitive = null - } - ne_var04 = { - key = "tag_application_sla" - value = "NOSLA" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module._ne.workspaces["${local.app_name}__ne"].id - hcl = null - sensitive = null - } - ne_var05 = { - key = "tag_business_criticality" - value = "BC1" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module._ne.workspaces["${local.app_name}__ne"].id - hcl = null - sensitive = null - } - ne_var06 = { - key = "parent_workspace_name" - value = var.heimdall_workspace_preprod_ne - category = "terraform" - description = "TFC parent workspace name, for reading state output." - variable_set_id = null - workspace_id = module._ne.workspaces["${local.app_name}__ne"].id - hcl = null - sensitive = null - } - ne_var07 = { - key = "k8s_namespace" - value = "" - category = "terraform" - description = "K8s namespace of the environment" - variable_set_id = null - workspace_id = module._ne.workspaces["${local.app_name}__ne"].id - hcl = null - sensitive = null - } - } -} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-prod-vars.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-prod-vars.tf deleted file mode 100644 index c50ba0d8..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-prod-vars.tf +++ /dev/null @@ -1,149 +0,0 @@ -module "heimdall__prod_variables" { - source = "app.terraform.io/iwgplc/tfc-variable/tfe" - version = "1.0.0" - - variable_params = { - # ------------------------------ West Europe --------------------------------- - we_var01 = { - key = "env" - value = "prod" - category = "terraform" - description = "Name of the environment." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id - hcl = null - sensitive = null - } - we_var02 = { - key = "region" - value = "West Europe" - category = "terraform" - description = "Location where resources are being deployed." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id - hcl = null - sensitive = null - } - we_var03 = { - key = "rp" - value = "we" - category = "terraform" - description = "Location prefix." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id - hcl = null - sensitive = null - } - we_var04 = { - key = "tag_application_sla" - value = "NOSLA" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id - hcl = null - sensitive = null - } - we_var05 = { - key = "tag_business_criticality" - value = "BC1" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id - hcl = null - sensitive = null - } - we_var06 = { - key = "parent_workspace_name" - value = module.Heimdall_Workspaces.workspaces["prod_we"].name - category = "terraform" - description = "TFC parent workspace name, for reading state output." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id - hcl = null - sensitive = null - } - we_var07 = { - key = "k8s_namespace" - value = "-prod" - category = "terraform" - description = "K8s namespace of the environment" - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_we"].id - hcl = null - sensitive = null - }, - # ------------------------------ North Europe --------------------------------- - ne_var01 = { - key = "env" - value = "prod" - category = "terraform" - description = "Name of the environment." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id - hcl = null - sensitive = null - } - ne_var02 = { - key = "region" - value = "North Europe" - category = "terraform" - description = "Location where resources are being deployed." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id - hcl = null - sensitive = null - } - ne_var03 = { - key = "rp" - value = "ne" - category = "terraform" - description = "Location prefix." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id - hcl = null - sensitive = null - } - ne_var04 = { - key = "tag_application_sla" - value = "NOSLA" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id - hcl = null - sensitive = null - } - ne_var05 = { - key = "tag_business_criticality" - value = "BC1" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id - hcl = null - sensitive = null - } - ne_var06 = { - key = "parent_workspace_name" - value = module.Heimdall_Workspaces.workspaces["prod_ne"].name - category = "terraform" - description = "TFC parent workspace name, for reading state output." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id - hcl = null - sensitive = null - } - ne_var07 = { - key = "k8s_namespace" - value = "-prod" - category = "terraform" - description = "K8s namespace of the environment" - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_prod_ne"].id - hcl = null - sensitive = null - } - } -} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-test-vars.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-test-vars.tf deleted file mode 100644 index aa7bb023..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-test-vars.tf +++ /dev/null @@ -1,149 +0,0 @@ -module "heimdall__test_variables" { - source = "app.terraform.io/iwgplc/tfc-variable/tfe" - version = "1.0.0" - - variable_params = { - # ------------------------------ West Europe --------------------------------- - we_var01 = { - key = "env" - value = "test" - category = "terraform" - description = "Name of the environment." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id - hcl = null - sensitive = null - } - we_var02 = { - key = "region" - value = "West Europe" - category = "terraform" - description = "Location where resources are being deployed." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id - hcl = null - sensitive = null - } - we_var03 = { - key = "rp" - value = "we" - category = "terraform" - description = "Location prefix." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id - hcl = null - sensitive = null - } - we_var04 = { - key = "tag_application_sla" - value = "NOSLA" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id - hcl = null - sensitive = null - } - we_var05 = { - key = "tag_business_criticality" - value = "BC1" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id - hcl = null - sensitive = null - } - we_var06 = { - key = "parent_workspace_name" - value = module.Heimdall_Workspaces.workspaces["preprod_we"].name - category = "terraform" - description = "TFC parent workspace name, for reading state output." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id - hcl = null - sensitive = null - } - we_var07 = { - key = "k8s_namespace" - value = "-test" - category = "terraform" - description = "K8s namespace of the environment" - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_we"].id - hcl = null - sensitive = null - }, - # ------------------------------ North Europe --------------------------------- - ne_var01 = { - key = "env" - value = "test" - category = "terraform" - description = "Name of the environment." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id - hcl = null - sensitive = null - } - ne_var02 = { - key = "region" - value = "North Europe" - category = "terraform" - description = "Location where resources are being deployed." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id - hcl = null - sensitive = null - } - ne_var03 = { - key = "rp" - value = "ne" - category = "terraform" - description = "Location prefix." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id - hcl = null - sensitive = null - } - ne_var04 = { - key = "tag_application_sla" - value = "NOSLA" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id - hcl = null - sensitive = null - } - ne_var05 = { - key = "tag_business_criticality" - value = "BC1" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id - hcl = null - sensitive = null - } - ne_var06 = { - key = "parent_workspace_name" - value = module.Heimdall_Workspaces.workspaces["preprod_ne"].name - category = "terraform" - description = "TFC parent workspace name, for reading state output." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id - hcl = null - sensitive = null - } - ne_var07 = { - key = "k8s_namespace" - value = "-test" - category = "terraform" - description = "K8s namespace of the environment" - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_test_ne"].id - hcl = null - sensitive = null - } - } -} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-uat-vars.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-uat-vars.tf deleted file mode 100644 index 1ee9ac64..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice-uat-vars.tf +++ /dev/null @@ -1,149 +0,0 @@ -module "heimdall__uat_variables" { - source = "app.terraform.io/iwgplc/tfc-variable/tfe" - version = "1.0.0" - - variable_params = { - # ------------------------------ West Europe --------------------------------- - we_var01 = { - key = "env" - value = "uat" - category = "terraform" - description = "Name of the environment." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id - hcl = null - sensitive = null - } - we_var02 = { - key = "region" - value = "West Europe" - category = "terraform" - description = "Location where resources are being deployed." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id - hcl = null - sensitive = null - } - we_var03 = { - key = "rp" - value = "we" - category = "terraform" - description = "Location prefix." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id - hcl = null - sensitive = null - } - we_var04 = { - key = "tag_application_sla" - value = "NOSLA" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id - hcl = null - sensitive = null - } - we_var05 = { - key = "tag_business_criticality" - value = "BC1" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id - hcl = null - sensitive = null - } - we_var06 = { - key = "parent_workspace_name" - value = module.Heimdall_Workspaces.workspaces["prod_we"].name - category = "terraform" - description = "TFC parent workspace name, for reading state output." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id - hcl = null - sensitive = null - } - we_var07 = { - key = "k8s_namespace" - value = "-uat" - category = "terraform" - description = "K8s namespace of the environment" - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_we"].id - hcl = null - sensitive = null - }, - # ------------------------------ North Europe --------------------------------- - ne_var01 = { - key = "env" - value = "uat" - category = "terraform" - description = "Name of the environment." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id - hcl = null - sensitive = null - } - ne_var02 = { - key = "region" - value = "North Europe" - category = "terraform" - description = "Location where resources are being deployed." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id - hcl = null - sensitive = null - } - ne_var03 = { - key = "rp" - value = "ne" - category = "terraform" - description = "Location prefix." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id - hcl = null - sensitive = null - } - ne_var04 = { - key = "tag_application_sla" - value = "NOSLA" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id - hcl = null - sensitive = null - } - ne_var05 = { - key = "tag_business_criticality" - value = "BC1" - category = "terraform" - description = "TAG attribute." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id - hcl = null - sensitive = null - } - ne_var06 = { - key = "parent_workspace_name" - value = module.Heimdall_Workspaces.workspaces["prod_ne"].name - category = "terraform" - description = "TFC parent workspace name, for reading state output." - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id - hcl = null - sensitive = null - } - ne_var07 = { - key = "k8s_namespace" - value = "-uat" - category = "terraform" - description = "K8s namespace of the environment" - variable_set_id = null - workspace_id = module.heimdall__workspaces.workspaces["_uat_ne"].id - hcl = null - sensitive = null - } - } -} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice.tf deleted file mode 100644 index 54433787..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/heimdall-ms-microservice.tf +++ /dev/null @@ -1,9 +0,0 @@ -module "heimdall__workspaces" { - source = "./heimdall-ms-" - - heimdall_workspace_preprod_we = module.Heimdall_Workspaces.workspaces["preprod_we"].name - heimdall_workspace_preprod_ne = module.Heimdall_Workspaces.workspaces["preprod_ne"].name - heimdall_workspace_prod_we = module.Heimdall_Workspaces.workspaces["prod_we"].name - heimdall_workspace_prod_ne = module.Heimdall_Workspaces.workspaces["prod_ne"].name - -} \ No newline at end of file diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/outputs.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/outputs.tf deleted file mode 100644 index 5bb1673e..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/outputs.tf +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/tfc-workspace.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/tfc-workspace.tf deleted file mode 100644 index 782bf342..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/tfc-workspace.tf +++ /dev/null @@ -1,22 +0,0 @@ -locals { - app_name = "" -} - -module "test_we" { - source = "../module" - - app_name = local.app_name - vcs_repo_identifier = "iwgplc//_git/-infrastructure-tf" - environment = "test" - region = "we" - -} -module "test_ne" { - source = "../module" - - app_name = local.app_name - vcs_repo_identifier = "iwgplc//_git/-infrastructure-tf" - environment = "test" - region = "ne" - -} diff --git a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/variables.tf b/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/variables.tf deleted file mode 100644 index 740ed064..00000000 --- a/docs/scripts/template/88155c28-f750-4013-91d3-8347ddb3daa7/terraform/variables.tf +++ /dev/null @@ -1,12 +0,0 @@ -variable "heimdall_workspace_preprod_we" { - type = string -} -variable "heimdall_workspace_preprod_ne" { - type = string -} -variable "heimdall_workspace_prod_we" { - type = string -} -variable "heimdall_workspace_prod_ne" { - type = string -} diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_Connect.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_Connect.steps.nox.yaml deleted file mode 100644 index 1d73c205..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_Connect.steps.nox.yaml +++ /dev/null @@ -1,33 +0,0 @@ -steps: - - name: Connect to Azure Active Directory - id: connect-aad - uses: azuread/connect@v1 - with: - tenant-id: ${{ server.secrets.AZURE_TENANT_ID }} - client-id: ${{ server.secrets.AZURE_CLIENT_ID }} - client-secret: ${{ server.secrets.AZURE_CLIENT_SECRET }} - display: - success: Successfully connected to Azure Active Directory - error: Unable to connect to Azure Active Directory - run-at-server: true - - - name: Locate the DevOps server - id: locate-devops - uses: network/ping@v1 - with: - host: ${{ project.versionControl.server }} - display: - success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds - error: The DevOps server is not accessible. Are you connected to the Internet? - run-at-server: true - - - name: Connect to the DevOps server - id: connect-devops - uses: azdevops/connect@v1 - with: - server: ${{ project.versionControl.server }} - personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} - display: - success: Connected to the DevOps server - error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) - run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DevopsProject.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DevopsProject.steps.nox.yaml deleted file mode 100644 index 95c9ea0a..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DevopsProject.steps.nox.yaml +++ /dev/null @@ -1,11 +0,0 @@ -steps: - - name: Get the DevOps project - id: get-devops-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: IWG.DevOps - display: - success: Got the DevOps project - error: Unable to get the DevOps project (${{ steps.get-devops-project.error-message }}) - run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DirSetup.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DirSetup.steps.nox.yaml deleted file mode 100644 index edd747c9..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_DirSetup.steps.nox.yaml +++ /dev/null @@ -1,293 +0,0 @@ -steps: - - name: Get the current directory - id: get-start-dir - uses: file/get-current-directory@v1 - - - name: Store current directory - id: store-start-dir - uses: core/add-variables@v1 - with: - start-dir: ${{ steps.get-start-dir.outputs.path }} - - - name: Ensure the .nox folder exists - id: ensure-nox-folder - uses: file/ensure-folder@v1 - with: - path: ./ - folder-name: .nox - display: - success: Ensured that the .nox folder exists - error: Unable to ensure that the .nox folder exists (${{ steps.ensure-nox-folder.error-message }}) - - - name: Ensure that the .nox/design folder exists - id: ensure-design-folder - uses: file/ensure-folder@v1 - with: - path: ./.nox - folder-name: design - display: - success: Ensured that the .nox/design folder exists - error: Unable to ensure that the .nox/design folder exists (${{ steps.ensure-design-folder.error-message }}) - - - name: Search for a Nox yaml definition - id: find-nox-yaml - uses: file/find-file@v1 - with: - path: ./.nox/design - file-name: "*.service.nox.yaml" - - - name: Get the project name - if: '"${{ steps.find-nox-yaml.outputs.is-found }}" == "False"' - id: create-nox-yaml - uses: console/prompt-schema@v1 - with: - schema: | - { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "required": ["name"], - "properties": { - "name": { - "type": "string", - "description": "The name of the NOX solution", - "default": "${{ steps.get-start-dir.outputs.directory-name }}" - } - } - } - - - name: Create a nox yaml definition - id: add-nox-options - if: '"${{ steps.find-nox-yaml.outputs.is-found }}" == "False"' - uses: console/prompt-schema@v1 - with: - schema-url: https://noxorg.dev/schemas/NoxConfiguration.json - include-prompts: [ "description","database","versionControl","team" ] - exclude-prompts: - - team.developers[0].mobilePhoneNumber - - database.provider - - database.options - - database.connectionString - - database.connectionStringVariable - - versionControl.provider - defaults: - name: ${{ steps.create-nox-yaml.outputs.name }} - description: The ${{ steps.create-nox-yaml.outputs.name }} service - database.name: ${{ steps.create-nox-yaml.outputs.name }}Db - database.server: "localhost" - database.provider: "postgres" - database.port: 5432 - database.user: sa - database.password: Developer*123 - versionControl.provider: azureDevOps - versionControl.server: https://dev.azure.com/iwgplc - versionControl.project: ${{ steps.create-nox-yaml.outputs.name }} - versionControl.repository: ${{ steps.create-nox-yaml.outputs.name }}.Api.V1 - team.developers[0].name: ${{ cache.username }} - team.developers[0].userName: ${{ cache.upn }} - team.developers[0].isProductOwner: n - output-file: - folder: ./.nox/design - filename: ${{ steps.create-nox-yaml.outputs.name }}.service.nox.yaml - display: - success: Created nox yaml definition ${{ steps.add-nox-options.outputs.file-path }} - error: Unable to create a yaml definition for your solution (${{ steps.add-nox-options.error-message }}) - - - name: Load the new Nox solution configuration - id: load-nox-config - if: '"${{ steps.find-nox-yaml.outputs.is-found }}" == "False"' - uses: core/load-nox-configuration@v1 - with: - path: ./.nox/design - display: - success: Loaded the newly created Nox solution configuration - error: Unable to load the newly created Nox solution configuration (${{ steps.load-nox-config.error-message }}) - - - name: Find the .git folder - id: find-git-folder - uses: file/find-folder@v1 - with: - path: ./.git - - - name: Perform a git init - id: git-init - if: '"${{ steps.find-git-folder.outputs.is-found }}" == "False"' - uses: powershell/script@v1 - with: - script: git init -b main - display: - success: Performed a git init - error: Unable to perform a git init (${{ steps.git-init.error-message }}) - - - name: Find the .gitignore file - id: find-gitignore - uses: file/find-file@v1 - with: - path: ./ - file-name: .gitignore - - - name: Create a gitignore file - id: create-gitignore - if: '"${{ steps.find-gitignore.outputs.is-found }}" == "False"' - uses: powershell/script@v1 - with: - script: dotnet new gitignore - display: - success: Created a gitignore file - error: Unable to create a gitignore file (${{ steps.create-gitignore.error-message }}) - - - name: Ensure the src folder exists - id: ensure-src-folder - uses: file/ensure-folder@v1 - with: - path: ./ - folder-name: src - display: - success: Ensured that the src folder exists - error: Unable to ensure that the src folder exists (${{ steps.ensure-src-folder.error-message }}) - - - name: Ensure the tests folder exists - id: ensure-tests-folder - uses: file/ensure-folder@v1 - with: - path: ./ - folder-name: tests - display: - success: Ensured that the tests folder exists - error: Unable to ensure that the tests folder exists (${{ steps.ensure-tests-folder.error-message }}) - - - name: Set src as current directory - id: set-src-current - uses: file/set-current-directory@v1 - with: - path: ./src - - - name: Find the sln file - id: find-sln - uses: file/find-file@v1 - with: - path: ./ - file-name: ${{ project.versionControl.project }}.sln - - - name: Create the sln file - id: create-sln - if: '"${{ steps.find-sln.outputs.is-found }}" == "False"' - uses: powershell/script@v1 - with: - script: dotnet new solution -n ${{ project.versionControl.project }} - display: - success: Created a new dotnet solution - error: Unable to create a new dotnet solution (${{ steps.create-sln.error-message }}) - - - name: Find the proj file - id: find-proj - uses: file/find-file@v1 - with: - path: ./${{ project.versionControl.repository }} - file-name: ${{ project.versionControl.repository }}.csproj - - - name: Create a dotnet webapi project - id: create-proj - if: '"${{ steps.find-proj.outputs.is-found }}" == "False"' - uses: powershell/script@v1 - with: - script: dotnet new webapi -n ${{ project.versionControl.repository }} - display: - success: Created a new dotnet webapi project - error: Unable to create a new dotnet webapi project (${{ steps.create-proj.error-message }}) - - - name: Add the webapi to the solution - id: add-proj-to-sln - uses: powershell/script@v1 - with: - script: dotnet sln add ${{ project.versionControl.repository }} - display: - success: Added the webapi to the solution - error: Unable to add the webapi to the solution (${{ steps.add-proj-to-sln.error-message }}) - - - name: Search for a .dockerignore file - id: find-dockerignore - uses: file/find-file@v1 - with: - path: ./ - file-name: .dockerignore - - - name: Load the dockerignore template - id: load-dockerignore-template - if: '"${{ steps.find-dockerignore.outputs.is-found }}" == "False"' - uses: core/load-template@v1 - with: - path: docker/dockerignore - display: - success: Loaded the dockerignore template - error: Unable to load the dockerignore template (${{ steps.load-dockerignore-template.error-message }}) - - - name: Create a .dockerignore for the project - id: create-dockerignore - if: '"${{ steps.find-dockerignore.outputs.is-found }}" == "False"' - uses: file/write-text@v1 - with: - path: ./.dockerignore - text-to-write: ${{ steps.load-dockerignore-template.outputs.result }} - display: - success: Created a .docker ignore file - error: Unable to create a .dockerignore file (${{ steps.create-dockerignore.error-message }}) - - - name: Search for a Docker file - id: find-docker-file - uses: file/find-file@v1 - with: - path: ./ - file-name: Dockerfile - - - name: Load the Dockerfile template - id: load-dockerfile-template - if: '"${{ steps.find-docker-file.outputs.is-found }}" == "False"' - uses: core/load-template@v1 - with: - path: docker/Dockerfile - display: - success: Loaded the Dockerfile template - error: Unable to load the Dockerfile template (${{ steps.load-dockerfile-template.error-message }}) - - - name: Interpolate Dockerfile template variables - id: interpolate-docker-file - if: '"${{ steps.find-docker-file.outputs.is-found }}" == "False"' - uses: core/replace-strings@v1 - with: - source-string: ${{ steps.load-dockerfile-template.outputs.result }} - replacements: - "": ${{ project.versionControl.repository }} - display: - success: Interpolated Dockerfile template variables - error: Unable to interpolated Dockerfile template variables ${{ steps.interpolate-docker-file.error-message }} - - - name: Create a Dockerfile for the project - id: create-docker-file - if: '"${{ steps.find-docker-file.outputs.is-found }}" == "False"' - uses: file/write-text@v1 - with: - path: ./Dockerfile - text-to-write: ${{ steps.interpolate-docker-file.outputs.result }} - display: - success: Created a .Dockerfile file - error: Unable to create a Dockerfile (${{ steps.create-docker-file.error-message }}) - - - name: Add the project files to git - id: git-add-files - if: '"${{ steps.find-proj.outputs.is-found }}" == "False"' - uses: powershell/script@v1 - with: - script: git add --all - display: - success: Added the project files to git - error: Unable to add the project files to git (${{ steps.git-add-files.error-message }}) - - - name: Perform an initial commit - id: git-initial-commit - if: '"${{ steps.find-proj.outputs.is-found }}" == "False"' - uses: powershell/script@v1 - with: - script: git commit -m "Initial Commit" - display: - success: Performed an initial commit - error: Unable to perform an initial commit (${{ steps.git-initial-commit.error-message }}) diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_NoxProject.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_NoxProject.steps.nox.yaml deleted file mode 100644 index 15874dee..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_NoxProject.steps.nox.yaml +++ /dev/null @@ -1,11 +0,0 @@ -steps: - - name: Get the Nox project - id: get-nox-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: ${{ project.versionControl.project }} - display: - success: Got the ${{ project.versionControl.project }} DevOps project - error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) - run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_OutputTable.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_OutputTable.steps.nox.yaml deleted file mode 100644 index fe23f9df..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_OutputTable.steps.nox.yaml +++ /dev/null @@ -1,10 +0,0 @@ -steps: - - name: Notable properties of the deployment - id: output-table - uses: console/write-table@v1 - with: - lines: - "DevOps Project": "${{ project.versionControl.server }}/${{ project.versionControl.project }}" - "Code Repository": "${{ project.versionControl.server }}/${{ project.versionControl.project }}/_git/${{ project.versionControl.repository }}" - "Internal Api Endpoint": "https://${{ vars.project-dash-name }}-test.ingena-int.work" - "External Api Endpoint": "https://${{ vars.project-dash-name }}-test.ingena.work" \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_ServerInit.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_ServerInit.steps.nox.yaml deleted file mode 100644 index 240851e0..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_ServerInit.steps.nox.yaml +++ /dev/null @@ -1,60 +0,0 @@ -steps: - - name: Get Project dash case name - id: get-project-dash-name - uses: core/to-dash-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project dash case name - error: Unable to get the Project dash case name (${{ steps.get-project-dash-name.error-message }}) - - - name: Get the project snake case name - id: get-project-snake-name - uses: core/to-snake-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project snake case name - error: Unable to get the Project snake case name (${{ steps.get-project-snake-name.error-message }}) - - - name: Get Project Short Name - id: get-project-short-name - uses: core/get-string-capitals@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the project short name. - error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) - - - name: Get the Team Member user name list - id: get-team-uname-list - uses: project/get-team-user-names@v1 - with: - team-members: ${{ project.team.developers }} - display: - success: Got the team user name list - error: Unable to get the team user name list (${{ steps.get-team-uname-list.error-message }}) - - - name: Get the Team Admins user name list - id: get-project-admin-uname-list - uses: project/get-admin-user-names@v1 - with: - team-members: ${{ project.team.developers }} - display: - success: Got the project admins user name list - error: Unable to get the project admins user name list (${{ steps.get-project-admin-list.error-message }}) - - - name: Store setup variables - id: add-setup-vars - uses: core/add-variables@v1 - with: - project-name: ${{ project.versionControl.project }} - project-dash-name: ${{ steps.get-project-dash-name.outputs.result }} - project-snake-name: ${{ steps.get-project-snake-name.outputs.result }} - project-short-name: ${{ steps.get-project-short-name.outputs.lower-result }} - team-user-names: ${{ steps.get-team-uname-list.outputs.user-names }} - admin-user-names: ${{ steps.get-project-admin-uname-list.outputs.user-names }} - tf-folder: heimdall-ms-${{ steps.get-project-dash-name.outputs.result }} - display: - success: Variables stored - error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_SyncRepos.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_SyncRepos.steps.nox.yaml deleted file mode 100644 index 655dbb4e..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSln_SyncRepos.steps.nox.yaml +++ /dev/null @@ -1,34 +0,0 @@ -steps: - - name: Add the remote repo to local git - id: git-add-remote - uses: powershell/script@v1 - with: - script: git remote add iwgplc ${{ project.versionControl.server }}/${{ project.versionControl.project }}/_git/${{ project.versionControl.repository }} - display: - success: Added the remote repo to local git - error: Unable to add the remote repo to local git (${{ steps.git-add-remote.error-message }}) - - - name: Get a AzDevOps PAT - id: get-devops-pat - uses: azdevops/get-pat@v1 - with: - organization: iwgplc - access-token: ${{ cache.aztoken }} - - - name: Pull the remote repo - id: git-pull-remote - uses: powershell/script@v1 - with: - script: "git -c http.extraHeader=\"Authorization: Basic ${{ steps.get-devops-pat.outputs.base64-result }}\" pull --rebase iwgplc main" - display: - success: Pulled the remote repository - error: Unable to pull the remote repository (${{ steps.git-pull-remote.error-message }}) - - - name: Push local repo to remote - id: git-push-local - uses: powershell/script@v1 - with: - script: "git -c http.extraHeader=\"Authorization: Basic ${{ steps.get-devops-pat.outputs.base64-result }}\" push --set-upstream iwgplc main" - display: - success: Pushed the local changes to remote - error: Unable to push the local changes to remote (${{ steps.git-push-local.error-message }}) \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSolution.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSolution.workflow.nox.yaml deleted file mode 100644 index b6cb913f..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/InitSolution.workflow.nox.yaml +++ /dev/null @@ -1,56 +0,0 @@ -# NOX Init Solution Command - -name: Initialize a Nox Solution -description: This workflow will initialize a Nox solution and sync it with with Azure AD, Terraform and DevOps - -cli: - branch: init - command: solution - command-alias: sln - description: "|np - Initialize a Nox solution." - examples: - - ["init solution", "--path "] - - ["init sln", "--path "] - -jobs: - local-initialize: - $ref: InitSln_DirSetup.steps.nox.yaml - - server-initialize: - $ref: InitSln_ServerInit.steps.nox.yaml - - connect: - $ref: InitSln_Connect.steps.nox.yaml - - sync-active-directory: - $ref: SyncAzureActiveDirectory.steps.nox.yaml - - sync-version-control: - $ref: SyncVersionControl.steps.nox.yaml - - nox-project: - $ref: InitSln_NoxProject.steps.nox.yaml - - sync-infrastructure: - $ref: SyncInfrastructure.steps.nox.yaml - - sync-helm-chart: - $ref: SyncHelmChart.steps.nox.yaml - - devops-project: - $ref: InitSln_DevopsProject.steps.nox.yaml - - sync-helm-chart-pipeline: - $ref: SyncHelmPipeline.steps.nox.yaml - - sync-project-pipeline: - $ref: SyncProjectPipeline.steps.nox.yaml - - sync-repos: - $ref: InitSln_SyncRepos.steps.nox.yaml - - output-table: - $ref: InitSln_OutputTable.steps.nox.yaml - - - \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/Manifest.cli.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/Manifest.cli.nox.yaml deleted file mode 100644 index 73a31b19..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/Manifest.cli.nox.yaml +++ /dev/null @@ -1,33 +0,0 @@ -# Manifest.cli.nox.yaml - -cli-commands: - - name: new - description: Create new services, entities, loaders, api's, and more - - name: sync - description: Synchronize your project with version control and remote environments - - name: init - description: Initialize your project - -authentication: - provider: azure - tenant-id: 88155c28-f750-4013-91d3-8347ddb3daa7 - -local-task-executor: - secrets: - valid-for: - hours: 12 - providers: - - provider: azure-keyvault - url: https://nox-EDA1DB500EBCEB02.vault.azure.net/ - -remote-task-executor: -# url: https://nox-cli-test.ingena.work - url: http://localhost:8000 - application-id: 750b96e1-e772-48f8-b6b3-84bac1961d9b - secrets: - valid-for: - hours: 12 - providers: - - provider: azure-keyvault - url: https://nox-14356B22BB785E44.vault.azure.net/ - diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/NewNoxService.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/NewNoxService.workflow.nox.yaml deleted file mode 100644 index eb3ff490..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/NewNoxService.workflow.nox.yaml +++ /dev/null @@ -1,74 +0,0 @@ -# NOX New Service Command - -name: Creates a new NOX service - -cli: - branch: new - command: service - command-alias: sv - description: "|sv - Creates a new NOX app/service" - examples: - - ["new service", "--path "] - -jobs: - new-service: - steps: - - name: Ensuring service definition doesn't exist - id: check-exists - uses: core/add-variables@v1 - with: - service-yaml-exists: ${{ config.name }} != "" - validate: - that: '"${{ config.name }}" == ""' - display: - error: A service definition '${{ config.name }}' already exists in this repo - - - name: Create a new app/service - id: add-new-service - uses: console/prompt-schema@v1 - with: - schema: | - { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "object", - "required": ["name"], - "properties": { - "name": { - "type": "string", - "description": "The name of the NOX service", - "default": "MyNoxService" - } - } - } - - - name: Specify the require app/service options - id: add-new-service-options - uses: console/prompt-schema@v1 - with: - schema-url: https://noxorg.dev/schemas/NoxConfiguration.json - include-prompts: ["description","database","versionControl","team"] - exclude-prompts: - - team.developers[0].mobilePhoneNumber - - database.provider - - database.options - - database.connectionString - - database.connectionStringVariable - - versionControl.provider - defaults: - name: ${{ steps.add-new-service.outputs.name }} - description: The ${{ steps.add-new-service.outputs.name }} service - database.name: ${{ steps.add-new-service.outputs.name }}Db - database.server: "localhost" - database.provider: "postgres" - database.port: 5432 - database.user: sa - database.password: Developer*123 - versionControl.provider: azureDevOps - versionControl.server: https://dev.azure.com/iwgplc - versionControl.project: Nox.${{ steps.add-new-service.outputs.name }} - versionControl.repository: ${{ steps.add-new-service.outputs.name }}.Api.V1 - team.developers[0].name: ${{ user.name }} - team.developers[0].userName: ${{ user.upn }} - output-file: - path: ./nox/design - filename: ${{ steps.add-new-service.outputs.name }}.service.nox.yaml diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.steps.nox.yaml deleted file mode 100644 index 551bc05e..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.steps.nox.yaml +++ /dev/null @@ -1,161 +0,0 @@ -steps: - - name: Find the project AAD group - id: find-project-group - uses: azuread/find-group@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - group-name: NOX_PROJECT_${{ project.name }} - display: - success: Searched for the NOX_PROJECT_${{ project.name }} AAD Group - error: Unable to search for the NOX_PROJECT_${{ project.name }} AAD Group (${{ steps.find-project-group.error-message }}) - run-at-server: true - - - name: Store project group id variable - if: '"${{ steps.find-project-group.outputs.is-found }}" == "True"' - id: store-project-group-id - uses: core/add-variables@v1 - with: - project-group-id: ${{ steps.find-project-group.outputs.group-id }} - display: - success: Project group id stored - error: Unable to store project group id ${{ steps.store-project-group-id.error-message }} - - - name: Create the project AAD group if it does not exist - if: '"${{ steps.find-project-group.outputs.is-found }}" == "False"' - id: create-project-group - uses: azuread/create-group@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - group-name: NOX_PROJECT_${{ project.name }} - group-description: ${{ project.description }} - display: - success: Created the NOX_PROJECT_${{ project.name }} AAD group - error: Unable to create the NOX_PROJECT_${{ project.name }} AAD group (${{ steps.create-project-group.error-message }}) - run-at-server: true - - - name: Update project group id variable - if: '"${{ steps.find-project-group.outputs.is-found }}" == "False"' - id: update-project-group-id - uses: core/add-variables@v1 - with: - project-group-id: ${{ steps.create-project-group.outputs.group-id }} - display: - success: Project group id updated - error: Unable to update the project group id ${{ steps.update-project-group-id.error-message }} - - - name: Find the NOX_PROJECTS_ALL AAD group - id: find-nox_projects_all-group - uses: azuread/find-group@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - group-name: NOX_PROJECTS_ALL - display: - success: Searched for the NOX_PROJECTS_ALL AAD Group - error: Unable to search for the NOX_PROJECTS_ALL AAD Group (${{ steps.find-nox_projects_all-group.error-message }}) - run-at-server: true - - - name: Store NOX_PROJECTS_ALL group id variable - id: store-all-group-id - uses: core/add-variables@v1 - with: - all-group-id: ${{ steps.find-nox_projects_all-group.outputs.group-id }} - display: - success: NOX_PROJECTS_ALL group id stored - error: Unable to store NOX_PROJECTS_ALL group id ${{ steps.store-all-group-id.error-message }} - - - name: Create the NOX_PROJECTS_ALL AAD security group - if: '"${{ steps.find-nox_projects_all-group.outputs.is-found }}" == "False"' - id: create-nox-projects-all-group - uses: azuread/create-group@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - group-name: NOX_PROJECTS_ALL - group-description: Nox Projects - Security Group - display: - success: Created the AAD security group - error: Unable to create the AAD security group (${{ steps.create-security-group.error-message }}) - run-at-server: true - - - name: Update NOX_PROJECTS_ALL group id variable - if: '"${{ steps.find-nox_projects_all-group.outputs.is-found }}" == "False"' - id: update-all-group-id - uses: core/add-variables@v1 - with: - all-group-id: ${{ steps.create-nox-projects-all-group.outputs.group-id }} - display: - success: NOX_PROJECTS_ALL group id updated - error: Unable to update NOX_PROJECTS_ALL group id ${{ steps.update-all-group-id.error-message }} - - - name: Add the project group as a member of NOX_PROJECTS_ALL - id: add-project-group-to-all-group - uses: azuread/add-group-to-group@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - child-group-id: ${{ vars.project-group-id }} - parent-group-id: ${{ vars.all-group-id }} - display: - success: Added NOX_PROJECT_${{ project.name }} to NOX_PROJECTS_ALL - error: Unable to add NOX_PROJECT_${{ project.name }} to NOX_PROJECTS_ALL (${{ steps.add-project-group-to-all-group.error-message }}) - run-at-server: true - - - name: Get Team member user object Id list - if: '"${{ steps.get-team-uname-list.outputs.user-names }}" != ""' - id: get-team-obj-id-list - uses: azuread/get-users-object-id-list@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - user-names: ${{ vars.team-user-names }} - display: - success: Got the Team members object ids - error: Unable to get the team members object ids (${{ steps.get-team-obj-id-list.error-message }}) - run-at-server: true - - - name: Get the team admins user object Id list - id: get-team-admin-obj-id-list - uses: azuread/get-users-object-id-list@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - user-names: ${{ vars.admin-user-names }} - display: - success: Got the Team admins object ids - error: Unable to get the team admins object ids (${{ steps.get-team-admin-obj-id-list.error-message }}) - run-at-server: true - - - name: Add project team members to project group - if: '"${{ steps.get-team-uname-list.outputs.user-names }}" != ""' - id: add-members-to-aad-group - uses: azuread/add-users-to-group@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - group-id: ${{ vars.project-group-id }} - user-object-ids: ${{ steps.get-team-obj-id-list.outputs.object-ids }} - display: - success: Added project team members to project group - error: Unable to add project team members to project group (${{ steps.add-members-to-aad-group.error-message }}) - run-at-server: true - - - name: Add project admins to project group - id: add-admins-to-aad-group - uses: azuread/add-users-to-group@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - group-id: ${{ vars.project-group-id }} - user-object-ids: ${{ steps.get-team-admin-obj-id-list.outputs.object-ids }} - is-owner: true - display: - success: Added project team admins to project AAD group - error: Unable to add project admins to project AAD group (${{ steps.add-admins-to-aad-group.error-message }}) - run-at-server: true - - - name: Add Nox.Cli to project group - id: add-cli-to-project-group - uses: azuread/add-user-to-group@v1 - with: - aad-client: ${{ steps.connect-aad.outputs.aad-client }} - group-id: ${{ vars.project-group-id }} - user-object-id: 081ed5f0-1bdf-406a-a2c5-b4f7341bf3ee - is-owner: true - display: - success: Added Nox.Cli to project AAD group - error: Unable to add Nox.Cli to project AAD group (${{ steps.add-cli-to-project-group.error-message }}) - run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.workflow.nox.yaml deleted file mode 100644 index c3d5a9c6..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncAzureActiveDirectory.workflow.nox.yaml +++ /dev/null @@ -1,335 +0,0 @@ -# NOX Azure Active Directory Sync Command - -name: Synchronise NOX definition with Azure Active Directory - -cli: - branch: sync - command: azure-active-directory - command-alias: ad - description: "|ad - Synchronises NOX team definition with your Azure Active Directory (AAD)." - examples: - - ["sync azure-active-directory", "--path "] - - ["sync azad", "--path "] - -jobs: - main-setup: - steps: - - name: Get the Team Member user name list - id: get-team-uname-list - uses: project/get-team-user-names@v1 - with: - team-members: ${{ project.team.developers }} - display: - success: Got the team user name list - error: Unable to get the team user name list (${{ steps.get-team-uname-list.error-message }}) - - - name: Get the Team Admins user name list - id: get-project-admin-uname-list - uses: project/get-admin-user-names@v1 - with: - team-members: ${{ project.team.developers }} - display: - success: Got the project admins user name list - error: Unable to get the project admins user name list (${{ steps.get-project-admin-list.error-message }}) - - - name: Store setup variables - id: add-setup-vars - uses: core/add-variables@v1 - with: - project-name: ${{ project.versionControl.project }} - team-user-names: ${{ steps.get-team-uname-list.outputs.user-names }} - admin-user-names: ${{ steps.get-project-admin-uname-list.outputs.user-names }} - display: - success: Setup variables stored - error: Unable to store setup variables (${{ steps.add-setup-vars.error-message }}) - - connect: - steps: - - name: Connect to Azure Active Directory - id: connect-aad - uses: azuread/connect@v1 - with: - tenant-id: ${{ server.secrets.AZURE_TENANT_ID }} - client-id: ${{ server.secrets.AZURE_CLIENT_ID }} - client-secret: ${{ server.secrets.AZURE_CLIENT_SECRET }} - display: - success: Successfully connected to Azure Active Directory - error: Unable to connect to Azure Active Directory - run-at-server: true - - sync-active-directory: - $ref: SyncAzureActiveDirectory.steps.nox.yaml - -#MS Teams -# - name: Find the Project MS Teams, team -# id: find-ms-team -# uses: azuread/find-group@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# group-name: NOX_${{ project.name }} Team -# display: -# success: Searched for the NOX_${{ project.name }} Team -# error: Unable to search for the NOX_${{ project.name }} Team (${{ steps.find-ms-team.error-message }}) -# run-at-server: true -# -# - name: Save the MS Teams, Team Id -# if: '"${{ steps.find-ms-team.outputs.is-found }}" == "True"' -# id: save-team-id -# uses: core/add-variables@v1 -# with: -# team-id: ${{ steps.find-ms-team.outputs.group-id }} -# display: -# success: Saved the Team Id -# error: Unable to save the Team Id (${{ steps.save-team-id.error-message }}) -# -# - name: Create an MS teams, team for the project if it does not exist -# if: '"${{ steps.find-ms-team.outputs.is-found }}" == "False"' -# id: create-ms-team -# uses: teams/create-team@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# aad-group-id: ${{ vars.project-group-id }} -# team-name: NOX_${{ project.name }} Team -# team-description: Team for members of the Nox ${{ project.name }} project -# display: -# success: Created an MS Teams, team for the project -# error: Unable to create an MS Teams, team for the project ($${{ steps.create-ms-team.error-message }}) -# run-at-server: true -# -# - name: Update the MS Teams, Team Id -# if: '"${{ steps.find-ms-team.outputs.is-found }}" == "False"' -# id: update-team-id -# uses: core/add-variables@v1 -# with: -# team-id: ${{ steps.create-ms-team.outputs.team-id }} -# display: -# success: Updated the Team Id -# error: Unable to update the Team Id (${{ steps.update-team-id.error-message }}) -# -# - name: Add Project team members to MS Team -# id: add-members-to-ms-team -# uses: teams/add-members@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# user-object-ids: ${{ steps.get-team-obj-id-list.outputs.object-ids }} -# display: -# success: Added team members to MS Teams, team -# error: Unable to add team members to MS Teams, team (${{ steps.add-members-to-ms-team.error-message }}) -# run-at-server: true -# -# - name: Add Project Admins to MS Team -# id: add-admins-to-ms-team -# uses: teams/add-members@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# user-object-ids: ${{ steps.get-team-admin-obj-id-list.outputs.object-ids }} -# is-owner: true -# display: -# success: Added team admins to MS Teams, team -# error: Unable to add team admins to MS Teams, team (${{ steps.add-admins-to-ms-team.error-message }}) -# run-at-server: true -# -# - name: Add Nox.Cli to MS Team -# id: add-cli-to-ms-team -# uses: teams/add-member@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# object-id: 081ed5f0-1bdf-406a-a2c5-b4f7341bf3ee -# is-owner: true -# display: -# success: Added Nox.Cli to MS Teams, team -# error: Unable to add Nox.Cli to MS Teams, team (${{ steps.add-cli-to-ms-team.error-message }}) -# run-at-server: true -# -# - name: Find the DevOps Team -# id: find-devops-team -# uses: azuread/find-group@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# group-name: IWG DevOps Team -# display: -# success: Searched for the IWG DevOps Team -# error: Unable to search for the IWG DevOps Team (${{ steps.find-devops-team.error-message }}) -# run-at-server: true -# -# - name: Get the DevOps team members -# if: '"${{ steps.find-devops-team.outputs.is-found }}" == "True"' -# id: get-devops-members -# uses: azuread/get-group-member-ids@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# group-id: ${{ steps.find-devops-team.outputs.group-id }} -# display: -# success: Got the DevOps team members -# error: Unable to get the DevOps team members (${{ steps.get-devops-members.error-message }}) -# run-at-server: true -# -# - name: Add DevOps group to MS Team -# if: '"${{ steps.find-devops-team.outputs.is-found }}" == "True"' -# id: add-devops-to-ms-team -# uses: teams/add-members@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# user-object-ids: ${{ steps.get-devops-members.outputs.member-ids }} -# display: -# success: Added DevOps to MS Teams, team -# error: Unable to add DevOps to MS Teams, team (${{ steps.add-devops-to-ms-team.error-message }}) -# run-at-server: true -# -# - name: Find the Cli channel on the MS Teams team -# id: find-cli-channel -# uses: teams/find-channel@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-name: Nox Cli message channel -# display: -# success: Searched for the Cli channel on the MS Teams team (${{ steps.find-cli-channel.outputs.is-found }}) -# error: Unable to search for the Cli channel on the MS Teams team (${{ steps.find-cli-channel.error-message }}) -# run-at-server: true -# -# - name: Save the Channel Id -# if: '"${{ steps.find-cli-channel.outputs.is-found }}" == "True"' -# id: save-channel-id -# uses: core/add-variables@v1 -# with: -# channel-id: ${{ steps.find-cli-channel.outputs.channel-id }} -# display: -# success: Saved the Channel Id in a variable -# error: Unable to save the Channel Id in a variable (${{ steps.save-channel-id.error-message }}) -# -# - name: Create a channel on the MS Team -# if: '"${{ steps.find-cli-channel.outputs.is-found }}" == "False"' -# id: create-cli-channel -# uses: teams/create-channel@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-name: Nox Cli message channel -# channel-description: Channel used by Nox.Cli to message members of the project team -# display: -# success: Created the Cli channel on the MS Teams team -# error: Unable to create the Cli channel on the MS Teams team (${{ steps.create-cli-channel.error-message }}) -# run-at-server: true -# -# - name: Update the Channel Id -# if: '"${{ steps.find-cli-channel.outputs.is-found }}" == "False"' -# id: update-channel-id -# uses: core/add-variables@v1 -# with: -# channel-id: steps.create-cli-channel.outputs.channel-id -# display: -# success: Updated Channel Id -# error: Unable to update Channel Id (${{ steps.update-channel-id.error-message }}) - -# - name: Add Nox.Cli to channel -# id: add-cli-to-channel -# uses: teams/add-channel-member@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-id: ${{ steps.create-cli-channel.outputs.channel-id }} -# object-id: 081ed5f0-1bdf-406a-a2c5-b4f7341bf3ee -# is-owner: true -# display: -# success: Added Nox.Cli to the project team channel -# error: Unable to add Nox.Cli to the project team channel (${{ steps.add-cli-to-channel.error-message }}) -# run-at-server: true - -# - name: Add team members to channel -# id: add-team-to-channel -# uses: teams/add-channel-members@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-id: ${{ steps.create-cli-channel.outputs.channel-id }} -# object-ids: ${{ steps.get-team-obj-id-list.outputs.object-ids }} -# display: -# success: Added project members to the project team channel -# error: Unable to add project members to the project team channel (${{ steps.add-team-to-channel.error-message }}) -# run-at-server: true -# -# - name: Add admins to channel -# id: add-admins-to-channel -# uses: teams/add-channel-members@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-id: ${{ steps.create-cli-channel.outputs.channel-id }} -# object-ids: ${{ steps.get-admin-obj-id-list.outputs.object-ids }} -# is-owner: true -# display: -# success: Added project admins to the project team channel -# error: Unable to add project admins to the project team channel (${{ steps.add-admins-to-channel.error-message }}) -# run-at-server: true - -# - name: Send Test message on project channel -# id: send-project-test-message -# uses: teams/send-channel-message@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-id: ${{ vars.channel-id }} -# message-body: Welcome to the ${{ project.name }} project team! -# display: -# success: Sent a test message to the project team channel -# error: Unable to send a test message to the project team channel (${{ steps.send-project-test-message.error-message }}) -# run-at-server: true -# -# - name: Create a DevOps channel on the MS Team -# id: create-devops-channel -# uses: teams/create-channel@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-name: ${{ project.name }} - DevOps channel -# channel-description: Channel used by Nox.Cli to message DevOps members. -# display: -# success: Created the DevOps channel on the MS Teams team -# error: Unable to create the DevOps channel on the MS Teams team (${{ steps.create-devops-channel.error-message }}) -# run-at-server: true -# -# - name: Add Nox.Cli toDevOps channel -# id: add-cli-to-devops-channel -# uses: teams/add-channel-member@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-id: ${{ steps.create-devops-channel.outputs.channel-id }} -# object-id: 081ed5f0-1bdf-406a-a2c5-b4f7341bf3ee -# is-owner: true -# display: -# success: Added Nox.Cli to the devops channel -# error: Unable to add Nox.Cli to the devops channel (${{ steps.add-cli-to-devops-channel.error-message }}) -# run-at-server: true -# -# - name: Add DevOps group to devops channel -# id: add-devops-to-devops-channel -# uses: teams/add-channel-member@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-id: ${{ steps.create-devops-channel.outputs.channel-id }} -# object-id: e00e4ac2-4318-472b-8c78-8cd8c3a54685 -# display: -# success: Added DevOps to DevOps channel -# error: Unable to add DevOps to DevOps channel (${{ steps.add-devops-to-devops-channel.error-message }}) -# run-at-server: true -# -# - name: Send Test message on DevOps channel -# id: send-devops-test-message -# uses: teams/send-channel-message@v1 -# with: -# aad-client: ${{ steps.connect.outputs.aad-client }} -# team-id: ${{ vars.team-id }} -# channel-id: ${{ steps.create-devops-channel.outputs.channel-id }} -# message-body: Welcome to the ${{ project.name }} DevOps team! -# display: -# success: Sent a test message to the devops team channel -# error: Unable to send a test message to the devops team channel (${{ steps.send-devops-test-message.error-message }}) -# run-at-server: true - diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDatabaseScript.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDatabaseScript.workflow.nox.yaml deleted file mode 100644 index aa2cbdd1..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDatabaseScript.workflow.nox.yaml +++ /dev/null @@ -1,160 +0,0 @@ -# NOX Database Sync Command - -name: Synchronise NOX Definition with Postgres database - -cli: - branch: sync - command: database - command-alias: db - description: "|db - Ensures hosted database and roles exist for your NOX definition." - examples: - - ["sync database", "--path "] - - ["sync db", "--path "] - -jobs: - sync-database: - steps: - - - name: Locating the database server - id: locate-server - uses: network/ping@v1 - with: - host: ${{ secrets.NOX_PG_SERVER }} - display: - success: Found the database server in ${{ steps.locate-server.outputs.roundtrip-time }} milliseconds - error: The database server is not accesable. Are you connected to the VPN? - - - name: Connecting to the database server - id: connect-server - uses: postgres/connect@v1 - with: - server: ${{ secrets.NOX_PG_SERVER }} - port: 5432 - user: ${{ secrets.NOX_PG_ADMIN_USER }} - password: ${{ secrets.NOX_PG_ADMIN_PASSWORD }} - database: postgres - display: - success: Connected to the database server - error: There was a problem connecting to the database. (${{ steps.connect-server.error-message }}) - - - name: Checking the database version - id: check-version - uses: postgres/execute-scalar@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - sql: SELECT version(); - display: - success: ${{ steps.check-version.outputs.result }} - error: There was a problem with the version check (${{ steps.check-version.error-message }}) - - - name: Sanitizing the database name to avoid Sql injection - id: get-dbname - uses: postgres/sanitize-sql-string@v1 - with: - input-string: NOX_${{ config.Database.Name }} - display: - success: The database name is ${{ steps.get-dbname.outputs.result }} - - - name: Storing the database name in a variable - id: add-var-dbname - uses: core/add-variables@v1 - with: - db-name: ${{ steps.get-dbname.outputs.result }} - display: - success: Variable 'db-name' set to '${{ vars.db-name }}' - - - name: Checking that the project database does not exist - id: db-not-exist - uses: postgres/execute-scalar@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - sql: SELECT datname FROM pg_database WHERE datname=($1); - parameters: ['${{ vars.db-name }}'] - validate: - that: '"${{ steps.db-not-exist.outputs.result }}" != "${{ vars.db-name }}"' - #that: ${{ steps.db-not-exist.outputs.result }} != ${{ vars.db-name }} - display: - success: The database does not exist yet - error: The database already exists - continue-on-error: true - - - name: Creating the project database - id: create-db - #if: ${{ steps.db-not-exist.was-valid }} - if: '"${{ steps.db-not-exist.outputs.result }}" != "${{ vars.db-name }}"' - uses: postgres/execute-nonquery@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - sql: CREATE DATABASE "${{ vars.db-name }}"; - display: - success: The database was succesfully created - error: Failed to create the database (${{ steps.create-db.error-message }}) - - - name: Connecting to the project database - id: connect-db - uses: postgres/connect@v1 - with: - server: ${{ secrets.NOX_PG_SERVER }} - port: 5432 - user: ${{ secrets.NOX_PG_ADMIN_USER }} - password: ${{ secrets.NOX_PG_ADMIN_PASSWORD }} - database: ${{ vars.db-name }} - display: - success: Connected to the project database - error: There was a problem connecting to the project database. (${{ steps.connect-db.error-message }}) - - - name: Creating variables for the database role, admin and password - id: add-other-vars - uses: core/add-variables@v1 - with: - db-role: ${{ vars.db-name }}_owneraccess - db-admin: ${{vars.db-name }}_pg_admin - db-password: ${{ vars.db-name }}_$123 - #db-password: ${{ env.SOME_VARIABLE }}_$123 - display: - success: Variables created succesfully - - - name: Creating admin user and role if needed and assign to admin user - id: create-role - uses: postgres/execute-nonquery@v1 - with: - connection: ${{ steps.connect-db.outputs.connection }} - sql: | - DO - $do$ - BEGIN - IF EXISTS( - SELECT FROM pg_catalog.pg_roles - WHERE rolname = LOWER('${{vars.db-role}}')) THEN - - RAISE NOTICE 'Role "${{vars.db-role}}" already exists. Skipping.'; - ELSE - CREATE ROLE ${{vars.db-role}} WITH LOGIN; - END IF; - END - $do$; - GRANT ALL ON DATABASE "${{vars.db-name}}" TO ${{vars.db-role}}; - GRANT ALL ON SCHEMA public TO ${{vars.db-role}}; - GRANT ALL ON ALL TABLES IN SCHEMA public TO ${{vars.db-role}}; - GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO ${{vars.db-role}}; - GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA public TO ${{vars.db-role}}; - DO - $do$ - BEGIN - IF EXISTS( - SELECT FROM pg_catalog.pg_user - WHERE usename = LOWER('${{vars.db-admin}}')) THEN - - RAISE NOTICE 'User "${{vars.db-admin}}" already exists. Skipping.'; - ELSE - CREATE USER ${{vars.db-admin}} WITH PASSWORD '${{vars.db-password}}'; - END IF; - END - $do$; - -- GRANT ${{vars.db-role}} TO ${{vars.db-admin}}; - ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO ${{vars.db-role}}; - ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON SEQUENCES TO ${{vars.db-role}}; - ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON FUNCTIONS TO ${{vars.db-role}}; - display: - success: The admin user and role was created and assigned - error: Failed to create user and role (${{ steps.create-role.error-message }}) diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDns.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDns.steps.nox.yaml deleted file mode 100644 index cb11c956..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncDns.steps.nox.yaml +++ /dev/null @@ -1,24 +0,0 @@ -steps: - - name: Connect to AAD - id: connect - uses: azuread/connect_v1 - with: - tenant-id: ${{ server.secrets.AZURE_TENANT_ID }} - client-id: ${{ server.secrets.AZURE_CLIENT_ID }} - client-secret: ${{ server.secrets.AZURE_CLIENT_SECRET }} - display: - success: Connected to Azure AD - error: Failed to connect to Azure AD ${{ steps.connect.error-message }} - run-at-server: true - - - name: Find CName - id: find-cname - uses: azuread/find-cname-record@v1 - with: - aad-client: ${{ steps.connect.outputs.aad-client }} - resource-group-name: rg_dns_common_prod - zone-name: ingena.work - display: - success: Searched for CName record - error: Unable to search for CName record (${{ steps.find-cname.error-message }}) - run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncElasticAlerts.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncElasticAlerts.workflow.nox.yaml deleted file mode 100644 index f8d0dc7e..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncElasticAlerts.workflow.nox.yaml +++ /dev/null @@ -1,215 +0,0 @@ -# NOX Elastic APM Alerts Sync Command - -name: Synchronise NOX definition with Elastic APM Alerts - -cli: - branch: sync - command: elastic-apm-alerts - command-alias: apm - description: "|ea - Creates or updates your Elastic APM alerts with NOX definition." - examples: - - ["sync elastic-apm-alerts", "--path "] - - ["sync apm", "--path "] - -jobs: - sync-elastic-apm: - steps: - - - name: Locate the DevOps server - id: locate-server - uses: network/ping@v1 - with: - host: ${{ project.versionControl.server }} - display: - success: Found the DevOps server in ${{ steps.locate-server.outputs.roundtrip-time }} milliseconds - error: The DevOps server is not accesable. Are you connected to the Internet? - run-at-server: true - - - name: Connect to the DevOps server - id: connect-server - uses: azdevops/connect@v1 - with: - server: ${{ project.versionControl.server }} - personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} - display: - success: Connected to the DevOps server - error: There was a problem connecting to the DevOps server. (${{ steps.connect-server.error-message }}) - run-at-server: true - - - name: Get the Nox Team project - id: get-nox-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - project-name: ${{ project.versionControl.project }} - display: - success: Got the ${{ project.versionControl.project }} DevOps project - error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) - run-at-server: true - - - name: Ensure the Project APM Repository exists - id: ensure-nox-apm-repo - uses: azdevops/ensure-repo-exists@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - repository-name: elastic-alert-config - display: - success: Ensured that the project elastic-alert-config repository exists - error: There was a problem ensuring that the project elastic-alert-config repository exists. ${{ steps.ensure-nox-apm-repo.error-message }} - run-at-server: true - - - name: Find the APM main branch - id: find-main - uses: azdevops/find-branch@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} - branch-name: main - display: - success: Sucessfully got the main branch of repo elastic-alert-config - error: There was a problem getting the main branch for repo elastic-alert-config - run-at-server: true - - - name: Get the IWG.APM project - id: get-apm-project - if: '"${{ steps.find-main.outputs.is-found }}" == "False"' - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - project-name: IWG.APM - display: - success: Got the IWG.APM project - error: There was a problem getting the IWG.APM project (${{ steps.get-apm-project.error-message }}) - run-at-server: true - - - name: Get the APM alert config repo - id: get-apm-alert-repo - if: '"${{ steps.find-main.outputs.is-found }}" == "False"' - uses: azdevops/get-repo@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - project-id: ${{ steps.get-apm-project.outputs.project-id }} - repository-name: elastic-alert-config - display: - success: Successfully got the APM alert config repo - error: There was a problem getting the APM alert config repository (${{ steps.get-apm-alert-repo.error-message }}) - run-at-server: true - - - name: Download the APM alert config repo - id: download-apm-repo - if: '"${{ steps.find-main.outputs.is-found }}" == "False"' - uses: azdevops/download-repo-branch@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - repository-id: ${{ steps.get-apm-alert-repo.outputs.repository-id }} - branch-name: main - display: - success: Successfully downloaded branch 'main' of the APM alert config repo to ${{ steps.download-apm-repo.outputs.local-repository-path }} - error: There was a problem downloading the repository (${{ steps.download-apm-repo.error-message }}) - run-at-server: true - - - name: Push APM repo to project main branch - id: push-apm-repo-to-main - if: '"${{ steps.find-main.outputs.is-found }}" == "False"' - uses: azdevops/push-folder@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} - source-path: ${{ steps.download-apm-repo.outputs.local-repository-path }} - display: - success: Push elastic-alert-config to project ${{ project.name }} success - error: Push elastic-alert-config to project ${{ project.name }} failed. (${{ steps.push-apm-repo-to-main.error-message }}) - run-at-server: true - - - name: Create new APM alerts branch - id: create-new-apm-branch - uses: azdevops/create-branch@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} - display: - success: Successfully created new APM alerts branch -> ${{ steps.create-new-apm-branch.outputs.branch-name }} - error: Failed to create new APM alerts branch -> ${{ steps.create-new-apm-branch.outputs.branch-name }} - run-at-server: true - - - name: Download the new APM alerts branch - id: download-apm-branch - uses: azdevops/download-repo-branch@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} - branch-name: ${{ steps.create-new-apm-branch.outputs.branch-name }} - display: - success: Successfully downloaded branch '${{ steps.create-new-apm-branch.outputs.branch-name }}' of the project APM alert config repo to ${{ steps.download-project-apm-repo.outputs.local-repository-path }} - error: There was a problem downloading the project APM config branch (${{ steps.download-apm-branch.error-message }}) - run-at-server: true - - - name: Get team email address list - id: get-team-email-list - uses: core/concatenate-list-property@v1 - with: - source-list: ${{ project.team.developers }} - property-name: Email - display: - success: Successfully created support email address list - error: There was a problem creating the support email address list (${{ steps.get-team-email-list.error-message }}) - - -# Replace apm_anomaly_detected.json - - name: apm_anomaly_detected Replace - id: replace-anomaly - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-apm-branch.outputs.local-repository-path }}/apm_anomaly_detected.json - replacements: - "": ${{ project.versionControl.project }}, - "": ${{ env.ASPNETCORE_ENVIRONMENT }}, - "": ${{ steps.get-team-email-list.outputs.result }} - display: - success: Strings successfully Replaced in anomaly alert - error: Strings Replace in anomaly alert failed. (${{ steps.replace-anomaly.error-message }}) - run-at-server: true - -# Replace apm_high_error_rate.json - - name: apm_high_error_rate Replace - id: replace-high-error - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-apm-branch.outputs.local-repository-path }}/apm_high_error_rate.json - replacements: - "": ${{ project.versionControl.project }}, - "": ${{ env.ASPNETCORE_ENVIRONMENT }}, - "": ${{ steps.get-team-email-list.outputs.result }} - display: - success: Strings successfully Replaced in high error rate alert - error: Strings Replace high error rate alert failed. (${{ steps.replace-high-error.error-message }}) - run-at-server: true - -# Replace apm_high_p95_response_time.json - - name: apm_high_p95_response_time Replace - id: replace-p95 - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-apm-branch.outputs.local-repository-path }}/apm_high_p95_response_time.json - replacements: - "": ${{ project.versionControl.project }}, - "": ${{ env.ASPNETCORE_ENVIRONMENT }}, - "": ${{ steps.get-team-email-list.outputs.result }} - display: - success: Strings successfully Replaced in p95 alert - error: Strings Replace p95 alert failed. (${{ steps.replace-p95.error-message }}) - run-at-server: true - - - name: Push updated apm branch to project apm repo - id: merge-apm-repo - uses: azdevops/merge-folder@v1 - with: - connection: ${{ steps.connect-server.outputs.connection }} - repository-id: ${{ steps.ensure-nox-apm-repo.outputs.repository-id }} - branch-name: ${{ steps.create-new-apm-branch.outputs.branch-name }} - source-path: ${{ steps.download-apm-branch.outputs.local-repository-path }} - display: - success: Push updated elastic-alert-config to project ${{ project.name }} success - error: Push updated elastic-alert-config to project ${{ project.name }} failed. (${{ steps.merge-apm-repo.error-message }}) - run-at-server: true diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.steps.nox.yaml deleted file mode 100644 index a35474af..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.steps.nox.yaml +++ /dev/null @@ -1,204 +0,0 @@ -steps: - - name: Ensure the Project helm-chart Repository exists - id: ensure-nox-helm-repo - uses: azdevops/ensure-repo-exists@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - repository-name: ${{ project.versionControl.project }}.Helmchart - display: - success: Ensured that the project helm-chart repository exists - error: There was a problem ensuring that the project helm-chart repository exists. ${{ steps.ensure-nox-helm-repo.error-message }} - run-at-server: true - - - name: Find the helm-chart main branch - id: find-helm-main - uses: azdevops/find-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} - branch-name: main - display: - success: Successfully got the main branch for the helm-chart repo - error: There was a problem getting the main branch for the helm-chart repo ${{ steps.find-helm-main.error-message }} - run-at-server: true - - #Helmchart Project - - name: Get the Cli project - id: get-microservices-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: Heimdall.Microservices - display: - success: Got the Heimdall.Microservices project - error: There was a problem getting the Heimdall.Microservices project (${{ steps.get-microservices-project.error-message }}) - run-at-server: true - - - name: Get the helm chart reference repo - id: get-helm-ref-repo - uses: azdevops/get-repo@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-microservices-project.outputs.project-id }} - repository-name: Template.Helmchart - display: - success: Successfully got the the helm chart reference repo - error: There was a problem getting the helm chart reference repo (${{ steps.get-helm-ref-repo.error-message }}) - run-at-server: true - - - name: Download the helm chart repo - id: download-helm-ref-repo - uses: azdevops/download-repo-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.get-helm-ref-repo.outputs.repository-id }} - branch-name: main - display: - success: Successfully downloaded branch 'main' of the Heimdall helm chart to ${{ steps.download-helm-chart-repo.outputs.local-repository-path }} - error: There was a problem downloading the repository (${{ steps.download-helm-ref-repo.error-message }}) - run-at-server: true - - - name: Push Helm-chart to project main branch - id: push-helm-repo-to-main - if: '"${{ steps.find-helm-main.outputs.is-found }}" == "False"' - uses: azdevops/push-folder@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} - source-path: ${{ steps.download-helm-ref-repo.outputs.local-repository-path }} - display: - success: Push helm-chart to project ${{ project.name }} success - error: Push helm-chart to project ${{ project.name }} failed. (${{ steps.push-helm-repo-to-main.error-message }}) - run-at-server: true - - - name: Create new helm-chart branch - id: create-new-helm-branch - uses: azdevops/create-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} - display: - success: Successfully created new helm-chart branch -> ${{ steps.create-new-helm-branch.outputs.branch-name }} - error: Failed to create new helm-chart branch -> ${{ steps.create-new-helm-branch.outputs.branch-name }} - run-at-server: true - - - name: Download the new helm-chart branch - id: download-helm-branch - uses: azdevops/download-repo-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} - branch-name: ${{ steps.create-new-helm-branch.outputs.branch-name }} - display: - success: Successfully downloaded branch '${{ steps.create-new-helm-branch.outputs.branch-name }}' of the repo to ${{ steps.download-helm-branch.outputs.local-repository-path }} - error: There was a problem downloading the project helm-chart branch (${{ steps.download-helm-branch.error-message }}) - run-at-server: true - - # Copy the reference repo branch over the project branch - - name: Copy reference repo to project repo - id: copy-helm-to-project - uses: file/copy-folder@v1 - with: - source-path: ${{ steps.download-helm-ref-repo.outputs.local-repository-path }} - target-path: ${{ steps.download-helm-branch.outputs.local-repository-path }} - display: - success: Copied reference repo to project repo - error: Unable to copy reference repo to project repo (${{ steps.copy-helm-to-project.error-message }}) - run-at-server: true - - # Replace values.yaml - - name: Values.yaml Replace - id: replace-values-yaml - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values.yaml - replacements: - "servicePlaceholderName": ${{ vars.project-dash-name }} - "serviceVaultName": we-test-mp-kv-${{ vars.project-short-name }} - display: - success: Strings Replace in values.yaml success - error: Strings Replace in values.yaml failed. (${{ steps.replace-values-yaml.error-message }}) - run-at-server: true - - # Replace chart.yaml - - name: Chart.yaml Replace - id: replace-chart-yaml - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/Chart.yaml - replacements: - "servicePlaceholderName": ${{ vars.project-dash-name }} - display: - success: Strings Replace in Chart.yaml success - error: Strings Replace in Chart.yaml failed. (${{ steps.replace-chart-yaml.error-message }}) - run-at-server: true - - - # Replace values-local.yaml - - name: Values-local.yaml Replace - id: replace-values-local-yaml - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values-local.yaml - replacements: - "servicePlaceholderName": ${{ vars.project-dash-name }} - display: - success: Strings Replace values-local.yaml success - error: Strings Replace values-local.yaml failed. (${{ steps.replace-values-local-yaml.error-message }}) - run-at-server: true - - # Replace values-production.yaml - - name: Values-production.yaml Replace - id: replace-values-production-yaml - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values-production.yaml - replacements: - "servicePlaceholderName": ${{ vars.project-dash-name }} - "serviceVaultName": we-prod-mp-kv-${{ vars.project-short-name }} - display: - success: Strings Replace values-production.yaml success - error: Strings Replace values-production.yaml failed. (${{ steps.replace-values-production-yaml.error-message }}) - run-at-server: true - - # Replace values-test.yaml - - name: Values-test.yaml Replace - id: replace-values-test-yaml - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values-test.yaml - replacements: - "servicePlaceholderName": ${{ vars.project-dash-name }} - "serviceVaultName": we-test-mp-kv-${{ vars.project-short-name }} - display: - success: Strings Replace values-test.yaml success - error: Strings Replace values-test.yaml failed. (${{ steps.replace-values-test-yaml.error-message }}) - run-at-server: true - - # Replace values-uat.yaml - - name: Values-uat.yaml Replace - id: replace-values-uat-yaml - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-helm-branch.outputs.local-repository-path }}/values-uat.yaml - replacements: - "servicePlaceholderName": ${{ vars.project-dash-name }} - "serviceVaultName": we-uat-mp-kv-${{ vars.project-short-name }} - display: - success: Strings Replace values-uat.yaml success - error: Strings Replace values-uat.yaml failed. (${{ steps.replace-values-uat-yaml.error-message }}) - run-at-server: true - - - name: Push updated helm branch to project helm-chart repo - id: merge-helm-repo - uses: azdevops/merge-folder@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-nox-helm-repo.outputs.repository-id }} - branch-name: ${{ steps.create-new-helm-branch.outputs.branch-name }} - source-path: ${{ steps.download-helm-branch.outputs.local-repository-path }} - display: - success: Push updated helm-chart to project ${{ project.name }} success - error: Push updated helm-chart to project ${{ project.name }} failed. (${{ steps.merge-helm-repo.error-message }}) - run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.workflow.nox.yaml deleted file mode 100644 index 500cdb07..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmChart.workflow.nox.yaml +++ /dev/null @@ -1,93 +0,0 @@ -# NOX Heimdall Helm Chart Sync Command - -name: Synchronise NOX definition with Heimdall Helm Chart - -cli: - branch: sync - command: helm-chart - command-alias: hc - description: "|hc - Creates or updates your Heimdall Helm Chart with NOX definition." - examples: - - ["sync helm-chart", "--path "] - - ["sync hc", "--path "] - -jobs: - main-setup: - steps: - - name: Get Project dash case name - id: get-project-dash-name - uses: core/to-dash-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project dash case name - error: Unable to get the Project dash case name (${{ steps.get-project-dash-name.error-message }}) - - - name: Get the project snake case name - id: get-project-snake-name - uses: core/to-snake-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project snake case name - error: Unable to get the Project snake case name (${{ steps.get-project-snake-name.error-message }}) - - - name: Get Project Short Name - id: get-project-short-name - uses: core/get-string-capitals@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the project short name. - error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) - - - name: Store setup variables - id: add-setup-vars - uses: core/add-variables@v1 - with: - project-name: ${{ project.versionControl.project }} - project-dash-name: ${{ steps.get-project-dash-name.outputs.result }} - project-snake-name: ${{ steps.get-project-snake-name.outputs.result }} - project-short-name: ${{ steps.get-project-short-name.outputs.lower-result }} - display: - success: Variables stored - error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} - - connect: - steps: - - name: Locate the DevOps server - id: locate-devops - uses: network/ping@v1 - with: - host: ${{ project.versionControl.server }} - display: - success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds - error: The DevOps server is not accessible. Are you connected to the Internet? - run-at-server: true - - - name: Connect to the DevOps server - id: connect-devops - uses: azdevops/connect@v1 - with: - server: ${{ project.versionControl.server }} - personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} - display: - success: Connected to the DevOps server - error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) - run-at-server: true - - - name: Get the Nox Team project - id: get-nox-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: ${{ project.versionControl.project }} - display: - success: Got the ${{ project.versionControl.project }} DevOps project - error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) - run-at-server: true - - - sync-heimdall-helm-chart: - $ref: SyncHelmChart.steps.nox.yaml - diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.steps.nox.yaml deleted file mode 100644 index 9b983da0..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.steps.nox.yaml +++ /dev/null @@ -1,236 +0,0 @@ -steps: - - name: Get the Project helm-chart Repository - id: get-helm-repo - uses: azdevops/get-repo@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - repository-name: ${{ project.versionControl.project }}.Helmchart - display: - success: Got the project helm-chart repository - error: Unable to get the project helm-chart repository. ${{ steps.ensure-nox-helm-repo.error-message }} - run-at-server: true - - #Service Endpoints - #APPS_EU_PLATFORM_N service endpoint - - name: Check if the APPS_EU_PLATFORM_N service endpoint exists - id: verify-platform-n-se-helm - uses: azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - service-endpoint-name: APPS_EU_PLATFORM_N - display: - success: Checked if APPS_EU_PLATFORM_N service endpoint exists - error: Unable to check if APPS_EU_PLATFORM_N service endpoint exists (${{ steps.verify-platform-n-se-helm.error-message }}) - run-at-server: true - - - name: Find the APPS_EU_PLATFORM_N service endpoint - if: '"${{ steps.verify-platform-n-se-helm.outputs.is-found }}" == "False"' - id: find-platform-n-se-helm - uses: - azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-devops-project.outputs.project-id }} - service-endpoint-name: APPS_EU_PLATFORM_N - display: - success: Searched for APPS_EU_PLATFORM_N service endpoint in Nox.Cli - error: Unable to search for APPS_EU_PLATFORM_N service endpoint in Nox.Cli (${{ steps.find-platform-n-se-helm.error-message }}) - run-at-server: true - - - name: Share the APPS_EU_PLATFORM_N service endpoint - if: '"${{ steps.verify-platform-n-se-helm.outputs.is-found }}" == "False"' - id: share-platform-n-se-helm - uses: azdevops/share-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - service-endpoint-id: ${{ steps.find-platform-n-se-helm.outputs.service-endpoint-id }} - service-endpoint-name: APPS_EU_PLATFORM_N - project-id: ${{ steps.get-nox-project.outputs.project-id }} - project-name: ${{ project.versionControl.project }} - display: - success: Shared the APPS_EU_PLATFORM_N service connection with ${{ project.name }} - error: Unable to share the APPS_EU_PLATFORM_N service connection with ${{ project.name }} (${{ steps.share-platform-n-se-helm.error-message }}) - run-at-server: true - - #APPS_EU_PLATFORM_P service endpoint - - name: Check if the APPS_EU_PLATFORM_P service endpoint exists - id: verify-platform-p-se-helm - uses: azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - service-endpoint-name: APPS_EU_PLATFORM_P - display: - success: Checked if APPS_EU_PLATFORM_P service endpoint exists - error: Unable to check if APPS_EU_PLATFORM_P service endpoint exists (${{ steps.verify-platform-p-se-helm.error-message }}) - run-at-server: true - - - name: Find the APPS_EU_PLATFORM_P service endpoint - if: '"${{ steps.verify-platform-p-se-helm.outputs.is-found }}" == "False"' - id: find-platform-p-se-helm - uses: - azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-devops-project.outputs.project-id }} - service-endpoint-name: APPS_EU_PLATFORM_P - display: - success: Searched for APPS_EU_PLATFORM_P service endpoint in Nox.Cli - error: Unable to search for APPS_EU_PLATFORM_P service endpoint in Nox.Cli (${{ steps.find-platform-p-se-helm.error-message }}) - run-at-server: true - - - name: Share the APPS_EU_PLATFORM_P service endpoint - if: '"${{ steps.verify-platform-p-se-helm.outputs.is-found }}" == "False"' - id: share-platform-p-se-helm-helm - uses: azdevops/share-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - service-endpoint-id: ${{ steps.find-platform-p-se-helm.outputs.service-endpoint-id }} - service-endpoint-name: APPS_EU_PLATFORM_P - project-id: ${{ steps.get-nox-project.outputs.project-id }} - project-name: ${{ project.versionControl.project }} - display: - success: Shared the APPS_EU_PLATFORM_P service connection with ${{ project.name }} - error: Unable to share the APPS_EU_PLATFORM_P service connection with ${{ project.name }} (${{ steps.share-platform-p-se-helm-helm.error-message }}) - run-at-server: true - - #SonarCloud service endpoint - - name: Check if the SonarCloud service endpoint exists - id: verify-sonarcloud-se-helm - uses: azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - service-endpoint-name: SonarCloud - display: - success: Checked if SonarCloud service endpoint exists - error: Unable to check if SonarCloud service endpoint exists (${{ steps.verify-sonarcloud-se-helm.error-message }}) - run-at-server: true - - - name: Find the SonarCloud service endpoint - if: '"${{ steps.verify-sonarcloud-se-helm.outputs.is-found }}" == "False"' - id: find-sonarcloud-se-helm - uses: - azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-devops-project.outputs.project-id }} - service-endpoint-name: SonarCloud - display: - success: Searched for SonarCloud service endpoint in Nox.Cli - error: Unable to search for SonarCloud service endpoint in Nox.Cli (${{ steps.find-sonarcloud-se-helm.error-message }}) - run-at-server: true - - - name: Share the SonarCloud service endpoint - if: '"${{ steps.verify-sonarcloud-se-helm.outputs.is-found }}" == "False"' - id: share-sonarcloud-se-helm - uses: azdevops/share-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - service-endpoint-id: ${{ steps.find-sonarcloud-se-helm.outputs.service-endpoint-id }} - service-endpoint-name: SonarCloud - project-id: ${{ steps.get-nox-project.outputs.project-id }} - project-name: ${{ project.versionControl.project }} - display: - success: Shared the SonarCloud service connection with ${{ project.name }} - error: Unable to share the SonarCloud service connection with ${{ project.name }} (${{ steps.share-sonarcloud-se-helm.error-message }}) - run-at-server: true - - #weacrheimdallpreprod service endpoint - - name: Check if the weacrheimdallpreprod service endpoint exists - id: verify-weacrheimdallpreprod-se-helm - uses: azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - service-endpoint-name: weacrheimdallpreprod - display: - success: Checked if weacrheimdallpreprod service endpoint exists - error: Unable to check if weacrheimdallpreprod service endpoint exists (${{ steps.verify-weacrheimdallpreprod-se-helm.error-message }}) - run-at-server: true - - - name: Find the weacrheimdallpreprod service endpoint - if: '"${{ steps.verify-weacrheimdallpreprod-se-helm.outputs.is-found }}" == "False"' - id: find-weacrheimdallpreprod-se-helm - uses: - azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-devops-project.outputs.project-id }} - service-endpoint-name: weacrheimdallpreprod - display: - success: Searched for weacrheimdallpreprod service endpoint in Nox.Cli - error: Unable to search for weacrheimdallpreprod service endpoint in Nox.Cli (${{ steps.find-weacrheimdallpreprod-se-helm.error-message }}) - run-at-server: true - - - name: Share the weacrheimdallpreprod service endpoint - if: '"${{ steps.verify-weacrheimdallpreprod-se-helm.outputs.is-found }}" == "False"' - id: share-weacrheimdallpreprod-se-helm - uses: azdevops/share-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - service-endpoint-id: ${{ steps.find-weacrheimdallpreprod-se-helm.outputs.service-endpoint-id }} - service-endpoint-name: weacrheimdallpreprod - project-id: ${{ steps.get-nox-project.outputs.project-id }} - project-name: ${{ project.versionControl.project }} - display: - success: Shared the weacrheimdallpreprod service connection with ${{ project.name }} - error: Unable to share the weacrheimdallpreprod service connection with ${{ project.name }} (${{ steps.share-weacrheimdallpreprod-se-helm.error-message }}) - run-at-server: true - - #Helm-chart pipeline - - name: Find Helm Chart pipeline - id: find-helm-pipeline - uses: azdevops/find-build-definition@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - build-name: ${{ project.versionControl.project }}.HelmChart - display: - success: Searched for the helm chart pipeline - error: Unable to search for the helm chart pipeline (${{ steps.find-helm-pipeline.error-message }}) - run-at-server: true - - - name: Authorize the Helm Chart pipeline - id: auth-helm-pipeline-update - if: '"${{ steps.find-helm-pipeline.outputs.is-found }}" == "True"' - uses: azdevops/authorize-build-definition@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - build-definition-id: ${{ steps.find-helm-pipeline.outputs.build-definition-id }} - display: - success: Authorized the Helm Chart build definition endpoints - error: Unable to authorize the Helm Chart build definition endpoints (${{ steps.auth-helm-pipeline-update.error-message }}) - run-at-server: true - - - name: Create the Helm Chart pipeline if it does not exist - id: create-helm-pipeline - if: '"${{ steps.find-helm-pipeline.outputs.is-found }}" == "False"' - uses: azdevops/create-build-definition@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - repository-id: ${{ steps.get-helm-repo.outputs.repository-id }} - yaml-file-path: azure-pipelines.yml - build-name: ${{ project.versionControl.project }}.HelmChart - agent-pool: Azure Pipelines - display: - success: Created the Helm Chart build pipeline - error: Unable to create the Helm Chart build pipeline (${{ steps.create-helm-pipeline.error-message }}) - run-at-server: true - - - name: Authorize the Helm Chart pipeline - id: auth-helm-pipeline-new - if: '"${{ steps.find-helm-pipeline.outputs.is-found }}" == "False"' - uses: azdevops/authorize-build-definition@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - build-definition-id: ${{ steps.create-helm-pipeline.outputs.build-definition-id }} - display: - success: Authorized the Helm Chart build definition endpoints - error: Unable to authorize the Helm Chart build definition endpoints (${{ steps.auth-helm-pipeline-new.error-message }}) - run-at-server: true diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.workflow.nox.yaml deleted file mode 100644 index 05e0c338..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncHelmPipeline.workflow.nox.yaml +++ /dev/null @@ -1,61 +0,0 @@ -# NOX Helm Chart Pipeline Sync Command - -name: Synchronise the Helm Chart ADO pipeline of your Nox project - -cli: - branch: sync - command: helmchart-pipeline - command-alias: hcpipe - description: "|helmchart-pipeline - Synchronise the Helm Chart ADO pipeline of your Nox project." - examples: - - ["sync helmchart-pipeline", "--path "] - - ["sync hcpipe", "--path "] - -jobs: - connect: - steps: - - name: Locate the DevOps server - id: locate-server - uses: network/ping@v1 - with: - host: ${{ project.versionControl.server }} - display: - success: Found the DevOps server in ${{ steps.locate-server-hc.outputs.roundtrip-time }} milliseconds - error: The DevOps server is not accessible. Are you connected to the Internet? - run-at-server: true - - - name: Connect to the DevOps server - id: connect-devops - uses: azdevops/connect@v1 - with: - server: ${{ project.versionControl.server }} - personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} - display: - success: Connected to the DevOps server - error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops-hc.error-message }}) - run-at-server: true - - - name: Get the current Nox project - id: get-nox-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: ${{ project.versionControl.project }} - display: - success: Got the ${{ project.versionControl.project }} DevOps project - error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) - run-at-server: true - - - name: Get the DevOps project - id: get-devops-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: IWG.DevOps - display: - success: Got the DevOps project - error: Unable to get the DevOps project (${{ steps.get-devops-project.error-message }}) - run-at-server: true - - sync-pipeline: - $ref: SyncHelmPipeline.steps.nox.yaml \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.steps.nox.yaml deleted file mode 100644 index 4324b0fe..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.steps.nox.yaml +++ /dev/null @@ -1,573 +0,0 @@ -steps: - - name: Get the Heimdall.Microservices project - id: get-heimdall-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: Heimdall.Microservices - display: - success: Got the Heimdall.Microservices project - error: There was a problem getting the Heimdall.Microservices project (${{ steps.get-heimdall-project.error-message }}) - run-at-server: true - - - name: Get the Terraform project - id: get-terraform-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: Terraform - display: - success: Got the Terraform project - error: There was a problem getting the Terraform project (${{ steps.get-heimdall-project.error-message }}) - run-at-server: true - - - name: Ensure the Infrastructure Repository exists - id: ensure-infra-repo - uses: azdevops/ensure-repo-exists@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - repository-name: ${{ vars.project-dash-name }}-infrastructure-tf - display: - success: Ensured that the project infrastructure repository exists - error: There was a problem ensuring that the project infrastructure repository exists. ${{ steps.ensure-infra-repo.error-message }} - run-at-server: true - - - name: Find the project infra main branch - id: find-infra-main - uses: azdevops/find-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} - branch-name: main - display: - success: Successfully got the main branch for the infrastructure repo - error: There was a problem getting the main branch for the infrastructure repo ${{ steps.find-infra-main.error-message }} - run-at-server: true - - - name: Get the Heimdall.Microservices Template.Terraform.Microservices repo - id: get-ref-infra-repo - uses: azdevops/get-repo@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-heimdall-project.outputs.project-id }} - repository-name: Template.Terraform.Microservices - display: - success: Successfully got the reference infrastructure repo - error: There was a problem getting the reference infrastructure repository (${{ steps.get-ref-infra-repo.error-message }}) - run-at-server: true - - - name: Download the reference infrastructure repo - id: download-ref-infra-repo - uses: azdevops/download-repo-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.get-ref-infra-repo.outputs.repository-id }} - branch-name: main - display: - success: Successfully downloaded branch 'main' of the reference infrastructure repo to ${{ steps.download-ref-infra-repo.outputs.local-repository-path }} - error: There was a problem downloading the reference infrastructure repository (${{ steps.download-ref-infra-repo.error-message }}) - run-at-server: true - - - name: Push the reference infra repo to Nox project infra main branch - if: '"${{ steps.find-infra-main.outputs.is-found }}" == "False"' - id: push-infra-repo-to-main - uses: azdevops/push-folder@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} - source-path: ${{ steps.download-ref-infra-repo.outputs.local-repository-path }} - display: - success: Push the reference infrastructure repo to Nox project ${{ project.name }} success - error: Unable to push the reference infrastructure repo to Nox project ${{ project.name }} failed. (${{ steps.push-infra-repo-to-main.error-message }}) - run-at-server: true - - - name: Create a new Infrastructure branch - id: create-new-infra-branch - uses: azdevops/create-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} - display: - success: Successfully created new Infrastructure branch -> ${{ steps.create-new-infra-branch.outputs.branch-name }} - error: Failed to create new Infrastructure branch -> ${{ steps.create-new-infra-branch.outputs.branch-name }} - run-at-server: true - - - name: Download the new Infrastructure branch - id: download-infra-branch - uses: azdevops/download-repo-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} - branch-name: ${{ steps.create-new-infra-branch.outputs.branch-name }} - display: - success: Successfully downloaded branch '${{ steps.create-new-infra-branch.outputs.branch-name }}' of the repo to ${{ steps.download-infra-branch.outputs.local-repository-path }} - error: There was a problem downloading the project helm-chart branch (${{ steps.download-infra-branch.error-message }}) - run-at-server: true - - # Copy the reference repo branch over the project infra branch - - name: Copy reference repo to project repo - id: copy-infra-to-project - uses: file/copy-folder@v1 - with: - source-path: ${{ steps.download-ref-infra-repo.outputs.local-repository-path }} - target-path: ${{ steps.download-infra-branch.outputs.local-repository-path }} - display: - success: Copied reference repo to project repo - error: Unable to copy reference repo to project repo (${{ steps.copy-infra-to-project.error-message }}) - run-at-server: true - - - name: Get the project product owner email addresses - id: get-product-owners - uses: project/get-owner-emails@v1 - with: - team-members: ${{ project.team.developers }} - display: - success: Got the project product owner email addresses - error: Unable to the project product owner email addresses (${{ steps.get-product-owners.outputs.error-message }}) - - # Replace variables.tf - - name: variables.tf Replace - id: replace-variables-tf - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-infra-branch.outputs.local-repository-path }}/variables.tf - replacements: - "": ${{ steps.get-product-owners.outputs.owner-emails }} - "": ${{ vars.project-short-name }} - "": ${{ vars.project-dash-name }} - "": ${{ project.description }} - "": NOX_PROJECT_${{ project.name }} - display: - success: Strings Replace in values.yaml success - error: Strings Replace in values.yaml failed. (${{ steps.replace-values-yaml.error-message }}) - run-at-server: true - - - name: Push updated infra branch to project repo - id: merge-infra-branch - uses: azdevops/merge-folder@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-infra-repo.outputs.repository-id }} - branch-name: ${{ steps.create-new-infra-branch.outputs.branch-name }} - source-path: ${{ steps.download-infra-branch.outputs.local-repository-path }} - reference-date-time: ${{ steps.download-infra-branch.outputs.download-date-time }} - display: - success: Push updated infrastructure branch to terraform success - error: Push updated infrastructure branch to terraform failed. (${{ steps.merge-infra-branch.error-message }}) - run-at-server: true - - # tfe section - - name: Get the Terraform tfe-manage-workspaces repo - id: get-terraform-tfe-manage-workspaces-repo - uses: azdevops/get-repo@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-terraform-project.outputs.project-id }} - repository-name: tfe-manage-workspaces - display: - success: Successfully got the Terraform tfe-manage-workspaces repo - error: There was a problem getting the Terraform tfe-manage-workspacesrepository (${{ steps.get-terraform-tfe-manage-workspaces-repo.error-message }}) - run-at-server: true - - - name: Create a new tfe-manage-workspaces branch - id: create-new-tfe-manage-workspaces-branch - uses: azdevops/create-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.get-terraform-tfe-manage-workspaces-repo.outputs.repository-id }} - display: - success: Successfully created new tfe-manage-workspaces branch -> ${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }} - error: Failed to create new tfe-manage-workspaces branch -> ${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }} - run-at-server: true - - - name: Download the new tfe-manage-workspaces branch - id: download-tfe-manage-workspaces-branch - uses: azdevops/download-repo-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.get-terraform-tfe-manage-workspaces-repo.outputs.repository-id }} - branch-name: ${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }} - display: - success: Successfully downloaded branch '${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }}' of the repo to ${{ steps.download-tfe-manage-workspaces-branch.outputs.local-repository-path }} - error: There was a problem downloading the tfe-manage-workspaces branch (${{ steps.download-tfe-manage-workspaces-branch.error-message }}) - run-at-server: true - - - name: Store tfe variables - id: add-tfe-vars - uses: core/add-variables@v1 - with: - branch-folder: ${{ steps.download-tfe-manage-workspaces-branch.outputs.local-repository-path }} - display: - success: Save the tfe Variables - error: Unable to store tfe variables (${{ steps.add-tfe-vars.error-message }}) - - - name: Ensure microservice sub folder exists - id: ensure-tf-sub-folder - uses: file/ensure-folder@v1 - with: - path: ${{ vars.branch-folder }} - folder-name: ${{ vars.tf-folder }} - display: - success: Ensured that microservice sub folder exists - error: Unable to ensure that the microservice sub folder exists ${{ steps.ensure-tf-sub-folder.error-message }} - run-at-server: true - - #outputs.tf - - name: Delete outputs.tf terraform file if it exists - id: delete-outputs-tf-file - uses: file/delete-file@v1 - with: - path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/outputs.tf - display: - success: Ensured that outputs.tf terraform file does not exist - error: unable to delete outputs.tf terraform file (${{ steps.delete-outputs-tf-file.error-message }}) - run-at-server: true - - - name: Load outputs.tf terraform file template - id: load-outputs-tf-template - uses: core/load-template@v1 - with: - path: terraform/outputs.tf - display: - success: Loaded outputs.tf terraform template - error: Unable to load outputs.tf template (${{ steps.load-outputs-tf-template.error-message }}) - run-at-server: true - - - name: Interpolate outputs.tf template variables - id: interpolate-outputs-tf-file-template - uses: core/replace-strings@v1 - with: - source-string: ${{ steps.load-outputs-tf-template.outputs.result }} - replacements: - "": output "test_we" { value = module.test_we.workspaces["${local.app_name}_test_we"].id } - "": output "test_ne" { value = module.test_ne.workspaces["${local.app_name}_test_ne"].id } - "": "" - "": "" - "": "" - "": "" - display: - success: Interpolated outputs.tf template variables - error: Unable to interpolated outputs.tf template variables ${{ steps.interpolate-outputs-tf-file-template.error-message }} - run-at-server: true - - - name: Save outputs.tf terraform file - id: save-outputs-tf-file - uses: file/write-text@v1 - with: - path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/outputs.tf - text-to-write: ${{ steps.interpolate-outputs-tf-file-template.outputs.result }} - display: - success: Saved outputs.tf - error: Unable to save outputs.tf ${{ steps.save-outputs-tf-file.error-message }} - run-at-server: true - - #Add test-vars.tf - - name: Delete test-vars.tf terraform file if it exists - id: delete-test-tf-file - uses: file/delete-file@v1 - with: - path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/test-vars.tf - display: - success: Ensured that test-vars.tf terraform file does not exist - error: Unable to delete test-vars.tf terraform file (${{ steps.delete-test-tf-file.error-message }}) - run-at-server: true - - - name: Load test-vars.tf terraform file template - id: load-vars-tf-template - uses: core/load-template@v1 - with: - path: terraform/env-vars.tf - display: - success: Loaded env-vars.tf terraform template - error: Unable to load env-vars.tf terraform template (${{ steps.load-vars-tf-template.error-message }}) - run-at-server: true - - - name: replace env-vars.tf template variables - id: interpolate-test-tf-file-template - uses: core/replace-strings@v1 - with: - source-string: ${{ steps.load-vars-tf-template.outputs.result }} - replacements: - "": test - "": ${{ vars.project-dash-name }}-test - display: - success: Interpolated test-vars.tf template variables - error: Unable to interpolated test-vars.tf template variables ${{ steps.interpolate-test-tf-file-template.error-message }} - run-at-server: true - - - name: Save test-vars.tf terraform file - id: save-test-tf-file - uses: file/write-text@v1 - with: - path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/test-vars.tf - text-to-write: ${{ steps.interpolate-test-tf-file-template.outputs.result }} - display: - success: Saved test-vars.tf terraform file - error: Unable to save test-vars.tf (${{ steps.save-test-tf-file.error-message }}) - run-at-server: true - - #Add tfc-workspace.tf - - name: Delete tfc-workspace.tf terraform file if it exists - id: delete-tfc-workspace-tf-file - uses: file/delete-file@v1 - with: - path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/tfc-workspace.tf - display: - success: Ensured that tfc-workspace.tf terraform file does not exist - error: Unable to delete tfc-workspace.tf terraform file (${{ steps.delete-tfc-workspace-tf-file.error-message }}) - run-at-server: true - - - name: Load tfc-workspace.tf terraform file template - id: load-tfc-workspace-template - uses: core/load-template@v1 - with: - path: terraform/tfc-workspace.tf - display: - success: Loaded tfc-workspace.tf terraform template - error: Unable to load tfc-workspace.tf terraform template (${{ steps.load-tfc-workspace-template.error-message }}) - run-at-server: true - - - name: replace tfc-workspace.tf template variables - id: interpolate-tfc-workspace-template - uses: core/replace-strings@v1 - with: - source-string: ${{ steps.load-tfc-workspace-template.outputs.result }} - replacements: - "": ${{ vars.project-name }} - "": ${{ vars.project-snake-name }} - "": ${{ vars.project-dash-name }} - display: - success: Interpolated tfc-workspace.tf template variables - error: Unable to interpolated tfc-workspace.tf template variables ${{ steps.interpolate-tfc-workspace-template.error-message }} - run-at-server: true - - - name: Save tfc-workspace.tf terraform file - id: save-tfc-workspace-file - uses: file/write-text@v1 - with: - path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/tfc-workspace.tf - text-to-write: ${{ steps.interpolate-tfc-workspace-template.outputs.result }} - display: - success: Saved tfc-workspace.tf terraform file - error: Unable to save tfc-workspace.tf (${{ steps.save-tfc-workspace-file.error-message }}) - run-at-server: true - - #Add variables.tf - - name: Delete variables.tf terraform file if it exists - id: delete-infra-variables-tf-file - uses: file/delete-file@v1 - with: - path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/variables.tf - display: - success: Ensured that variables.tf terraform file does not exist - error: Unable to delete variables.tf terraform file (${{ steps.delete-infra-variables-tf-file.error-message }}) - run-at-server: true - - - name: Load variables.tf terraform file template - id: load-variables-template - uses: core/load-template@v1 - with: - path: terraform/variables.tf - display: - success: Loaded variables.tf terraform template - error: Unable to load variables.tf terraform template (${{ steps.load-variables-template.error-message }}) - run-at-server: true - - - name: Save variables.tf terraform file - id: save-variables-file - uses: file/write-text@v1 - with: - path: ${{ vars.branch-folder }}/${{ vars.tf-folder }}/variables.tf - text-to-write: ${{ steps.load-variables-template.outputs.result }} - display: - success: Saved variables.tf terraform file - error: Unable to save variables.tf (${{ steps.save-variables-file.error-message }}) - run-at-server: true - - #Add heimdall-ms-microservice.tf - - name: Delete heimdall-ms-.tf terraform file if it exists - id: delete-microservice-tf-file - uses: file/delete-file@v1 - with: - path: ${{ vars.branch-folder }}/heimdall-ms-${{ vars.project-dash-name }}.tf - display: - success: Ensured that heimdall-ms-.tf terraform file does not exist - error: Unable to delete heimdall-ms-.tf terraform file (${{ steps.delete-microservice-tf-file.error-message }}) - run-at-server: true - - - name: Load heimdall-ms-microservice.tf terraform file template - id: load-microservice-template - uses: core/load-template@v1 - with: - path: terraform/heimdall-ms-microservice.tf - display: - success: Loaded heimdall-ms-microservice.tf terraform template - error: Unable to load heimdall-ms-microservice.tf terraform template (${{ steps.load-microservice-template.error-message }}) - run-at-server: true - - - name: replace heimdall-ms-microservice.tf template variables - id: interpolate-microservice-template - uses: core/replace-strings@v1 - with: - source-string: ${{ steps.load-microservice-template.outputs.result }} - replacements: - "": ${{ vars.project-dash-name }} - "": ${{ vars.project-snake-name }} - display: - success: Interpolated heimdall-ms-microservice.tf template variables - error: Unable to interpolated heimdall-ms-microservice.tf template variables ${{ steps.interpolate-microservice-template.error-message }} - run-at-server: true - - - name: Save microservice-template terraform file - id: save-microservice-file - uses: file/write-text@v1 - with: - path: ${{ vars.branch-folder }}/heimdall-ms-${{ vars.project-dash-name }}.tf - text-to-write: ${{ steps.interpolate-microservice-template.outputs.result }} - display: - success: Saved variables.tf terraform file - error: Unable to save variables.tf (${{ steps.save-microservice-file.error-message }}) - run-at-server: true - - #Add workspaces ids to tfe_variable_set.tf - - name: Read the tfe_variable_set.tf file - id: load-tfe-variable-set-file - uses: file/read-text@v1 - with: - path: ${{ vars.branch-folder }}/tfe_variable_set.tf - display: - success: Loaded the tfe_variable_set.tf file - error: Unable to load the tfe_variable_set.tf file ${{ steps.load-tfe-variable-set-file.error-message }} - run-at-server: true - - #tenant workspace ids - - name: Add the tenant workspace ids if they do not exist - id: add-workspace-ids - uses: hcl/add-values@v1 - with: - source-hcl: ${{ steps.load-tfe-variable-set-file.outputs.result-string }} - path: variable_set_params/azure_tenant/workspace_ids - values-to-add: - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne - display: - success: Added the workspace ids - error: Unable to add the workspace ids (${{ steps.add-workspace-ids.error-message }}) - run-at-server: true - - #platform-n workspace ids - - name: Add the platform-n workspace ids if they do not exist - id: add-platform-n-workspace-ids - uses: hcl/add-values@v1 - with: - source-hcl: ${{ steps.add-workspace-ids.outputs.result-hcl }} - path: variable_set_params/azure_sub_platform_n/workspace_ids - values-to-add: - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne - display: - success: Added the platform-n workspace ids - error: Unable to add the platform-n workspace ids (${{ steps.add-platform-n-workspace-ids.error-message }}) - run-at-server: true - - #devops_sp workspace ids - - name: Add the devops_sp workspace ids if they do not exist - id: add-devops-sp-workspace-ids - uses: hcl/add-values@v1 - with: - source-hcl: ${{ steps.add-platform-n-workspace-ids.outputs.result-hcl }} - path: variable_set_params/devops_sp/workspace_ids - values-to-add: - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne - display: - success: Added the devops_sp workspace ids - error: Unable to add the devops_sp workspace ids (${{ steps.add-devops-sp-workspace-ids.error-message }}) - run-at-server: true - - #devops_nonprod workspace ids - - name: Add the devops_nonprod workspace ids if they do not exist - id: add-devops-nonprod-workspace-ids - uses: hcl/add-values@v1 - with: - source-hcl: ${{ steps.add-devops-sp-workspace-ids.outputs.result-hcl }} - path: variable_set_params/devops_nonprod/workspace_ids - values-to-add: - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne - display: - success: Added the devops_nonprod workspace ids - error: Unable to add the devops_nonprod workspace ids (${{ steps.add-devops-nonprod-workspace-ids.error-message }}) - run-at-server: true - - #dev_team workspace ids - - name: Add the dev_team workspace ids if they do not exist - id: add-dev-team-workspace-ids - uses: hcl/add-values@v1 - with: - source-hcl: ${{ steps.add-devops-nonprod-workspace-ids.outputs.result-hcl }} - path: variable_set_params/dev_team/workspace_ids - values-to-add: - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne - display: - success: Added the dev_team workspace ids - error: Unable to add the dev_team workspace ids (${{ steps.add-add-dev-team-workspace-ids-workspace-ids.error-message }}) - run-at-server: true - - #azure_creds workspace ids - - name: Add the azure_creds workspace ids if they do not exist - id: add-azure-creds-workspace-ids - uses: hcl/add-values@v1 - with: - source-hcl: ${{ steps.add-dev-team-workspace-ids.outputs.result-hcl }} - path: variable_set_params/azure_creds/workspace_ids - values-to-add: - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne - display: - success: Added the azure_creds workspace ids - error: Unable to add the azure_creds workspace ids (${{ steps.add-azure-creds-workspace-ids-workspace-ids.error-message }}) - run-at-server: true - - #devops_nonprod_creds workspace ids - - name: Add the devops_nonprod_creds workspace ids if they do not exist - id: add-devops-nonprod-creds-workspace-ids - uses: hcl/add-values@v1 - with: - source-hcl: ${{ steps.add-azure-creds-workspace-ids.outputs.result-hcl }} - path: variable_set_params/devops_nonprod_creds/workspace_ids - values-to-add: - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_we - - module.heimdall_${{ vars.project-snake-name }}_workspaces.test_ne - display: - success: Added the devops_nonprod_creds workspace ids - error: Unable to add the devops_nonprod_creds workspace ids (${{ steps.add-devops-nonprod-creds-workspace-ids.error-message }}) - run-at-server: true - - - name: Save the tfe_variable_set.tf file - id: save-tfe-variable-set-file - uses: file/write-text@v1 - with: - path: ${{ vars.branch-folder }}/tfe_variable_set.tf - text-to-write: ${{ steps.add-devops-nonprod-creds-workspace-ids.outputs.result-hcl }} - display: - success: Saved the tfe_variable_set.tf file - error: unable to save the tfe_variable_set.tf file ${{ steps.save-tfe-variable-set-file.error-message }} - run-at-server: true - - - name: Push updated branch to tfe-manage-workspaces-repo - id: merge-tfe-repo - uses: azdevops/merge-folder@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.get-terraform-tfe-manage-workspaces-repo.outputs.repository-id }} - branch-name: ${{ steps.create-new-tfe-manage-workspaces-branch.outputs.branch-name }} - source-path: ${{ steps.download-tfe-manage-workspaces-branch.outputs.local-repository-path }} - reference-date-time: ${{ steps.download-tfe-manage-workspaces-branch.outputs.download-date-time }} - auto-complete: false - display: - success: Pushed updated tfe config to Terraform Project. - error: Unable to push updated tfe branch to Terraform project. (${{ steps.merge-tfe-repo.error-message }}) - run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.workflow.nox.yaml deleted file mode 100644 index 88c504eb..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncInfrastructure.workflow.nox.yaml +++ /dev/null @@ -1,92 +0,0 @@ -# NOX Version Control Sync Command - -name: Synchronise NOX project definition with Terraform Infrastructure - -cli: - branch: sync - command: infrastructure - command-alias: iac - description: "|iac - Sets up or synchronizes the infrastructure repos on Azure Devops for your NOX project." - examples: - - ["sync infrastructure", "--path "] - - ["sync iac", "--path "] - -jobs: - main-setup: - steps: - - name: Get Project dash case name - id: get-project-dash-case-name - uses: core/to-dash-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project dash case name - error: Unable to get the Project dash case name (${{ steps.get-project-dash-case-name.error-message }}) - - - name: Get the project snake case name - id: get-project-snake-case-name - uses: core/to-snake-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project snake case name - error: Unable to get the Project snake case name (${{ steps.get-project-snake-case-name.error-message }}) - - - name: Get Project Short Name - id: get-project-short-name - uses: core/get-string-capitals@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the project short name. - error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) - - - name: Store setup variables - id: add-setup-vars - uses: core/add-variables@v1 - with: - project-name: ${{ project.versionControl.project }} - project-dash-name: ${{ steps.get-project-dash-case-name.outputs.result }} - project-snake-name: ${{ steps.get-project-snake-case-name.outputs.result }} - project-short-name: ${{ steps.get-project-short-name.outputs.lower-result }} - tf-folder: heimdall-ms-${{ steps.get-project-dash-case-name.outputs.result }} - display: - success: Variables stored - error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} - - connect: - steps: - - name: Locate the DevOps server - id: locate-devops - uses: network/ping@v1 - with: - host: ${{ project.versionControl.server }} - display: - success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds - error: The DevOps server is not accessible. Are you connected to the Internet? - run-at-server: true - - - name: Connect to the DevOps server - id: connect-devops - uses: azdevops/connect@v1 - with: - server: ${{ project.versionControl.server }} - personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} - display: - success: Connected to the DevOps server - error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) - run-at-server: true - - - name: Get the Nox project - id: get-nox-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: ${{ project.versionControl.project }} - display: - success: Got the ${{ project.versionControl.project }} DevOps project - error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) - run-at-server: true - - sync-infrastructure: - $ref: SyncInfrastructure.steps.nox.yaml \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.steps.nox.yaml deleted file mode 100644 index ed56aabe..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.steps.nox.yaml +++ /dev/null @@ -1,48 +0,0 @@ -- name: Connect to the Arm Client - id: connect-arm - uses: arm/connect@v1 - with: - subscription-id: 03d6460a-7ea8-4d54-a64a-69db6e5823d8 - display: - success: Connected to the Azure Subscription - error: There was a problem connecting to the Azure Subscription. (${{ steps.connect-arm.error-message }}) - run-at-server: true - -- name: Find the Helm Chart key vault - id: find-hc-kv - uses: arm/find-key-vault@v1 - with: - subscription: ${{ steps.connect-arm.outputs.subscription }} - resource-group-name: RG_WE_APPS_HEIMDALL_PREPROD - key-vault-name: we-test-mp-kv-${{ steps.get-project-short-name.outputs.lower-result }} - display: - success: Found the Helm Chart Key Vault - error: There was a problem finding the Helm Chart Key Vault (${{ steps.find-hc-kv.error-message }}) - run-at-server: true - -- name: Create the Helm Chart key vault - id: create-hc-kv - if: '"${{ steps.find-hc-kv.outputs.is-found }}" == "False"' - uses: arm/create-key-vault@v1 - with: - subscription: ${{ steps.connect-arm.outputs.subscription }} - resource-group-name: RG_WE_APPS_HEIMDALL_PREPROD - key-vault-name: we-test-mp-kv-${{ steps.get-project-short-name.outputs.lower-result }} - display: - success: Created the Helm Chart key vault - error: Unable to create the Helm Chart key vault (${{ steps.create-hc-kv.error-message }}) - run-at-server: true - -- name: Save the db-connection-string secret - id: save-db-connection-string - uses: arm/save-secret@v1 - with: - key-vault-name: we-test-mp-kv-${{ steps.get-project-short-name.outputs.lower-result }} - secret-name: db-connection-string - secret-value: not-set - display: - success: Saved the Db connection string secret - error: Unable to save the Db connection string secret (${{ steps.save-db-connection-string.error-message }}) - - - \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.workflow.nox.yaml deleted file mode 100644 index d31c1a0a..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncKeyVault.workflow.nox.yaml +++ /dev/null @@ -1,27 +0,0 @@ -# NOX Helm Chart Key Vault Sync Command - -name: Synchronise NOX definition with the Helm Chart key vault - -cli: - branch: sync - command: helm-key-vault - command-alias: hkv - description: "|hkv - Creates or updates your Heimdall Helm Chart with NOX definition." - examples: - - ["sync helm-key-vault", "--path "] - - ["sync hkv", "--path "] - -jobs: - sync-helm-chart-key-vault: - steps: - - name: Get Project Short Name - id: get-project-short-name - uses: core/get-string-capitals@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the project short name. - error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) - - $ref: SyncKeyVault.steps.nox.yaml - diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncLocalRepo.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncLocalRepo.workflow.nox.yaml deleted file mode 100644 index 18b56581..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncLocalRepo.workflow.nox.yaml +++ /dev/null @@ -1,18 +0,0 @@ -# NOX Init Solution Command - -name: Sync local project repository with remote Azure DevOps -description: This workflow will sync your local git repository with the project's remote Azure DevOps repository - -cli: - branch: sync - command: local-repo - command-alias: repo - description: "|np - Sync local repository with remote." - examples: - - ["sync local-repo", "--path "] - - ["sync repo", "--path "] - -jobs: - sync-repos: - $ref: InitSln_SyncRepos.steps.nox.yaml - diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.steps.nox.yaml deleted file mode 100644 index dda30938..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.steps.nox.yaml +++ /dev/null @@ -1,249 +0,0 @@ -steps: - - name: Get the current Nox project repository - id: get-nox-repo - uses: azdevops/get-repo@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - repository-name: ${{ project.versionControl.repository }} - display: - success: Got the current Nox project repository - error: Unable to get the current Nox project repository (${{ steps.get-nox-repo.error-message }}) - run-at-server: true - - #Service Endpoints - #APPS_EU_PLATFORM_N service endpoint - - name: Check if the APPS_EU_PLATFORM_N service endpoint exists - id: verify-platform-n-se-proj - uses: azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - service-endpoint-name: APPS_EU_PLATFORM_N - display: - success: Checked if APPS_EU_PLATFORM_N service endpoint exists - error: Unable to check if APPS_EU_PLATFORM_N service endpoint exists (${{ steps.verify-platform-n-se-proj.error-message }}) - run-at-server: true - - - name: Find the APPS_EU_PLATFORM_N service endpoint - if: '"${{ steps.verify-platform-n-se-proj.outputs.is-found }}" == "False"' - id: find-platform-n-se-proj - uses: - azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-devops-project.outputs.project-id }} - service-endpoint-name: APPS_EU_PLATFORM_N - display: - success: Searched for APPS_EU_PLATFORM_N service endpoint in Nox.Cli - error: Unable to search for APPS_EU_PLATFORM_N service endpoint in Nox.Cli (${{ steps.find-platform-n-se-proj.error-message }}) - run-at-server: true - - - name: Share the APPS_EU_PLATFORM_N service endpoint - if: '"${{ steps.verify-platform-n-se-proj.outputs.is-found }}" == "False"' - id: share-platform-n-se-proj-proj - uses: azdevops/share-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - service-endpoint-id: ${{ steps.find-platform-n-se-proj.outputs.service-endpoint-id }} - service-endpoint-name: APPS_EU_PLATFORM_N - project-id: ${{ steps.get-nox-project.outputs.project-id }} - project-name: ${{ project.versionControl.project }} - display: - success: Shared the APPS_EU_PLATFORM_N service connection with ${{ project.name }} - error: Unable to share the APPS_EU_PLATFORM_N service connection with ${{ project.name }} (${{ steps.share-platform-n-se-proj-proj.error-message }}) - run-at-server: true - - #APPS_EU_PLATFORM_P service endpoint - - name: Check if the APPS_EU_PLATFORM_P service endpoint exists - id: verify-platform-p-se-proj - uses: azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - service-endpoint-name: APPS_EU_PLATFORM_P - display: - success: Checked if APPS_EU_PLATFORM_P service endpoint exists - error: Unable to check if APPS_EU_PLATFORM_P service endpoint exists (${{ steps.verify-platform-p-se-proj.error-message }}) - run-at-server: true - - - name: Find the APPS_EU_PLATFORM_P service endpoint - if: '"${{ steps.verify-platform-p-se-proj.outputs.is-found }}" == "False"' - id: find-platform-p-se-proj - uses: - azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-devops-project.outputs.project-id }} - service-endpoint-name: APPS_EU_PLATFORM_P - display: - success: Searched for APPS_EU_PLATFORM_P service endpoint in Nox.Cli - error: Unable to search for APPS_EU_PLATFORM_P service endpoint in Nox.Cli (${{ steps.find-platform-p-se-proj.error-message }}) - run-at-server: true - - - name: Share the APPS_EU_PLATFORM_P service endpoint - if: '"${{ steps.verify-platform-p-se-proj.outputs.is-found }}" == "False"' - id: share-platform-p-se-proj-proj - uses: azdevops/share-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - service-endpoint-id: ${{ steps.find-platform-p-se-proj.outputs.service-endpoint-id }} - service-endpoint-name: APPS_EU_PLATFORM_P - project-id: ${{ steps.get-nox-project.outputs.project-id }} - project-name: ${{ project.versionControl.project }} - display: - success: Shared the APPS_EU_PLATFORM_P service connection with ${{ project.name }} - error: Unable to share the APPS_EU_PLATFORM_P service connection with ${{ project.name }} (${{ steps.share-platform-p-se-proj-proj.error-message }}) - run-at-server: true - - #SonarCloud service endpoint - - name: Check if the SonarCloud service endpoint exists - id: verify-sonarcloud-se-proj - uses: azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - service-endpoint-name: SonarCloud - display: - success: Checked if SonarCloud service endpoint exists - error: Unable to check if SonarCloud service endpoint exists (${{ steps.verify-sonarcloud-se-proj.error-message }}) - run-at-server: true - - - name: Find the SonarCloud service endpoint - if: '"${{ steps.verify-sonarcloud-se-proj.outputs.is-found }}" == "False"' - id: find-sonarcloud-se-proj - uses: - azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-devops-project.outputs.project-id }} - service-endpoint-name: SonarCloud - display: - success: Searched for SonarCloud service endpoint in Nox.Cli - error: Unable to search for SonarCloud service endpoint in Nox.Cli (${{ steps.find-sonarcloud-se-proj.error-message }}) - run-at-server: true - - - name: Share the SonarCloud service endpoint - if: '"${{ steps.verify-sonarcloud-se-proj.outputs.is-found }}" == "False"' - id: share-sonarcloud-se-proj - uses: azdevops/share-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - service-endpoint-id: ${{ steps.find-sonarcloud-se-proj.outputs.service-endpoint-id }} - service-endpoint-name: SonarCloud - project-id: ${{ steps.get-nox-project.outputs.project-id }} - project-name: ${{ project.versionControl.project }} - display: - success: Shared the SonarCloud service connection with ${{ project.name }} - error: Unable to share the SonarCloud service connection with ${{ project.name }} (${{ steps.share-sonarcloud-se-proj.error-message }}) - run-at-server: true - - #weacrheimdallpreprod service endpoint - - name: Check if the weacrheimdallpreprod service endpoint exists - id: verify-weacrheimdallpreprod-se-proj - uses: azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - service-endpoint-name: weacrheimdallpreprod - display: - success: Checked if weacrheimdallpreprod service endpoint exists - error: Unable to check if weacrheimdallpreprod service endpoint exists (${{ steps.verify-weacrheimdallpreprod-se-proj.error-message }}) - run-at-server: true - - - name: Find the weacrheimdallpreprod service endpoint - if: '"${{ steps.verify-weacrheimdallpreprod-se-proj.outputs.is-found }}" == "False"' - id: find-weacrheimdallpreprod-se-proj - uses: - azdevops/find-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-devops-project.outputs.project-id }} - service-endpoint-name: weacrheimdallpreprod - display: - success: Searched for weacrheimdallpreprod service endpoint in Nox.Cli - error: Unable to search for weacrheimdallpreprod service endpoint in Nox.Cli (${{ steps.find-weacrheimdallpreprod-se-proj.error-message }}) - run-at-server: true - - - name: Share the weacrheimdallpreprod service endpoint - if: '"${{ steps.verify-weacrheimdallpreprod-se-proj.outputs.is-found }}" == "False"' - id: share-weacrheimdallpreprod-se-proj - uses: azdevops/share-service-endpoint@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - service-endpoint-id: ${{ steps.find-weacrheimdallpreprod-se-proj.outputs.service-endpoint-id }} - service-endpoint-name: weacrheimdallpreprod - project-id: ${{ steps.get-nox-project.outputs.project-id }} - project-name: ${{ project.versionControl.project }} - display: - success: Shared the weacrheimdallpreprod service connection with ${{ project.name }} - error: Unable to share the weacrheimdallpreprod service connection with ${{ project.name }} (${{ steps.share-weacrheimdallpreprod-se-proj.error-message }}) - run-at-server: true - - #Agent pools - - name: Add we-aks-agent-pool - id: add-aks-agent-pool - uses: azdevops/add-project-agent-pool@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - agent-pool-name: we-aks-preprod-agent - display: - success: Successfully added the we-aks-preprod-agent pool - error: Unable to add the we-aks-preprod-agent pool ${{ steps.add-agent-pool.error-message }} - run-at-server: true - - #Project Pipeline - - name: Find Project pipeline - id: find-project-pipeline - uses: azdevops/find-build-definition@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - build-name: ${{ project.versionControl.project }} - display: - success: Searched for the Project pipeline - error: Unable to search for the Project pipeline (${{ steps.find-project-pipeline.error-message }}) - run-at-server: true - - - name: Authorize the project pipeline endpoints - id: auth-project-pipeline-update - if: '"${{ steps.find-project-pipeline.outputs.is-found }}" == "True"' - uses: azdevops/authorize-build-definition@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - build-definition-id: ${{ steps.find-project-pipeline.outputs.build-definition-id }} - display: - success: Authorized the project pipeline endpoints - error: Unable to authorize the project pipeline endpoints (${{ steps.auth-project-pipeline-update.error-message }}) - run-at-server: true - - - name: Create the Project pipeline if it does not exist - id: create-project-pipeline - if: '"${{ steps.find-project-pipeline.outputs.is-found }}" == "False"' - uses: azdevops/create-build-definition@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - repository-id: ${{ steps.get-nox-repo.outputs.repository-id }} - yaml-file-path: azure-pipelines.yml - build-name: ${{ project.versionControl.project }} - agent-pool: Azure Pipelines - display: - success: Created the Project build pipeline - error: Unable to create the Project build pipeline (${{ steps.create-project-pipeline.error-message }}) - run-at-server: true - - - name: Authorize the project pipeline endpoints - id: auth-project-pipeline-new - if: '"${{ steps.find-project-pipeline.outputs.is-found }}" == "False"' - uses: azdevops/authorize-build-definition@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.get-nox-project.outputs.project-id }} - build-definition-id: ${{ steps.create-project-pipeline.outputs.build-definition-id }} - display: - success: Authorized the project pipeline endpoints - error: Unable to authorize the project pipeline endpoints (${{ steps.auth-project-pipeline-new.error-message }}) - run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.workflow.nox.yaml deleted file mode 100644 index f34dc40e..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncProjectPipeline.workflow.nox.yaml +++ /dev/null @@ -1,61 +0,0 @@ -# NOX Project Pipeline Sync Command - -name: Synchronise the Project ADO pipeline of your Nox project - -cli: - branch: sync - command: project-pipeline - command-alias: projpipe - description: "|project-pipeline - Synchronise the Project ADO pipeline of your Nox project." - examples: - - ["sync project-pipeline", "--path "] - - ["sync projpipe", "--path "] - -jobs: - connect: - steps: - - name: Locate the DevOps server - id: locate-server - uses: network/ping@v1 - with: - host: ${{ project.versionControl.server }} - display: - success: Found the DevOps server in ${{ steps.locate-server-hc.outputs.roundtrip-time }} milliseconds - error: The DevOps server is not accessible. Are you connected to the Internet? - run-at-server: true - - - name: Connect to the DevOps server - id: connect-devops - uses: azdevops/connect@v1 - with: - server: ${{ project.versionControl.server }} - personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} - display: - success: Connected to the DevOps server - error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops-hc.error-message }}) - run-at-server: true - - - name: Get the current Nox project - id: get-nox-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: ${{ project.versionControl.project }} - display: - success: Got the ${{ project.versionControl.project }} DevOps project - error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) - run-at-server: true - - - name: Get the DevOps project - id: get-devops-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: IWG.DevOps - display: - success: Got the DevOps project - error: Unable to get the DevOps project (${{ steps.get-devops-project.error-message }}) - run-at-server: true - - sync-project-pipeline: - $ref: SyncProjectPipeline.steps.nox.yaml \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncSolution.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncSolution.workflow.nox.yaml deleted file mode 100644 index 47d0050e..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncSolution.workflow.nox.yaml +++ /dev/null @@ -1,156 +0,0 @@ -# NOX Sync Solution Command - -name: Initialize a Nox project -description: This workflow will sync your Nox solution with Azure AD, Terraform and DevOps - -cli: - branch: sync - command: solution - command-alias: sln - description: "|np - Synchronizes a Nox solution." - examples: - - ["sync solution", "--path "] - - ["sync sln", "--path "] - -jobs: - main-setup: - steps: - - name: Get Project dash case name - id: get-project-dash-name - uses: core/to-dash-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project dash case name - error: Unable to get the Project dash case name (${{ steps.get-project-dash-name.error-message }}) - - - name: Get the project snake case name - id: get-project-snake-name - uses: core/to-snake-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project snake case name - error: Unable to get the Project snake case name (${{ steps.get-project-snake-name.error-message }}) - - - name: Get Project Short Name - id: get-project-short-name - uses: core/get-string-capitals@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the project short name. - error: Unable to get the project short name (${{ steps.get-project-short-name.error-message }}) - - - name: Get the Team Member user name list - id: get-team-uname-list - uses: project/get-team-user-names@v1 - with: - team-members: ${{ project.team.developers }} - display: - success: Got the team user name list - error: Unable to get the team user name list (${{ steps.get-team-uname-list.error-message }}) - - - name: Get the Team Admins user name list - id: get-project-admin-uname-list - uses: project/get-admin-user-names@v1 - with: - team-members: ${{ project.team.developers }} - display: - success: Got the project admins user name list - error: Unable to get the project admins user name list (${{ steps.get-project-admin-list.error-message }}) - - - name: Store setup variables - id: add-setup-vars - uses: core/add-variables@v1 - with: - project-name: ${{ project.versionControl.project }} - project-dash-name: ${{ steps.get-project-dash-name.outputs.result }} - project-snake-name: ${{ steps.get-project-snake-name.outputs.result }} - project-short-name: ${{ steps.get-project-short-name.outputs.lower-result }} - team-user-names: ${{ steps.get-team-uname-list.outputs.user-names }} - admin-user-names: ${{ steps.get-project-admin-uname-list.outputs.user-names }} - tf-folder: heimdall-ms-${{ steps.get-project-dash-name.outputs.result }} - display: - success: Variables stored - error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} - - connect: - steps: - - name: Connect to Azure Active Directory - id: connect-aad - uses: azuread/connect@v1 - with: - tenant-id: ${{ server.secrets.AZURE_TENANT_ID }} - client-id: ${{ server.secrets.AZURE_CLIENT_ID }} - client-secret: ${{ server.secrets.AZURE_CLIENT_SECRET }} - display: - success: Successfully connected to Azure Active Directory - error: Unable to connect to Azure Active Directory - run-at-server: true - - - name: Locate the DevOps server - id: locate-devops - uses: network/ping@v1 - with: - host: ${{ project.versionControl.server }} - display: - success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds - error: The DevOps server is not accessible. Are you connected to the Internet? - run-at-server: true - - - name: Connect to the DevOps server - id: connect-devops - uses: azdevops/connect@v1 - with: - server: ${{ project.versionControl.server }} - personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} - display: - success: Connected to the DevOps server - error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) - run-at-server: true - - sync-active-directory: - $ref: SyncAzureActiveDirectory.steps.nox.yaml - - sync-version-control: - $ref: SyncVersionControl.steps.nox.yaml - - nox-project: - steps: - - name: Get the Nox project - id: get-nox-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: ${{ project.versionControl.project }} - display: - success: Got the ${{ project.versionControl.project }} DevOps project - error: There was a problem getting the ${{ project.versionControl.project }} project. (${{ steps.get-nox-project.error-message }}) - run-at-server: true - - sync-infrastructure: - $ref: SyncInfrastructure.steps.nox.yaml - - sync-helm-chart: - $ref: SyncHelmChart.steps.nox.yaml - - devops-project: - steps: - - name: Get the DevOps project - id: get-devops-project - uses: azdevops/get-project@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: IWG.DevOps - display: - success: Got the DevOps project - error: Unable to get the DevOps project (${{ steps.get-devops-project.error-message }}) - run-at-server: true - - sync-helm-chart-pipeline: - $ref: SyncHelmPipeline.steps.nox.yaml - - sync-project-pipeline: - $ref: SyncProjectPipeline.steps.nox.yaml - \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.steps.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.steps.nox.yaml deleted file mode 100644 index 9c2ba1f1..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.steps.nox.yaml +++ /dev/null @@ -1,280 +0,0 @@ -steps: - #Current Project - - name: Ensure your Nox project exists - id: ensure-project-exists - uses: azdevops/ensure-project-exists@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-name: ${{ project.versionControl.project }} - project-description: ${{ project.description }} - display: - success: ${{ steps.ensure-project-exists.outputs.success-message }} - error: Unable to ensure the Nox project exists (${{ steps.ensure-project-exists.error-message }}) - run-at-server: true - - - name: Update Nox Project Settings - id: update-project-settings - uses: azdevops/update-build-general-settings@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.ensure-project-exists.outputs.project-id }} - enforce-job-auth-scope: false - enforce-referenced-repo-scoped-token: false - display: - success: Updated the Nox project build settings - error: Unable to update the Nox project build settings (${{ steps.update-project-settings.error-message }}) - run-at-server: true - - - name: Add the admins to the project - id: add-admins - if: '"${{ vars.admin-user-names }}" != ""' - uses: azdevops/add-project-admins@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.ensure-project-exists.outputs.project-id }} - admins: ${{ vars.admin-user-names }} - display: - success: Added administrators to the project - error: Unable to add administrators to the project (${{ steps.add-admins.error-message }}) - run-at-server: true - - - name: Add the team to the project - id: add-developers - if: '"${{ vars.team-user-names }}"!= ""' - uses: azdevops/add-team-members@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.ensure-project-exists.outputs.project-id }} - team-members: ${{ vars.team-user-names }} - display: - success: Added team members to the project - error: Unable to add team members to the project (${{ steps.add-developers.error-message }}) - run-at-server: true - - - name: Ensure the Project Repository exists - id: ensure-repo-exists - uses: azdevops/ensure-repo-exists@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.ensure-project-exists.outputs.project-id }} - repository-name: ${{ project.versionControl.repository }} - do-initialize: true - display: - success: ${{ steps.ensure-repo-exists.outputs.success-message }} - error: There was a problem ensuring that the repository exists. (${{ steps.ensure-repo-exists.error-message }}) - run-at-server: true - - - name: Find the Default Project Repository - if: '"${{ project.versionControl.repository }}" != "${{ project.versionControl.project }}"' - id: find-default-repo - uses: azdevops/find-repo@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.ensure-project-exists.outputs.project-id }} - repository-name: ${{ project.versionControl.project }} - display: - success: Searched for the default project repository - error: Unable to search for the default project repository ${{ steps.find-default-repo.error-message }} - run-at-server: true - - - name: Delete the Default Repository if it exists - if: '"${{ project.versionControl.repository }}" != "${{ project.versionControl.project }}" && "${{ steps.find-default-repo.outputs.is-found }}" == "True"' - id: delete-default-repo - uses: azdevops/delete-repo@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - project-id: ${{ steps.ensure-project-exists.outputs.project-id }} - repository-name: ${{ project.versionControl.project }} - display: - success: Deleted the default repository - error: Unable to delete the default repository ${{ steps.delete-default-repo.error-message }} - run-at-server: true - - - name: Find the project main branch - id: find-main - uses: azdevops/find-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-repo-exists.outputs.repository-id }} - branch-name: main - display: - success: Successfully searched for the main branch - error: There was a problem finding the main branch for repo (${{ steps.find-main.error-message }}) - run-at-server: true - - - name: Create new branch - id: create-branch - uses: azdevops/create-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-repo-exists.outputs.repository-id }} - display: - success: Successfully created new branch -> ${{ steps.create-branch.outputs.branch-name }} - error: Unable to create new branch -> ${{ steps.create-branch.error-message }} - run-at-server: true - - - name: Download the new branch - id: download-branch - uses: azdevops/download-repo-branch@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-repo-exists.outputs.repository-id }} - branch-name: ${{ steps.create-branch.outputs.branch-name }} - display: - success: Successfully downloaded branch '${{ steps.create-branch.outputs.branch-name }}' of the Project Repo - error: There was a problem downloading the repository (${{ steps.download-branch.error-message }}) - run-at-server: true - - # global.yaml - - name: Check if global.yaml exists - id: find-global-yaml - uses: file/find-file@v1 - with: - path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables - file-name: global.yaml - display: - success: Searched for global.yaml - error: Unable to search for global.yaml (${{ steps.find-global-yaml.error-message }}) - run-at-server: true - - - name: Load global.yaml template - id: load-global-yaml - uses: core/load-template@v1 - with: - path: pipeline/nox-project/global.yaml - display: - success: Loaded global.yaml - error: Unable to load global.yaml (${{ steps.load-global-yaml.error-message }}) - run-at-server: true - - - name: Save global.yaml to local repo - id: save-global-yaml - uses: file/write-text@v1 - with: - path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables/global.yaml - text-to-write: ${{ steps.load-global-yaml.outputs.result }} - display: - success: Saved global.yaml - error: unable to save global.yaml (${{ steps.save-global-yaml.error-message }}) - run-at-server: true - - - name: Replace global.yaml template - id: replace-global-yaml - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables/global.yaml - replacements: - "": ${{ vars.project-dash-name }} - "": "" - "": ${{ vars.project-dash-name }} - "": ${{ project.versionControl.relativeProjectSourceFolder }} - "": ${{ project.versionControl.relativeDockerFilePath }} - display: - success: Strings Replace global.yaml success - error: Strings Replace global.yaml failed. (${{ steps.replace-global-yaml.error-message }}) - run-at-server: true - - # preprod-we-test.yaml - - name: Check if preprod-we-test.yaml exists - id: find-preprod-we-test-yaml - uses: file/find-file@v1 - with: - path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables - file-name: preprod-we-test.yaml - display: - success: Searched for preprod-we-test.yaml - error: Unable to search for preprod-we-test.yaml (${{ steps.find-preprod-we-test-yaml.error-message }}) - run-at-server: true - - - name: Load preprod-we-test.yaml template - id: load-preprod-we-test-yaml - uses: core/load-template@v1 - with: - path: pipeline/nox-project/preprod-we-test.yaml - display: - success: Loaded preprod-we-test.yaml - error: Unable to load preprod-we-test.yaml (${{ steps.load-preprod-we-test-yaml.error-message }}) - run-at-server: true - - - name: Save preprod-we-test.yaml to local repo - id: save-preprod-we-test-yaml - uses: file/write-text@v1 - with: - path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables/preprod-we-test.yaml - text-to-write: ${{ steps.load-preprod-we-test-yaml.outputs.result }} - display: - success: Saved preprod-we-test.yaml - error: unable to save preprod-we-test.yaml (${{ steps.save-preprod-we-test.error-message }}) - run-at-server: true - - - name: Replace preprod-we-test.yaml template - id: replace-preprod-we-test-yaml - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-branch.outputs.local-repository-path }}/pipeline/variables/preprod-we-test.yaml - replacements: - "": ${{ vars.project-dash-name }} - display: - success: Strings Replace preprod-we-test.yaml success - error: Strings Replace preprod-we-test.yaml failed. (${{ steps.replace-preprod-we-test-yaml.error-message }}) - run-at-server: true - - # azure-pipelines.yml - - name: Check if azure-pipelines.yml exists - id: find-azure-pipelines-yml - uses: file/find-file@v1 - with: - path: ${{ steps.download-branch.outputs.local-repository-path }} - file-name: azure-pipelines.yml - display: - success: Searched for azure-pipelines.yml - error: Unable to search for azure-pipelines.yml (${{ steps.find-azure-pipelines-yml.error-message }}) - run-at-server: true - - - name: Load azure-pipelines.yml template - id: load-azure-pipelines-yml - uses: core/load-template@v1 - with: - path: pipeline/nox-project/azure-pipelines.yml - display: - success: Loaded azure-pipelines.yml - error: Unable to load azure-pipelines.yml (${{ steps.load-azure-pipelines-yml.error-message }}) - run-at-server: true - - - name: Save azure-pipelines.yml to local repo - id: save-azure-pipelines - uses: file/write-text@v1 - with: - path: ${{ steps.download-branch.outputs.local-repository-path }}/azure-pipelines.yml - text-to-write: ${{ steps.load-azure-pipelines-yml.outputs.result }} - display: - success: Saved azure-pipelines.yml - error: unable to save azure-pipelines.yml (${{ steps.save-azure-pipelines.error-message }}) - run-at-server: true - - - name: Replace azure-pipelines.yml template - id: replace-azure-pipelines-yml - uses: file/replace-strings@v1 - with: - path: ${{ steps.download-branch.outputs.local-repository-path }}/azure-pipelines.yml - replacements: - "": ${{ vars.project-name }} - "": ${{ vars.project-dash-name }} - display: - success: Strings Replace azure-pipelines.yml success - error: Strings Replace azure-pipelines.yml failed. (${{ steps.replace-azure-pipelines-yml.error-message }}) - run-at-server: true - - - name: Push updated branch - id: merge-repo - uses: azdevops/merge-folder@v1 - with: - connection: ${{ steps.connect-devops.outputs.connection }} - repository-id: ${{ steps.ensure-repo-exists.outputs.repository-id }} - branch-name: ${{ steps.create-branch.outputs.branch-name }} - source-path: ${{ steps.download-branch.outputs.local-repository-path }} - reference-date-time: ${{ steps.download-branch.outputs.download-date-time }} - display: - success: Pushed updated branch to project repo - error: Unable to push updated branch to project repo. (${{ steps.merge-repo.error-message }}) - run-at-server: true \ No newline at end of file diff --git a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.workflow.nox.yaml b/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.workflow.nox.yaml deleted file mode 100644 index ea0bb6d6..00000000 --- a/docs/scripts/workflow/88155c28-f750-4013-91d3-8347ddb3daa7/SyncVersionControl.workflow.nox.yaml +++ /dev/null @@ -1,90 +0,0 @@ -# NOX Version Control Sync Command - -name: Synchronise NOX definition with version control - -cli: - branch: sync - command: version-control - command-alias: vc - description: "|vc - Sets up or synchronizes a repository on Azure Devops for your NOX team." - examples: - - ["sync versionControl", "--path "] - - ["sync vc", "--path "] - -jobs: - main-setup: - steps: - - name: Get Project dash case name - id: get-project-dash-name - uses: core/to-dash-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project dash case name - error: Unable to get the Project dash case name (${{ steps.get-project-dash-name.error-message }}) - - - name: Get the project snake case name - id: get-project-snake-name - uses: core/to-snake-case@v1 - with: - source-string: ${{ project.versionControl.project }} - display: - success: Got the Project snake case name - error: Unable to get the Project snake case name (${{ steps.get-project-snake-name.error-message }}) - - - name: Get the Team Member user name list - id: get-team-uname-list - uses: project/get-team-user-names@v1 - with: - team-members: ${{ project.team.developers }} - display: - success: Got the team user name list - error: Unable to get the team user name list (${{ steps.get-team-uname-list.error-message }}) - - - name: Get the Team Admins user name list - id: get-project-admin-uname-list - uses: project/get-admin-user-names@v1 - with: - team-members: ${{ project.team.developers }} - display: - success: Got the project admins user name list - error: Unable to get the project admins user name list (${{ steps.get-project-admin-list.error-message }}) - - - name: Store setup variables - id: add-setup-vars - uses: core/add-variables@v1 - with: - project-name: ${{ project.versionControl.project }} - project-dash-name: ${{ steps.get-project-dash-name.outputs.result }} - project-snake-name: ${{ steps.get-project-snake-name.outputs.result }} - team-user-names: ${{ steps.get-team-uname-list.outputs.user-names }} - admin-user-names: ${{ steps.get-project-admin-uname-list.outputs.user-names }} - display: - success: Variables stored - error: Unable to store project variables ${{ steps.add-setup-vars.error-message }} - - connect: - steps: - - name: Locate the DevOps server - id: locate-devops - uses: network/ping@v1 - with: - host: ${{ project.versionControl.server }} - display: - success: Found the DevOps server in ${{ steps.locate-devops.outputs.roundtrip-time }} milliseconds - error: The DevOps server is not accessible. Are you connected to the Internet? - run-at-server: true - - - name: Connect to the DevOps server - id: connect-devops - uses: azdevops/connect@v1 - with: - server: ${{ project.versionControl.server }} - personal-access-token: ${{ server.secrets.AZURE_DEVOPS_PAT }} - display: - success: Connected to the DevOps server - error: There was a problem connecting to the DevOps server. (${{ steps.connect-devops.error-message }}) - run-at-server: true - - sync-version-control: - $ref: SyncVersionControl.steps.nox.yaml \ No newline at end of file