From 36f513720254b2541257c19454887d50cc921288 Mon Sep 17 00:00:00 2001 From: KAUSHAL KISHORE <59508627+kaushalacts@users.noreply.github.com> Date: Sun, 23 Mar 2025 04:20:44 +0530 Subject: [PATCH 1/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b205f1c..12431ac 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,4 @@ Configuring Jenkins and Docker. Three jobs : test-build-deploy. SonarQube Creating new ocker Image and pushing on dockerhub. +Using docker compose to run multi containers. From 54b7195dd844f8a229b74f80820d1a56722ca857 Mon Sep 17 00:00:00 2001 From: KAUSHAL KISHORE <59508627+kaushalacts@users.noreply.github.com> Date: Sun, 23 Mar 2025 04:31:50 +0530 Subject: [PATCH 2/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 12431ac..0a0ab59 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,4 @@ Three jobs : test-build-deploy. SonarQube Creating new ocker Image and pushing on dockerhub. Using docker compose to run multi containers. +Let me give it a new try. From cafc62fe4cd78ab3660edc0f8892902d85b28fd5 Mon Sep 17 00:00:00 2001 From: KAUSHAL KISHORE <59508627+kaushalacts@users.noreply.github.com> Date: Sun, 23 Mar 2025 04:37:30 +0530 Subject: [PATCH 3/8] Update python-app.yml --- .github/workflows/python-app.yml | 56 +++++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 90d44cd..e6ddfe2 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -1,32 +1,33 @@ -# This workflow will install Python dependencies, run tests and lint with a single version of Python +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Python application +name: Python package on: - # push: - # branches: [ "main" ] + # push: + # branches: [ "main" ] pull_request: branches: [ "main" ] -permissions: - contents: read - jobs: - build: + build-and-test-python-app: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v3 with: - python-version: "3.10" + python-version: ${{ matrix.python-version }} - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest + python -m pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint with flake8 run: | @@ -37,6 +38,7 @@ jobs: - name: Test with pytest run: | pytest + sonarqube-scanner: name: Build and analyze runs-on: ubuntu-latest @@ -45,13 +47,35 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis - - uses: SonarSource/sonarqube-scan-action@v4 + - uses: sonarsource/sonarqube-scan-action@v4 env: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} # If you wish to fail your job when the Quality Gate is red, uncomment the # following lines. This would typically be used to fail a deployment. - # - uses: SonarSource/sonarqube-quality-gate-action@v1 - # timeout-minutes: 5 - # env: - # SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - uses: sonarsource/sonarqube-quality-gate-action@v1 + timeout-minutes: 5 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + docker-build-and-push-to-dockerhub: + runs-on: ubuntu-latest + needs: [build-and-test-python-app, sonarqube-scanner ] + steps: + - name: Docker Setup QEMU + uses: docker/setup-qemu-action@v3.0.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + tags: thehiddenboy143/gfgdevops20flask:latest From f902274e20eeb7fadeb3d679c94038e204095405 Mon Sep 17 00:00:00 2001 From: KAUSHAL KISHORE <59508627+kaushalacts@users.noreply.github.com> Date: Sun, 23 Mar 2025 04:42:52 +0530 Subject: [PATCH 4/8] Update app.py --- app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.py b/app.py index e3ca38c..e9ad4de 100644 --- a/app.py +++ b/app.py @@ -6,7 +6,7 @@ def create_app(): app = Flask(__name__) @app.route('/') def home(): - return 'Hey Guys ! This is my python App1' + return 'Hey Guys ! This is my python App12' return app From 08108acf7fbc972cd4cc923f715cf2cfab723303 Mon Sep 17 00:00:00 2001 From: KAUSHAL KISHORE <59508627+kaushalacts@users.noreply.github.com> Date: Sun, 23 Mar 2025 04:43:06 +0530 Subject: [PATCH 5/8] Update test_app.py --- test_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_app.py b/test_app.py index c2f4341..20673e9 100644 --- a/test_app.py +++ b/test_app.py @@ -15,6 +15,6 @@ def client(app): def test_home(client): response = client.get('/') assert response.status_code == 200 - expected_text = 'Hey Guys ! This is my python App1' + expected_text = 'Hey Guys ! This is my python App12' print(response.data) assert expected_text.encode() == response.data From b1dd17bb997d79a074b4937efef00b38eec629b2 Mon Sep 17 00:00:00 2001 From: KAUSHAL KISHORE <59508627+kaushalacts@users.noreply.github.com> Date: Sun, 23 Mar 2025 04:50:51 +0530 Subject: [PATCH 6/8] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0a0ab59..2daa30b 100644 --- a/README.md +++ b/README.md @@ -5,4 +5,4 @@ Three jobs : test-build-deploy. SonarQube Creating new ocker Image and pushing on dockerhub. Using docker compose to run multi containers. -Let me give it a new try. +Final touch From 69c98872bec629a413c0ba17db92d2da6470ce92 Mon Sep 17 00:00:00 2001 From: KAUSHAL KISHORE <59508627+kaushalacts@users.noreply.github.com> Date: Sun, 23 Mar 2025 04:54:48 +0530 Subject: [PATCH 7/8] Update sonar-project.properties --- sonar-project.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sonar-project.properties b/sonar-project.properties index a5d6f43..0da621b 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,3 +1,3 @@ sonar.projectKey=gfg20pythonci-cd -sonar.ws.timeout=600 + From c47d437604d6a030dd443e551c65fba6d1ee7dfb Mon Sep 17 00:00:00 2001 From: KAUSHAL KISHORE <59508627+kaushalacts@users.noreply.github.com> Date: Sun, 23 Mar 2025 04:55:10 +0530 Subject: [PATCH 8/8] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2daa30b..e954aec 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,4 @@ SonarQube Creating new ocker Image and pushing on dockerhub. Using docker compose to run multi containers. Final touch +Once Again