diff --git a/.ado/workflows/dataProductDeploymentDev.yml b/.ado/workflows/dataProductDeploymentDev.yml new file mode 100644 index 0000000..38558e7 --- /dev/null +++ b/.ado/workflows/dataProductDeploymentDev.yml @@ -0,0 +1,44 @@ +name: Data Product Deployment - Dev + +trigger: + branches: + include: + - main + paths: + include: + - code/* + - infra/* + - .ado/workflows/* +pr: + branches: + include: + - main + paths: + include: + - code/* + - infra/* + - .ado/workflows/* + +variables: + DEV_ENVIRONMENT_NAME: "dev" # Update to '{devEnvironmentName}' + DEV_VARIABLE_GROUP_NAME: "dev-product-streaming" # Update to '{devVariableGroupName}' + +stages: + - stage: Validation_Dev + displayName: "Validation of IaC templates - Dev" + jobs: + - template: templates/validation.yml + parameters: + environment_name: ${{ variables.DEV_ENVIRONMENT_NAME }} + variable_group_name: ${{ variables.DEV_VARIABLE_GROUP_NAME }} + + - stage: Deployment_Dev + displayName: "Deployment of IaC templates - Dev" + dependsOn: [ Validation_Dev ] + # condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI')) + + jobs: + - template: templates/deployment.yml + parameters: + environment_name: ${{ variables.DEV_ENVIRONMENT_NAME }} + variable_group_name: ${{ variables.DEV_VARIABLE_GROUP_NAME }} diff --git a/.ado/workflows/dataProductDeploymentTestProd.yml b/.ado/workflows/dataProductDeploymentTestProd.yml new file mode 100644 index 0000000..9b5b3f8 --- /dev/null +++ b/.ado/workflows/dataProductDeploymentTestProd.yml @@ -0,0 +1,61 @@ +name: Data Product Deployment - Test/Prod + +trigger: + branches: + include: + - main + - releases/* + tags: + include: + - v* + paths: + include: + - code/* + - infra/* + - .ado/workflows/* + +variables: + TEST_ENVIRONMENT_NAME: "test" # Update to '{testEnvironmentName}' + TEST_VARIABLE_GROUP_NAME: "test-product-streaming" # Update to '{testVariableGroupName}' + PROD_ENVIRONMENT_NAME: "prod" # Update to '{prodEnvironmentName}' + PROD_VARIABLE_GROUP_NAME: "prod-product-streaming" # Update to '{prodVariableGroupName}' + +stages: + - stage: Validation_Test + displayName: "Validation of IaC templates - Test" + continue-on-error: false + jobs: + - template: templates/validation.yml + parameters: + environment_name: ${{ variables.TEST_ENVIRONMENT_NAME }} + variable_group_name: ${{ variables.TEST_VARIABLE_GROUP_NAME }} + + - stage: Validation_Prod + displayName: "Validation of IaC templates - Prod" + jobs: + - template: templates/validation.yml + parameters: + environment_name: ${{ variables.PROD_ENVIRONMENT_NAME }} + variable_group_name: ${{ variables.PROD_VARIABLE_GROUP_NAME }} + + - stage: Deployment_Test + displayName: "Deployment of IaC templates - Test" + dependsOn: [ Validation_Test, Validation_Prod ] + # condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI')) + + jobs: + - template: templates/deployment.yml + parameters: + environment_name: ${{ variables.TEST_ENVIRONMENT_NAME }} + variable_group_name: ${{ variables.TEST_VARIABLE_GROUP_NAME }} + + - stage: Deployment_Prod + displayName: "Deployment of IaC templates - Prod" + dependsOn: [ Deployment_Test ] + # condition: and(succeeded(), in(variables['Build.Reason'], 'IndividualCI', 'BatchedCI')) + + jobs: + - template: templates/deployment.yml + parameters: + environment_name: ${{ variables.PROD_ENVIRONMENT_NAME }} + variable_group_name: ${{ variables.PROD_VARIABLE_GROUP_NAME }} diff --git a/.ado/workflows/templates/deployment.yml b/.ado/workflows/templates/deployment.yml new file mode 100644 index 0000000..1f3c842 --- /dev/null +++ b/.ado/workflows/templates/deployment.yml @@ -0,0 +1,61 @@ +parameters: + - name: environment_name + displayName: Environment Name + type: string + - name: variable_group_name + displayName: Variable Group Name + type: string + +jobs: + - job: Deployment + displayName: "Deployment to ${{ parameters.environment_name }}" + continueOnError: false + pool: + vmImage: "ubuntu-latest" + variables: + - group: ${{ parameters.variable_group_name }} + + steps: + # Checkout code + - checkout: self + name: checkout_repository + displayName: "Checkout repository" + submodules: true + lfs: false + clean: true + continueOnError: false + enabled: true + + # Generate Password 001 + - task: PowerShell@2 + name: generate_password_001 + displayName: Generate Password 001 + enabled: true + continueOnError: false + inputs: + targetType: "filePath" + filePath: "$(System.DefaultWorkingDirectory)/code/GeneratePassword.ps1" + errorActionPreference: "stop" + failOnStderr: false + ignoreLASTEXITCODE: false + pwsh: true + + # Deploy Data Product + - task: AzureResourceManagerTemplateDeployment@3 + name: data_product_deployment + displayName: Deploy Data Product + enabled: true + continueOnError: false + inputs: + deploymentScope: "Resource Group" + azureResourceManagerConnection: $(AZURE_RESOURCE_MANAGER_CONNECTION_NAME) + subscriptionId: $(AZURE_SUBSCRIPTION_ID) + action: "Create Or Update Resource Group" + resourceGroupName: $(AZURE_RESOURCE_GROUP_NAME) + location: $(AZURE_LOCATION) + templateLocation: "Linked artifact" + csmFile: "$(System.DefaultWorkingDirectory)/infra/main.json" + csmParametersFile: "$(System.DefaultWorkingDirectory)/infra/params.${{ parameters.environment_name }}.json" + deploymentMode: "Incremental" + overrideParameters: > + -administratorPassword "$(password)" diff --git a/.ado/workflows/templates/validation.yml b/.ado/workflows/templates/validation.yml new file mode 100644 index 0000000..0221637 --- /dev/null +++ b/.ado/workflows/templates/validation.yml @@ -0,0 +1,89 @@ +parameters: + - name: environment_name + displayName: Environment Name + type: string + - name: variable_group_name + displayName: Variable Group Name + type: string + +jobs: + - job: Validation + displayName: "Validation of ${{ parameters.environment_name }}" + continueOnError: false + pool: + vmImage: "ubuntu-latest" + variables: + - group: ${{ parameters.variable_group_name }} + + steps: + # Checkout code + - checkout: self + name: checkout_repository + displayName: "Checkout repository" + submodules: true + lfs: false + clean: true + continueOnError: false + enabled: true + + # Generate Password 001 + - task: PowerShell@2 + name: generate_password_001 + displayName: Generate Password 001 + enabled: true + continueOnError: false + inputs: + targetType: "filePath" + filePath: "$(System.DefaultWorkingDirectory)/code/GeneratePassword.ps1" + errorActionPreference: "stop" + failOnStderr: false + ignoreLASTEXITCODE: false + pwsh: true + + # Deploy Data Product - validation + - task: AzureResourceManagerTemplateDeployment@3 + name: data_product_validation + displayName: Deploy Data Product - validation + enabled: true + continueOnError: false + inputs: + deploymentScope: "Resource Group" + azureResourceManagerConnection: $(AZURE_RESOURCE_MANAGER_CONNECTION_NAME) + subscriptionId: $(AZURE_SUBSCRIPTION_ID) + action: "Create Or Update Resource Group" + resourceGroupName: $(AZURE_RESOURCE_GROUP_NAME) + location: $(AZURE_LOCATION) + templateLocation: "Linked artifact" + csmFile: "$(System.DefaultWorkingDirectory)/infra/main.json" + csmParametersFile: "$(System.DefaultWorkingDirectory)/infra/params.${{ parameters.environment_name }}.json" + deploymentMode: "Validation" + overrideParameters: > + -administratorPassword "$(password)" + + # Deploy Data Product - what-if + - task: AzureCLI@2 + name: data_product_whatif + displayName: Deploy Data Product - what-if + enabled: true + continueOnError: false + inputs: + azureSubscription: $(AZURE_RESOURCE_MANAGER_CONNECTION_NAME) + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | + az account set ` + --subscription $(AZURE_SUBSCRIPTION_ID) + + az deployment group what-if ` + --resource-group $(AZURE_RESOURCE_GROUP_NAME) ` + --exclude-change-types Ignore NoChange Unsupported ` + --mode "Incremental" ` + --template-file "$(System.DefaultWorkingDirectory)/infra/main.json" ` + --parameters "$(System.DefaultWorkingDirectory)/infra/params.${{ parameters.environment_name }}.json" administratorPassword="$(password)" ` + --result-format "FullResourcePayloads" + + powerShellErrorActionPreference: "stop" + addSpnToEnvironment: false + useGlobalConfig: false + failOnStandardError: false + powerShellIgnoreLASTEXITCODE: false diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml index 4f16ed4..f4d6afb 100644 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.yml +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.yml @@ -10,7 +10,7 @@ body: - type: markdown attributes: value: | - Thanks for taking the time to fill out this report! Before submitting, please make sure to [search through existing issues](https://github.com/Azure/data-product-streaming/issues) and [check the Known Issues section](/docs/DataManagementAnalytics-KnownIssues.md). + Thanks for taking the time to fill out this report! Before submitting, please make sure to [search through existing issues](https://github.com/Azure/data-product-streaming/issues) and [check the Known Issues section](https://github.com/Azure/data-product-streaming/blob/main/docs/EnterpriseScaleAnalytics-KnownIssues.md). - type: dropdown id: deployment @@ -39,7 +39,7 @@ body: label: Error Message description: If possible, please share the error message that you received. placeholder: Error Messages - render: json + render: JSON validations: required: false @@ -58,7 +58,7 @@ body: label: Code of Conduct description: The Code of Conduct helps create a safe space for everyone. We require that everyone must abide by it. options: - - label: I agree to follow this project's [Code of Conduct](/CODE_OF_CONDUCT.md) + - label: I agree to follow this project's [Code of Conduct](https://github.com/Azure/data-product-streaming/blob/main/CODE_OF_CONDUCT.md) required: true - type: markdown diff --git a/.github/ISSUE_TEMPLATE/DOCUMENTATION_ISSUE.yml b/.github/ISSUE_TEMPLATE/DOCUMENTATION_ISSUE.yml index 7727d6d..87f8f25 100644 --- a/.github/ISSUE_TEMPLATE/DOCUMENTATION_ISSUE.yml +++ b/.github/ISSUE_TEMPLATE/DOCUMENTATION_ISSUE.yml @@ -9,7 +9,7 @@ body: - type: markdown attributes: value: | - Thanks for taking the time to fill out this report! Before submitting, please make sure to [search through existing issues](https://github.com/Azure/data-product-streaming/issues) and [check the Known Issues section](/docs/DataManagementAnalytics-KnownIssues.md). + Thanks for taking the time to fill out this report! Before submitting, please make sure to [search through existing issues](https://github.com/Azure/data-product-streaming/issues) and [check the Known Issues section](https://github.com/Azure/data-product-streaming/blob/main/docs/EnterpriseScaleAnalytics-KnownIssues.md). - type: textarea id: description @@ -25,7 +25,7 @@ body: label: Code of Conduct description: The Code of Conduct helps create a safe space for everyone. We require that everyone must abide by it. options: - - label: I agree to follow this project's [Code of Conduct](/CODE_OF_CONDUCT.md) + - label: I agree to follow this project's [Code of Conduct](https://github.com/Azure/data-product-streaming/blob/main/CODE_OF_CONDUCT.md) required: true - type: markdown diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml index 38ea507..586f93f 100644 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.yml @@ -10,7 +10,7 @@ body: - type: markdown attributes: value: | - Thanks for taking the time to fill out this report! Before submitting, please make sure to [search through existing issues](https://github.com/Azure/data-product-streaming/issues) and [check the Known Issues section](/docs/DataManagementAnalytics-KnownIssues.md). + Thanks for taking the time to fill out this report! Before submitting, please make sure to [search through existing issues](https://github.com/Azure/data-product-streaming/issues) and [check the Known Issues section](https://github.com/Azure/data-product-streaming/blob/main/docs/EnterpriseScaleAnalytics-KnownIssues.md). - type: textarea id: feature_description @@ -34,7 +34,7 @@ body: label: Code of Conduct description: The Code of Conduct helps create a safe space for everyone. We require that everyone must abide by it. options: - - label: I agree to follow this project's [Code of Conduct](/CODE_OF_CONDUCT.md) + - label: I agree to follow this project's [Code of Conduct](https://github.com/Azure/data-product-streaming/blob/main/CODE_OF_CONDUCT.md) required: true - type: markdown diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 28fbb9e..28b9223 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -7,7 +7,7 @@ ## PR Checklist * [ ] Closes Issue #xxx -* [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA +* [ ] Code of Conduct signed. If not, go to [Code of Conduct](https://github.com/Azure/data-management-zone/blob/main/CODE_OF_CONDUCT.md). ## Validation Steps Performed diff --git a/.github/workflows/dataProductDeployment.yml b/.github/workflows/dataProductDeployment.yml deleted file mode 100644 index bc94710..0000000 --- a/.github/workflows/dataProductDeployment.yml +++ /dev/null @@ -1,137 +0,0 @@ -name: Data Product Deployment - -on: - push: - branches: [ main ] - paths: - - "code/**" - - "infra/**" - - ".github/workflows/dataProductDeployment.yml" - pull_request: - branches: [ main ] - paths: - - "code/**" - - "infra/**" - - ".github/workflows/dataProductDeployment.yml" - -env: - AZURE_SUBSCRIPTION_ID: "2150d511-458f-43b9-8691-6819ba2e6c7b" # Update to '{dataLandingZoneSubscriptionId}' - AZURE_RESOURCE_GROUP_NAME: "dlz01-dev-di002" # Update to '{dataLandingZoneName}-rg' - AZURE_LOCATION: "northeurope" # Update to '{regionName}' - -jobs: - validation: - name: "Validation of IaC templates" - runs-on: ubuntu-latest - continue-on-error: false - - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Check Out Repository - id: checkout_repository - uses: actions/checkout@v2 - - # Login to Azure - - name: Azure Login - id: azure_login - uses: azure/login@v1 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - # Generate Password 001 - - name: Generate Password 001 - id: generate_password_001 - run: | - echo "Generating Password" - pwsh "${GITHUB_WORKSPACE}/code/GeneratePassword.ps1" -GitHub - - # Deploy Data Product - validation - - name: Deploy Data Product - validation - id: data_product_validation - uses: azure/arm-deploy@v1 - with: - scope: resourcegroup - subscriptionId: ${{ env.AZURE_SUBSCRIPTION_ID }} - resourceGroupName: ${{ env.AZURE_RESOURCE_GROUP_NAME }} - region: ${{ env.AZURE_LOCATION }} - template: ${{ github.workspace }}/infra/main.json - parameters: ${{ github.workspace }}/infra/params.dev.json administratorPassword="${{ steps.generate_password_001.outputs.password }}" - deploymentMode: Validate - failOnStdErr: false - - # Deploy Data Product - what-if - - name: Deploy Data Product - what-if - id: data_product_whatif - uses: azure/cli@v1 - with: - azcliversion: "agentazcliversion" - inlineScript: | - az account set \ - --subscription ${{ env.AZURE_SUBSCRIPTION_ID }} - - az deployment group what-if \ - --resource-group ${{ env.AZURE_RESOURCE_GROUP_NAME }} \ - --exclude-change-types Ignore NoChange Unsupported \ - --mode "Incremental" \ - --template-file "${GITHUB_WORKSPACE}/infra/main.json" \ - --parameters "${GITHUB_WORKSPACE}/infra/params.dev.json" administratorPassword="${{ steps.generate_password_001.outputs.password }}" \ - --result-format "FullResourcePayloads" - - # Log out from Azure - - name: Log out from Azure - id: azure_logout - uses: azure/cli@v1 - with: - azcliversion: "agentazcliversion" - inlineScript: | - az logout - - deployment: - name: "Deployment of IaC templates" - needs: [validation] - runs-on: ubuntu-latest - if: github.event_name == 'push' - continue-on-error: false - - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Check Out Repository - id: checkout_repository - uses: actions/checkout@v2 - - # Login to Azure - - name: Azure Login - id: azure_login - uses: azure/login@v1 - with: - creds: ${{ secrets.AZURE_CREDENTIALS }} - - # Generate Password 001 - - name: Generate Password 001 - id: generate_password_001 - run: | - echo "Generating Password" - pwsh "${GITHUB_WORKSPACE}/code/GeneratePassword.ps1" -GitHub - - # Deploy Data Product - - name: Deploy Data Product - id: data_product_deployment - uses: azure/arm-deploy@v1 - with: - scope: resourcegroup - subscriptionId: ${{ env.AZURE_SUBSCRIPTION_ID }} - resourceGroupName: ${{ env.AZURE_RESOURCE_GROUP_NAME }} - region: ${{ env.AZURE_LOCATION }} - template: ${{ github.workspace }}/infra/main.json - parameters: ${{ github.workspace }}/infra/params.dev.json administratorPassword="${{ steps.generate_password_001.outputs.password }}" - deploymentMode: Incremental - failOnStdErr: false - - # Log out from Azure - - name: Log out from Azure - id: azure_logout - uses: azure/cli@v1 - with: - azcliversion: "agentazcliversion" - inlineScript: | - az logout diff --git a/.github/workflows/dataProductDeploymentDev.yml b/.github/workflows/dataProductDeploymentDev.yml new file mode 100644 index 0000000..e5eb092 --- /dev/null +++ b/.github/workflows/dataProductDeploymentDev.yml @@ -0,0 +1,43 @@ +name: Data Product Deployment - Dev + +on: + push: + branches: [ main ] + paths: + - "code/**" + - "infra/**" + - ".github/workflows/**" + pull_request: + branches: [ main ] + paths: + - "code/**" + - "infra/**" + - ".github/workflows/**" + +env: + DEV_ENVIRONMENT_NAME: "dev" # Update to '{devEnvironmentName}' + +jobs: + validation_dev: + uses: ./.github/workflows/validation.yml + name: "Validation of IaC templates - Dev" + with: + environment: "dev" + secrets: + azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + azure_resource_group_name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} + azure_location_name: ${{ secrets.AZURE_LOCATION }} + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + + deployment_dev: + uses: ./.github/workflows/deployment.yml + name: "Deployment of IaC templates - Dev" + needs: [ validation_dev ] + if: github.event_name == 'push' + with: + environment: "dev" + secrets: + azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + azure_resource_group_name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} + azure_location_name: ${{ secrets.AZURE_LOCATION }} + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} diff --git a/.github/workflows/dataProductDeploymentTestProd.yml b/.github/workflows/dataProductDeploymentTestProd.yml new file mode 100644 index 0000000..c00a637 --- /dev/null +++ b/.github/workflows/dataProductDeploymentTestProd.yml @@ -0,0 +1,67 @@ +name: Data Product Deployment - Test/Prod + +on: + release: + types: [ published ] + push: + branches: [ main ] + paths: + - "code/**" + - "infra/**" + - ".github/workflows/dataProductDeploymentTestProd.yml" + - ".github/workflows/validationTemplate.yml" + - ".github/workflows/deploymentTemplate.yml" + +env: + TEST_ENVIRONMENT_NAME: "test" # Update to '{testEnvironmentName}' + PROD_ENVIRONMENT_NAME: "prod" # Update to '{prodEnvironmentName}' + +jobs: + validation_test: + uses: ./.github/workflows/validation.yml + name: "Validation of IaC templates - Test" + with: + environment: "test" + secrets: + azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + azure_resource_group_name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} + azure_location_name: ${{ secrets.AZURE_LOCATION }} + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + + validation_prod: + uses: ./.github/workflows/validation.yml + name: "Validation of IaC templates - Prod" + needs: [ validation_test ] + with: + environment: "prod" + secrets: + azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + azure_resource_group_name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} + azure_location_name: ${{ secrets.AZURE_LOCATION }} + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + + deployment_test: + uses: ./.github/workflows/deployment.yml + name: "Deployment of IaC templates - Test" + needs: [ validation_prod ] + if: github.event_name == 'release' + with: + environment: "test" + secrets: + azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + azure_resource_group_name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} + azure_location_name: ${{ secrets.AZURE_LOCATION }} + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} + + deployment_prod: + uses: ./.github/workflows/deployment.yml + name: "Deployment of IaC templates - Prod" + needs: [ deployment_test ] + if: github.event_name == 'release' + with: + environment: "prod" + secrets: + azure_subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} + azure_resource_group_name: ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} + azure_location_name: ${{ secrets.AZURE_LOCATION }} + azure_credentials: ${{ secrets.AZURE_CREDENTIALS }} diff --git a/.github/workflows/deployment.yml b/.github/workflows/deployment.yml new file mode 100644 index 0000000..f3d94c3 --- /dev/null +++ b/.github/workflows/deployment.yml @@ -0,0 +1,75 @@ +name: Deployment Template + +on: + workflow_call: + inputs: + environment: + required: true + type: string + default: "dev" + description: "Specifies the environment of the deployment." + secrets: + azure_subscription_id: + required: true + description: "Specifies the subscription id of the deployment." + azure_resource_group_name: + required: true + description: "Specifies the resource group name of the deployment." + azure_location_name: + required: true + description: "Specifies the location name of the deployment." + azure_credentials: + required: true + description: "Specifies the azure credentials used for authentication." + +jobs: + deployment: + name: Deployment to ${{ inputs.environment }} + runs-on: ubuntu-latest + continue-on-error: false + if: github.event_name == 'push' || github.event_name == 'release' + environment: ${{ inputs.environment }} + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Check Out Repository + id: checkout_repository + uses: actions/checkout@v2 + + # Login to Azure + - name: Azure Login + id: azure_login + uses: azure/login@v1 + with: + creds: ${{ secrets.azure_credentials }} + + # Generate Password 001 + - name: Generate Password 001 + id: generate_password_001 + run: | + echo "Generating Password" + pwsh "${GITHUB_WORKSPACE}/code/GeneratePassword.ps1" -GitHub + + # Deploy Data Product + - name: Deploy Data Product + id: data_product_deployment + uses: azure/arm-deploy@v1 + with: + scope: resourcegroup + subscriptionId: ${{ secrets.azure_subscription_id }} + resourceGroupName: ${{ secrets.azure_resource_group_name }} + region: ${{ secrets.azure_location_name }} + template: ${{ github.workspace }}/infra/main.json + parameters: ${{ github.workspace }}/infra/params.${{ inputs.environment }}.json administratorPassword="${{ steps.generate_password_001.outputs.password }}" + deploymentMode: Incremental + deploymentName: "DataProduct-${{ github.sha }}" + failOnStdErr: false + + # Log out from Azure + - name: Log out from Azure + id: azure_logout + uses: azure/cli@v1 + with: + azcliversion: "agentazcliversion" + inlineScript: | + az logout diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 9678e53..b5169da 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -12,6 +12,10 @@ jobs: runs-on: ubuntu-latest steps: + - run: | + echo ${{ github.sha }} + echo ${{ github.repository }} + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Check Out Repository id: checkout_repository @@ -29,4 +33,5 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} VALIDATE_JSCPD: false VALIDATE_JSON: false + VALIDATE_GITHUB_ACTIONS: false FILTER_REGEX_EXCLUDE: (/.devcontainer/|/reference/) diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml new file mode 100644 index 0000000..ade75f2 --- /dev/null +++ b/.github/workflows/validation.yml @@ -0,0 +1,90 @@ +name: Deployment Template + +on: + workflow_call: + inputs: + environment: + required: true + type: string + default: "dev" + description: "Specifies the environment of the deployment." + secrets: + azure_subscription_id: + required: true + description: "Specifies the subscription id of the deployment." + azure_resource_group_name: + required: true + description: "Specifies the resource group name of the deployment." + azure_location_name: + required: true + description: "Specifies the location name of the deployment." + azure_credentials: + required: true + description: "Specifies the azure credentials used for authentication." + +jobs: + validation: + name: Validation of ${{ inputs.environment }} + runs-on: ubuntu-latest + continue-on-error: false + environment: ${{ inputs.environment }} + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Check Out Repository + id: checkout_repository + uses: actions/checkout@v2 + + # Login to Azure + - name: Azure Login + id: azure_login + uses: azure/login@v1 + with: + creds: ${{ secrets.azure_credentials }} + + # Generate Password 001 + - name: Generate Password 001 + id: generate_password_001 + run: | + echo "Generating Password" + pwsh "${GITHUB_WORKSPACE}/code/GeneratePassword.ps1" -GitHub + + # Deploy Data Product - validation + - name: Deploy Data Product - validation + id: data_product_validation + uses: azure/arm-deploy@v1 + with: + scope: resourcegroup + subscriptionId: ${{ secrets.azure_subscription_id }} + resourceGroupName: ${{ secrets.azure_resource_group_name }} + region: ${{ secrets.azure_location_name }} + template: ${{ github.workspace }}/infra/main.json + parameters: ${{ github.workspace }}/infra/params.${{ inputs.environment }}.json administratorPassword="${{ steps.generate_password_001.outputs.password }}" + deploymentMode: Validate + deploymentName: "DataProduct-${{ github.sha }}" + failOnStdErr: false + + # Deploy Data Product - what-if + - name: Deploy Data Product - what-if + id: data_product_whatif + uses: azure/arm-deploy@v1 + with: + scope: resourcegroup + subscriptionId: ${{ secrets.azure_subscription_id }} + resourceGroupName: ${{ secrets.azure_resource_group_name }} + region: ${{ secrets.azure_location_name }} + template: ${{ github.workspace }}/infra/main.json + parameters: ${{ github.workspace }}/infra/params.${{ inputs.environment }}.json administratorPassword="${{ steps.generate_password_001.outputs.password }}" + deploymentMode: Incremental + deploymentName: "DataProduct-${{ github.sha }}" + failOnStdErr: false + additionalArguments: "--what-if --what-if-exclude-change-types Ignore NoChange Unsupported --what-if-result-format FullResourcePayloads" + + # Log out from Azure + - name: Log out from Azure + id: azure_logout + uses: azure/cli@v1 + with: + azcliversion: "agentazcliversion" + inlineScript: | + az logout