From 69981b1cdffff181258c06bebe2dd438160326ea Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Mon, 9 Jun 2025 13:43:57 +0300 Subject: [PATCH 1/8] fix name --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 987ea24..aaa0ed2 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { steps { withCredentials([ sshUserPrivateKey( - credentialsId: '${{ secrets.JENKINS_CREDS_ID }}', + credentialsId: ${{ secrets.JENKINS_CREDS_ID }}, keyFileVariable: 'SSH_PRIVATE_KEY' ) ]) { From e1885a81e1eee65544b97e41a73317d91810b51a Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Mon, 9 Jun 2025 13:44:17 +0300 Subject: [PATCH 2/8] some fix --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index aaa0ed2..4891947 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { steps { withCredentials([ sshUserPrivateKey( - credentialsId: ${{ secrets.JENKINS_CREDS_ID }}, + credentialsId: '73d234d2-3f9d-44e9-97fc-b6317070b462', keyFileVariable: 'SSH_PRIVATE_KEY' ) ]) { From 75d495cd688676fdbb259958cf7adc93699ece1b Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Mon, 9 Jun 2025 13:49:55 +0300 Subject: [PATCH 3/8] remove post job --- Jenkinsfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 4891947..01539aa 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -28,9 +28,4 @@ pipeline { } } } - post { - always { - sleep 5 - } - } } From 1626ab24dcdb95387363bde40c3686b3196b87f5 Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Mon, 9 Jun 2025 14:07:09 +0300 Subject: [PATCH 4/8] add restart rule --- compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/compose.yaml b/compose.yaml index ddb62be..d724770 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,6 +1,7 @@ services: django-app: image: wtukatyr/django-example-app:latest + restart: unless-stopped container_name: django-app ports: - "8989:8000" From ddb90287a7b5a5a288b9db03ec7ba99ad84ab183 Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Mon, 9 Jun 2025 15:03:22 +0300 Subject: [PATCH 5/8] rename job --- .github/workflows/jenkins-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jenkins-deploy.yml b/.github/workflows/jenkins-deploy.yml index e2eb589..44759c1 100644 --- a/.github/workflows/jenkins-deploy.yml +++ b/.github/workflows/jenkins-deploy.yml @@ -13,4 +13,4 @@ jobs: url: "http://ci.saccada.xyz" user: ${{ env.JENKINS_USERNAME }} token: ${{ secrets.JENKINS_TOKEN }} - job: "Deploy Django application" + job: "deploy-django-application" From 29d0419e1df753642e39ea043985c1339a496acb Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Mon, 9 Jun 2025 15:06:21 +0300 Subject: [PATCH 6/8] test vars variable --- .github/workflows/jenkins-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/jenkins-deploy.yml b/.github/workflows/jenkins-deploy.yml index 44759c1..1aeaefa 100644 --- a/.github/workflows/jenkins-deploy.yml +++ b/.github/workflows/jenkins-deploy.yml @@ -11,6 +11,6 @@ jobs: uses: appleboy/jenkins-action@master with: url: "http://ci.saccada.xyz" - user: ${{ env.JENKINS_USERNAME }} + user: ${{ vars.JENKINS_USERNAME }} token: ${{ secrets.JENKINS_TOKEN }} job: "deploy-django-application" From f7aeb77c007424baea916f52cdd28f500c845725 Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Mon, 9 Jun 2025 15:17:11 +0300 Subject: [PATCH 7/8] deploy with curl --- .github/workflows/jenkins-deploy.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/jenkins-deploy.yml b/.github/workflows/jenkins-deploy.yml index 1aeaefa..712e879 100644 --- a/.github/workflows/jenkins-deploy.yml +++ b/.github/workflows/jenkins-deploy.yml @@ -4,13 +4,11 @@ on: jobs: Deploy: - name: Deploy + name: Trigger Jenkins pipeline by cURL runs-on: ubuntu-latest steps: - name: Trigger Jenkins jobs - uses: appleboy/jenkins-action@master - with: - url: "http://ci.saccada.xyz" - user: ${{ vars.JENKINS_USERNAME }} - token: ${{ secrets.JENKINS_TOKEN }} - job: "deploy-django-application" + run: | + curl -X POST -I \ + -u ${{ vars.JENKINS_USERNAME }}:${{ secrets.JENKINS_TOKEN }} \ + https://ci.saccada.xyz//job/deploy-django-application/build From 5c92e2fd8298911738660c0e6ff3cc0b000efe98 Mon Sep 17 00:00:00 2001 From: Basyrov Rustam Date: Mon, 9 Jun 2025 15:23:12 +0300 Subject: [PATCH 8/8] add rule --- .github/workflows/jenkins-deploy.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/jenkins-deploy.yml b/.github/workflows/jenkins-deploy.yml index 712e879..b8feb07 100644 --- a/.github/workflows/jenkins-deploy.yml +++ b/.github/workflows/jenkins-deploy.yml @@ -1,6 +1,11 @@ name: Deploy on server on: workflow_dispatch: + workflow_run: + workflows: [Build and push Docker image] + types: + - completed + jobs: Deploy: