From d4b1dcb2d12d32b1c8a09794841233cdf41d5634 Mon Sep 17 00:00:00 2001 From: Anupam Date: Sun, 3 Aug 2025 02:50:15 +0530 Subject: [PATCH 1/4] chore: add vscode config --- .vscode/extensions.json | 5 +++++ .vscode/settings.json | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..ae7c2f6 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "EditorConfig.EditorConfig" + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..7b6db2d --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.insertFinalNewline": true, + "files.trimTrailingWhitespace": true, + "files.trimFinalNewlines": true +} From 6db44145998f12914a479c3ce17b40b07c6e7c7b Mon Sep 17 00:00:00 2001 From: Anupam Date: Sun, 3 Aug 2025 02:50:53 +0530 Subject: [PATCH 2/4] chore: update gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 89ddb8a..7ca583b 100644 --- a/.gitignore +++ b/.gitignore @@ -129,4 +129,4 @@ dmypy.json # Pyre type checker .pyre/ -.vscode +# .vscode From 6ba369206a1050774ae08dff18bbf5ae5a7579cd Mon Sep 17 00:00:00 2001 From: Anupam Date: Mon, 24 Nov 2025 16:16:41 +0530 Subject: [PATCH 3/4] feat: kzb-33 update code --- .azure-pipelines/build.yml | 81 ++++++++++++++++++++++++++++++++ .gitignore | 2 +- Dockerfile.tmp | 14 ------ Dockerfile.tst | 13 ++--- Jenkinsfile => build/Jenkinsfile | 0 build/gitlab-ci.yaml | 0 6 files changed, 87 insertions(+), 23 deletions(-) create mode 100644 .azure-pipelines/build.yml delete mode 100644 Dockerfile.tmp rename Jenkinsfile => build/Jenkinsfile (100%) create mode 100644 build/gitlab-ci.yaml diff --git a/.azure-pipelines/build.yml b/.azure-pipelines/build.yml new file mode 100644 index 0000000..2871a6e --- /dev/null +++ b/.azure-pipelines/build.yml @@ -0,0 +1,81 @@ +# Terraform pipeline to deploy infrastructure resourcse to azure cloud platform + +trigger: + branches: + include: + - main # Trigger the pipeline when code is merged into main + +pr: + branches: + include: + - main # Trigger the pipeline when a pull request targets the main branch + +pool: + name: azure-vms-pool + demands: + - agent.name -equals azure-windows-vm # To run on a specific agent in a pool + +variables: + subscriptionId: "51580edc-cdbf-4484-a549-ddd64f2264d6" + +stages: + - stage: infra_deployment + jobs: + - job: terraform_build + pool: + name: "azure-vms-pool" + demands: + - agent.name -equals azure-windows-vm + steps: + - task: TerraformInstaller@1 + displayName: intsall_terraform + inputs: + terraformVersion: "1.9.0" + + - task: PowerShell@2 + displayName: get_current_workspace + inputs: + targetType: "inline" + script: | + Write-Host "Pipeline workspace: $(System.DefaultWorkingDirectory)" + Write-Host "System Working Directory: $(System.DefaultWorkingDirectory)" + Write-Host "Current working directory content: $(dir)" + + - task: TerraformTaskV4@4 + displayName: run_tf_init + inputs: + workingDirectory: "$(System.DefaultWorkingDirectory)/terraform" + provider: "azurerm" + command: "custom" + customCommand: "init" + outputTo: "console" + environmentServiceNameAzureRM: "tf-azure-service-connection" + env: + ARM_SUBSCRIPTION_ID: $(subscriptionId) + + - task: TerraformTaskV4@4 + displayName: run_tf_plan + inputs: + workingDirectory: "$(System.DefaultWorkingDirectory)/terraform" + provider: "azurerm" + command: "custom" + customCommand: "plan" + commandOptions: "-out=tfplan" + outputTo: "console" + environmentServiceNameAzureRM: "tf-azure-service-connection" + env: + ARM_SUBSCRIPTION_ID: $(subscriptionId) + + - task: TerraformTaskV4@4 + displayName: run_tf_apply + condition: eq(variables['Build.SourceBranch'], 'refs/heads/main') + inputs: + workingDirectory: "$(System.DefaultWorkingDirectory)/terraform" + provider: "azurerm" + command: "custom" + customCommand: "apply" + commandOptions: "tfplan" + outputTo: "console" + environmentServiceNameAzureRM: "tf-azure-service-connection" + env: + ARM_SUBSCRIPTION_ID: $(subscriptionId) diff --git a/.gitignore b/.gitignore index 7ca583b..be3f68e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ mycompany_app/__pycache__/ # Distribution / packaging .Python -build/ +# build/ develop-eggs/ dist/ downloads/ diff --git a/Dockerfile.tmp b/Dockerfile.tmp deleted file mode 100644 index 0e1123c..0000000 --- a/Dockerfile.tmp +++ /dev/null @@ -1,14 +0,0 @@ -FROM ubuntu - -# Case-01 -CMD ["echo", "hello world"] - -# Case-02 -# ENTRYPOINT ["echo", "hello world"] - -# Case-03 -# ENTRYPOINT ["echo"] - -# Case-04 -# ENTRYPOINT ["echo"] -# CMD ["hello world"] diff --git a/Dockerfile.tst b/Dockerfile.tst index 97d4e69..e367448 100644 --- a/Dockerfile.tst +++ b/Dockerfile.tst @@ -21,12 +21,6 @@ ENV PYTHONUNBUFFERED=1 RUN whoami RUN groupadd --gid $GROUPID $GROUPNAME && useradd --uid $USERID --gid $GROUPID -m $USERNAME -# Install the tools required for the project -RUN apt-get update && apt-get install -y \ - python3 \ - python3-pip \ - python3-venv - # Copy requirements file and install all the required python packages WORKDIR /app COPY python/requirements.txt /app @@ -35,7 +29,10 @@ RUN pip install --no-cache-dir -r requirements.txt COPY python /app -# Change the user to newly created user +# Install curl +RUN apt-get update && apt-get install -y curl + +# Change the user to newly created user and run the processes as this user USER $USERNAME RUN whoami @@ -47,4 +44,4 @@ WORKDIR /app # Run the main application file on container startup ENTRYPOINT ["gunicorn"] -CMD ["--bind", "0.0.0.0:5001", "--workers", "1", "--threads", "8", "main:app"] +CMD ["--bind", "0.0.0.0:5001", "--workers", "1", "--threads", "8", "run:app"] diff --git a/Jenkinsfile b/build/Jenkinsfile similarity index 100% rename from Jenkinsfile rename to build/Jenkinsfile diff --git a/build/gitlab-ci.yaml b/build/gitlab-ci.yaml new file mode 100644 index 0000000..e69de29 From 710acafabdcc75b61f5155a4c7c8c7d90f542068 Mon Sep 17 00:00:00 2001 From: Anupam Date: Mon, 24 Nov 2025 16:18:02 +0530 Subject: [PATCH 4/4] build: kzb-33 update sonar properties --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index 8cf7ec6..85e67a3 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -5,7 +5,7 @@ # Configuration file should be placed in project's root directory with name sonar-project.properties sonar.organization=anupam-sy -sonar.projectKey=anupam-sy_mycompany-flask-app +sonar.projectKey=oneanupam_example-app # --- optional properties --- # Scope of analysis for non-test code. Path is relative to the sonar-project.properties file. Defaults to .