fix(ci): add auth token to git clone + consolidate steps
CI/CD Pipeline / Build & Deploy (push) Failing after 16s
CI/CD Pipeline / Build & Deploy (push) Failing after 16s
This commit is contained in:
@@ -9,36 +9,29 @@ jobs:
|
|||||||
name: Build & Deploy
|
name: Build & Deploy
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repo
|
- name: Checkout code
|
||||||
run: |
|
run: |
|
||||||
git clone --depth=1 --branch=main https://gitlab.impresion3d.pro/root/davidaragon-portfolio.git repo
|
git clone https://oauth2:${{ secrets.GITEA_TOKEN }}@gitlab.impresion3d.pro/root/davidaragon-portfolio.git repo
|
||||||
cd repo && ls -la
|
cd repo && git log -1 --oneline
|
||||||
|
|
||||||
- name: Build image with docker
|
- name: Build and push image
|
||||||
run: |
|
run: |
|
||||||
cd repo
|
cd repo
|
||||||
docker build -t gitlab.impresion3d.pro/root/davidaragon-portfolio:latest .
|
|
||||||
|
|
||||||
- name: Login to registry
|
|
||||||
run: |
|
|
||||||
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login gitlab.impresion3d.pro -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login gitlab.impresion3d.pro -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||||
|
docker build -t gitlab.impresion3d.pro/root/davidaragon-portfolio:latest .
|
||||||
- name: Push image
|
|
||||||
run: |
|
|
||||||
docker push gitlab.impresion3d.pro/root/davidaragon-portfolio:latest
|
docker push gitlab.impresion3d.pro/root/davidaragon-portfolio:latest
|
||||||
|
|
||||||
- name: Stop Portainer stack
|
- name: Deploy to Portainer
|
||||||
run: |
|
run: |
|
||||||
|
# Stop stack
|
||||||
curl -X POST "${{ secrets.PORTAINER_URL }}/api/stacks/${{ secrets.PORTAINER_STACK_ID }}/stop?endpointId=${{ secrets.PORTAINER_ENDPOINT_ID }}" \
|
curl -X POST "${{ secrets.PORTAINER_URL }}/api/stacks/${{ secrets.PORTAINER_STACK_ID }}/stop?endpointId=${{ secrets.PORTAINER_ENDPOINT_ID }}" \
|
||||||
-H "X-API-Key: ${{ secrets.PORTAINER_TOKEN }}"
|
-H "X-API-Key: ${{ secrets.PORTAINER_TOKEN }}"
|
||||||
sleep 5
|
sleep 5
|
||||||
|
|
||||||
- name: Pull fresh image
|
# Pull fresh image
|
||||||
run: |
|
|
||||||
curl -X POST "${{ secrets.PORTAINER_URL }}/api/endpoints/${{ secrets.PORTAINER_ENDPOINT_ID }}/docker/images/create?fromImage=gitlab.impresion3d.pro%2Froot%2Fdavidaragon-portfolio&tag=latest" \
|
curl -X POST "${{ secrets.PORTAINER_URL }}/api/endpoints/${{ secrets.PORTAINER_ENDPOINT_ID }}/docker/images/create?fromImage=gitlab.impresion3d.pro%2Froot%2Fdavidaragon-portfolio&tag=latest" \
|
||||||
-H "X-API-Key: ${{ secrets.PORTAINER_TOKEN }}"
|
-H "X-API-Key: ${{ secrets.PORTAINER_TOKEN }}"
|
||||||
|
|
||||||
- name: Start Portainer stack
|
# Start stack
|
||||||
run: |
|
|
||||||
curl -X POST "${{ secrets.PORTAINER_URL }}/api/stacks/${{ secrets.PORTAINER_STACK_ID }}/start?endpointId=${{ secrets.PORTAINER_ENDPOINT_ID }}" \
|
curl -X POST "${{ secrets.PORTAINER_URL }}/api/stacks/${{ secrets.PORTAINER_STACK_ID }}/start?endpointId=${{ secrets.PORTAINER_ENDPOINT_ID }}" \
|
||||||
-H "X-API-Key: ${{ secrets.PORTAINER_TOKEN }}"
|
-H "X-API-Key: ${{ secrets.PORTAINER_TOKEN }}"
|
||||||
|
|||||||
Reference in New Issue
Block a user