From 928bbce6e7fce0dadaa188d8cac0d596806457ab Mon Sep 17 00:00:00 2001 From: selimyanat Date: Fri, 28 Mar 2025 17:53:06 +0100 Subject: [PATCH 1/4] fix cd pipeline --- .github/workflows/cd.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 485c19a..0444604 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -2,16 +2,16 @@ name: Tiny-URL-CD-Pipeline on: workflow_run: - workflows: ["Tiny-URL-CI-Pipeline"] # must match `name:` in ci.yml + workflows: ["Tiny-URL-CI-Pipeline"] types: - completed - workflow_dispatch: + workflow_dispatch: {} jobs: build-docker-images: - #if: > - # github.event.workflow_run.conclusion == 'success' && - #github.event.workflow_run.head_branch == 'main' + if: > + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.head_branch == 'main' runs-on: ubuntu-latest steps: @@ -20,6 +20,10 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 + with: + driver: docker-container + buildkitd-flags: --debug + use: true - name: Cache Docker layers uses: actions/cache@v3 @@ -31,18 +35,20 @@ jobs: - name: Build API Docker image run: | - docker build \ + docker buildx build \ --file api/Dockerfile \ --tag your-org/tinyurl-api:main \ --cache-from=type=local,src=/tmp/.buildx-cache \ --cache-to=type=local,dest=/tmp/.buildx-cache \ + --load \ ./api - name: Build Webapp Docker image run: | - docker build \ + docker buildx build \ --file webapp/Dockerfile \ --tag your-org/tinyurl-webapp:main \ --cache-from=type=local,src=/tmp/.buildx-cache \ --cache-to=type=local,dest=/tmp/.buildx-cache \ + --load \ ./webapp From c745eb9622fa29a15029b8d75554c5feceeb96c9 Mon Sep 17 00:00:00 2001 From: selimyanat Date: Fri, 28 Mar 2025 18:06:00 +0100 Subject: [PATCH 2/4] fix cd pipeline --- .github/workflows/cd.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0444604..64324b5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -23,7 +23,11 @@ jobs: with: driver: docker-container buildkitd-flags: --debug - use: true + + - name: Create and use a named Buildx builder + run: | + docker buildx create --use --name mybuilder || docker buildx use mybuilder + docker buildx inspect --bootstrap - name: Cache Docker layers uses: actions/cache@v3 @@ -36,6 +40,7 @@ jobs: - name: Build API Docker image run: | docker buildx build \ + --builder mybuilder \ --file api/Dockerfile \ --tag your-org/tinyurl-api:main \ --cache-from=type=local,src=/tmp/.buildx-cache \ @@ -46,9 +51,10 @@ jobs: - name: Build Webapp Docker image run: | docker buildx build \ + --builder mybuilder \ --file webapp/Dockerfile \ --tag your-org/tinyurl-webapp:main \ --cache-from=type=local,src=/tmp/.buildx-cache \ --cache-to=type=local,dest=/tmp/.buildx-cache \ --load \ - ./webapp + ./webapp \ No newline at end of file From 211de4bf807bddc34558bd9092de948844cd3ed9 Mon Sep 17 00:00:00 2001 From: selimyanat Date: Fri, 28 Mar 2025 18:15:00 +0100 Subject: [PATCH 3/4] fix cd pipeline --- .github/workflows/cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 64324b5..d143278 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -9,9 +9,9 @@ on: jobs: build-docker-images: - if: > - github.event.workflow_run.conclusion == 'success' && - github.event.workflow_run.head_branch == 'main' + #if: > + # github.event.workflow_run.conclusion == 'success' && + #github.event.workflow_run.head_branch == 'main' runs-on: ubuntu-latest steps: From d8674bc5908770707fa5200f985bd372da32b83a Mon Sep 17 00:00:00 2001 From: selimyanat Date: Fri, 28 Mar 2025 18:26:36 +0100 Subject: [PATCH 4/4] fix cd pipeline --- .github/workflows/cd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d143278..64324b5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -9,9 +9,9 @@ on: jobs: build-docker-images: - #if: > - # github.event.workflow_run.conclusion == 'success' && - #github.event.workflow_run.head_branch == 'main' + if: > + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.head_branch == 'main' runs-on: ubuntu-latest steps: