-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into PSL-US-7771-UT
- Loading branch information
Showing
33 changed files
with
589 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
name: CI-Validate Deployment-Client Advisor | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'ClientAdvisor/**' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Azure CLI | ||
run: | | ||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | ||
az --version # Verify installation | ||
- name: Login to Azure | ||
run: | | ||
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }} | ||
- name: Install Bicep CLI | ||
run: az bicep install | ||
|
||
- name: Generate Resource Group Name | ||
id: generate_rg_name | ||
run: | | ||
echo "Generating a unique resource group name..." | ||
TIMESTAMP=$(date +%Y%m%d%H%M%S) | ||
COMMON_PART="pslautomationCli" | ||
UNIQUE_RG_NAME="${COMMON_PART}${TIMESTAMP}" | ||
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV | ||
echo "Generated RESOURCE_GROUP_PREFIX: ${UNIQUE_RG_NAME}" | ||
- name: Check and Create Resource Group | ||
id: check_create_rg | ||
run: | | ||
echo "RESOURCE_GROUP: ${{ env.RESOURCE_GROUP_NAME }}" | ||
set -e | ||
echo "Checking if resource group exists..." | ||
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }}) | ||
if [ "$rg_exists" = "false" ]; then | ||
echo "Resource group does not exist. Creating..." | ||
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location uksouth || { echo "Error creating resource group"; exit 1; } | ||
else | ||
echo "Resource group already exists." | ||
fi | ||
- name: Generate Unique Solution Prefix | ||
id: generate_solution_prefix | ||
run: | | ||
set -e | ||
COMMON_PART="pslc" | ||
TIMESTAMP=$(date +%s) | ||
UPDATED_TIMESTAMP=$(echo $TIMESTAMP | tail -c 3) | ||
UNIQUE_SOLUTION_PREFIX="${COMMON_PART}${UPDATED_TIMESTAMP}" | ||
echo "SOLUTION_PREFIX=${UNIQUE_SOLUTION_PREFIX}" >> $GITHUB_ENV | ||
echo "Generated SOLUTION_PREFIX: ${UNIQUE_SOLUTION_PREFIX}" | ||
- name: Deploy Bicep Template | ||
id: deploy | ||
run: | | ||
set -e | ||
az deployment group create \ | ||
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \ | ||
--template-file ClientAdvisor/Deployment/bicep/main.bicep \ | ||
--parameters solutionPrefix=${{ env.SOLUTION_PREFIX }} cosmosLocation=eastus2 | ||
- name: Update PowerBI URL | ||
if: success() | ||
run: | | ||
set -e | ||
COMMON_PART="-app-service" | ||
application_name="${{ env.SOLUTION_PREFIX }}${COMMON_PART}" | ||
echo "Updating application: $application_name" | ||
# Log the Power BI URL being set | ||
echo "Setting Power BI URL: ${{ vars.VITE_POWERBI_EMBED_URL }}" | ||
# Update the application settings | ||
az webapp config appsettings set --name "$application_name" --resource-group "${{ env.RESOURCE_GROUP_NAME }}" --settings VITE_POWERBI_EMBED_URL="${{ vars.VITE_POWERBI_EMBED_URL }}" | ||
# Restart the web app | ||
az webapp restart --resource-group "${{ env.RESOURCE_GROUP_NAME }}" --name "$application_name" | ||
echo "Power BI URL updated successfully for application: $application_name." | ||
- name: Delete Bicep Deployment | ||
if: success() | ||
run: | | ||
set -e | ||
echo "Checking if resource group exists..." | ||
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }}) | ||
if [ "$rg_exists" = "true" ]; then | ||
echo "Resource group exist. Cleaning..." | ||
az group delete \ | ||
--name ${{ env.RESOURCE_GROUP_NAME }} \ | ||
--yes \ | ||
--no-wait | ||
echo "Resource group deleted... ${{ env.RESOURCE_GROUP_NAME }}" | ||
else | ||
echo "Resource group does not exists." | ||
fi | ||
- name: Send Notification on Failure | ||
if: failure() | ||
run: | | ||
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
# Construct the email body | ||
EMAIL_BODY=$(cat <<EOF | ||
{ | ||
"body": "<p>Dear Team,</p><p>We would like to inform you that the Client Advisor Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>" | ||
} | ||
EOF | ||
) | ||
|
||
# Send the notification | ||
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \ | ||
-H "Content-Type: application/json" \ | ||
-d "$EMAIL_BODY" || echo "Failed to send notification" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: CI-Validate Deployment-Research Assistant | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'ResearchAssistant/**' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Azure CLI | ||
run: | | ||
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | ||
az --version # Verify installation | ||
- name: Login to Azure | ||
run: | | ||
az login --service-principal -u ${{ secrets.AZURE_CLIENT_ID }} -p ${{ secrets.AZURE_CLIENT_SECRET }} --tenant ${{ secrets.AZURE_TENANT_ID }} | ||
- name: Install Bicep CLI | ||
run: az bicep install | ||
|
||
- name: Generate Resource Group Name | ||
id: generate_rg_name | ||
run: | | ||
echo "Generating a unique resource group name..." | ||
TIMESTAMP=$(date +%Y%m%d%H%M%S) | ||
COMMON_PART="pslautomationRes" | ||
UNIQUE_RG_NAME="${COMMON_PART}${TIMESTAMP}" | ||
echo "RESOURCE_GROUP_NAME=${UNIQUE_RG_NAME}" >> $GITHUB_ENV | ||
echo "Generated Resource_GROUP_PREFIX: ${UNIQUE_RG_NAME}" | ||
- name: Check and Create Resource Group | ||
id: check_create_rg | ||
run: | | ||
set -e | ||
echo "Checking if resource group exists..." | ||
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }}) | ||
if [ "$rg_exists" = "false" ]; then | ||
echo "Resource group does not exist. Creating..." | ||
az group create --name ${{ env.RESOURCE_GROUP_NAME }} --location eastus2 || { echo "Error creating resource group"; exit 1; } | ||
else | ||
echo "Resource group already exists." | ||
fi | ||
- name: Generate Unique Solution Prefix | ||
id: generate_solution_prefix | ||
run: | | ||
set -e | ||
COMMON_PART="pslr" | ||
TIMESTAMP=$(date +%s) | ||
UPDATED_TIMESTAMP=$(echo $TIMESTAMP | tail -c 3) | ||
UNIQUE_SOLUTION_PREFIX="${COMMON_PART}${UPDATED_TIMESTAMP}" | ||
echo "SOLUTION_PREFIX=${UNIQUE_SOLUTION_PREFIX}" >> $GITHUB_ENV | ||
echo "Generated SOLUTION_PREFIX: ${UNIQUE_SOLUTION_PREFIX}" | ||
- name: Deploy Bicep Template | ||
id: deploy | ||
run: | | ||
set -e | ||
az deployment group create \ | ||
--resource-group ${{ env.RESOURCE_GROUP_NAME }} \ | ||
--template-file ResearchAssistant/Deployment/bicep/main.bicep \ | ||
--parameters solutionPrefix=${{ env.SOLUTION_PREFIX }} | ||
- name: Delete Bicep Deployment | ||
if: success() | ||
run: | | ||
set -e | ||
echo "Checking if resource group exists..." | ||
rg_exists=$(az group exists --name ${{ env.RESOURCE_GROUP_NAME }}) | ||
if [ "$rg_exists" = "true" ]; then | ||
echo "Resource group exist. Cleaning..." | ||
az group delete \ | ||
--name ${{ env.RESOURCE_GROUP_NAME }} \ | ||
--yes \ | ||
--no-wait | ||
echo "Resource group deleted... ${{ env.RESOURCE_GROUP_NAME }}" | ||
else | ||
echo "Resource group does not exists." | ||
fi | ||
- name: Send Notification on Failure | ||
if: failure() | ||
run: | | ||
RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
# Construct the email body | ||
EMAIL_BODY=$(cat <<EOF | ||
{ | ||
"body": "<p>Dear Team,</p><p>We would like to inform you that the Research Assistant Automation process has encountered an issue and has failed to complete successfully.</p><p><strong>Build URL:</strong> ${RUN_URL}<br> ${OUTPUT}</p><p>Please investigate the matter at your earliest convenience.</p><p>Best regards,<br>Your Automation Team</p>" | ||
} | ||
EOF | ||
) | ||
|
||
# Send the notification | ||
curl -X POST "${{ secrets.LOGIC_APP_URL }}" \ | ||
-H "Content-Type: application/json" \ | ||
-d "$EMAIL_BODY" || echo "Failed to send notification" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# For most projects, this workflow file will not need changing; you simply need | ||
# to commit it to your repository. | ||
# | ||
# You may wish to alter this file to override the set of languages analyzed, | ||
# or to provide custom queries or build logic. | ||
# | ||
# ******** NOTE ******** | ||
# We have attempted to detect the languages in your repository. Please check | ||
# the `language` matrix defined below to confirm you have the correct set of | ||
# supported CodeQL languages. | ||
# | ||
name: "CodeQL Advanced" | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
schedule: | ||
- cron: '22 13 * * 0' | ||
|
||
jobs: | ||
analyze: | ||
name: Analyze (${{ matrix.language }}) | ||
# Runner size impacts CodeQL analysis time. To learn more, please see: | ||
# - https://gh.io/recommended-hardware-resources-for-running-codeql | ||
# - https://gh.io/supported-runners-and-hardware-resources | ||
# - https://gh.io/using-larger-runners (GitHub.com only) | ||
# Consider using larger runners or machines with greater resources for possible analysis time improvements. | ||
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} | ||
permissions: | ||
# required for all workflows | ||
security-events: write | ||
|
||
# required to fetch internal or private CodeQL packs | ||
packages: read | ||
|
||
# only required for workflows in private repositories | ||
actions: read | ||
contents: read | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- language: javascript-typescript | ||
build-mode: none | ||
- language: python | ||
build-mode: none | ||
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' | ||
# Use `c-cpp` to analyze code written in C, C++ or both | ||
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both | ||
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both | ||
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis, | ||
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning. | ||
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how | ||
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
# Initializes the CodeQL tools for scanning. | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v3 | ||
with: | ||
languages: ${{ matrix.language }} | ||
build-mode: ${{ matrix.build-mode }} | ||
# If you wish to specify custom queries, you can do so here or in a config file. | ||
# By default, queries listed here will override any specified in a config file. | ||
# Prefix the list here with "+" to use these queries and those in the config file. | ||
|
||
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs | ||
# queries: security-extended,security-and-quality | ||
|
||
# If the analyze step fails for one of the languages you are analyzing with | ||
# "We were unable to automatically build your code", modify the matrix above | ||
# to set the build mode to "manual" for that language. Then modify this step | ||
# to build your code. | ||
# ℹ️ Command-line programs to run using the OS shell. | ||
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun | ||
- if: matrix.build-mode == 'manual' | ||
shell: bash | ||
run: | | ||
echo 'If you are using a "manual" build mode for one or more of the' \ | ||
'languages you are analyzing, replace this with the commands to build' \ | ||
'your code, for example:' | ||
echo ' make bootstrap' | ||
echo ' make release' | ||
exit 1 | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v3 | ||
with: | ||
category: "/language:${{matrix.language}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Pylint | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
- name: Analysing the code with pylint | ||
run: | | ||
pylint $(git ls-files '*.py') |
Oops, something went wrong.