diff --git a/.github/workflows/jenkins-deploy.yml b/.github/workflows/jenkins-deploy.yml index e2eb589..b8feb07 100644 --- a/.github/workflows/jenkins-deploy.yml +++ b/.github/workflows/jenkins-deploy.yml @@ -1,16 +1,19 @@ name: Deploy on server on: workflow_dispatch: + workflow_run: + workflows: [Build and push Docker image] + types: + - completed + 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: ${{ env.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 diff --git a/Jenkinsfile b/Jenkinsfile index 987ea24..01539aa 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' ) ]) { @@ -28,9 +28,4 @@ pipeline { } } } - post { - always { - sleep 5 - } - } } 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"