From 48b129d89c38cf66794113aea4604bbe5b21a44a Mon Sep 17 00:00:00 2001 From: Baja-KS Date: Tue, 27 Aug 2024 13:59:56 +0200 Subject: [PATCH 1/4] refactor ci --- .github/workflows/merge.yaml | 21 ++++++++++++++++----- .github/workflows/pr.yaml | 12 +++++++----- backend/Dockerfile | 2 +- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index c00ff07..df24d79 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -19,6 +19,7 @@ env: jobs: check-build-deploy: strategy: + fail-fast: false matrix: include: - workdir: ./backend @@ -109,9 +110,10 @@ jobs: context: ${{ matrix.workdir }} file: ${{ matrix.dockerfile }} tags: ${{ steps.image_lowercase.outputs.lowercase }}:${{ env.TAG }} - load: true + load: false cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache + outputs: type=docker,dest=/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar - name: Login to GHCR uses: docker/login-action@v2 @@ -123,20 +125,29 @@ jobs: - name: Scan Docker image with Dockle id: dockle run: | - wget https://github.com/goodwithtech/dockle/releases/download/v0.4.14/dockle_0.4.14_Linux-64bit.tar.gz - tar zxvf dockle_0.4.14_Linux-64bit.tar.gz + wget -q https://github.com/goodwithtech/dockle/releases/download/v0.4.14/dockle_0.4.14_Linux-64bit.tar.gz + tar zxf dockle_0.4.14_Linux-64bit.tar.gz sudo mv dockle /usr/local/bin - dockle --exit-level fatal --format json --output ${{ matrix.workdir }}/dockle_scan_output.json ${{ steps.image_lowercase.outputs.lowercase }}:${{ env.TAG }} - echo " dockle exited w/ $?" + dockle --exit-code 1 --exit-level fatal --format json --input '/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar' --output ${{ matrix.workdir }}/dockle_scan_output.json cat ${{ matrix.workdir }}/dockle_scan_output.json echo "outcome=success" >> $GITHUB_OUTPUT - name: Push Docker image to GHCR run: | + docker load -i '/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar' + rm -rf '/tmp/image-${{ matrix.name }}-${{ env.ENVIRONMENT }}.tar' docker push ${{ steps.image_lowercase.outputs.lowercase }}:${{ env.TAG }} + - name: Add tag as a PR comment + uses: ubie-oss/comment-to-merged-pr-action@v0.3.3 + id: comment-to-merged-pr + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + message: |- + This PR is in the tag: ${{ env.TAG }} , for ${{ matrix.name }} service + - name: Deploy with Qovery if: github.ref == 'refs/heads/dev' env: diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 933e857..89b7f2c 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -16,6 +16,7 @@ permissions: jobs: static-checks: strategy: + fail-fast: false matrix: include: - workdir: ./backend @@ -96,19 +97,20 @@ jobs: context: ${{ matrix.workdir }} file: ${{ matrix.dockerfile }} tags: ${{ steps.image_lowercase.outputs.lowercase }}:${{ github.sha }} - load: true + load: false cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache + outputs: type=docker,dest=/tmp/image-${{ matrix.name }}-${{ github.sha }}-pr.tar - name: Scan Docker image with Dockle id: dockle run: | - wget https://github.com/goodwithtech/dockle/releases/download/v0.4.14/dockle_0.4.14_Linux-64bit.tar.gz - tar zxvf dockle_0.4.14_Linux-64bit.tar.gz + wget -q https://github.com/goodwithtech/dockle/releases/download/v0.4.14/dockle_0.4.14_Linux-64bit.tar.gz + tar zxf dockle_0.4.14_Linux-64bit.tar.gz sudo mv dockle /usr/local/bin - dockle --exit-level fatal --format json --output ${{ matrix.workdir }}/dockle_scan_output.json ${{ steps.image_lowercase.outputs.lowercase }}:${{ github.sha }} - echo " dockle exited w/ $?" + dockle --exit-code 1 --exit-level fatal --format json --input '/tmp/image-${{ matrix.name }}-${{ github.sha }}-pr.tar' --output ${{ matrix.workdir }}/dockle_scan_output.json + rm -rf '/tmp/image-${{ matrix.name }}-${{ github.sha }}-pr.tar' cat ${{ matrix.workdir }}/dockle_scan_output.json echo "outcome=success" >> $GITHUB_OUTPUT diff --git a/backend/Dockerfile b/backend/Dockerfile index 9f3f5a3..9144d5b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,6 +1,6 @@ # path: ./Dockerfile FROM node:alpine -RUN apk update && apk add build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev +RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev ARG NODE_ENV=development ENV NODE_ENV=${NODE_ENV} WORKDIR /opt/ From 794d95ede8e696f163b98024b08e484b89251c93 Mon Sep 17 00:00:00 2001 From: Vukasin Paunovic Date: Wed, 28 Aug 2024 09:22:29 +0200 Subject: [PATCH 2/4] chore: change dockerfile argument --- backend/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 9f3f5a3..0dc6da6 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,7 +1,7 @@ # path: ./Dockerfile FROM node:alpine RUN apk update && apk add build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev -ARG NODE_ENV=development +ARG NODE_ENV=production ENV NODE_ENV=${NODE_ENV} WORKDIR /opt/ COPY ./package*.json ./ @@ -11,4 +11,4 @@ WORKDIR /opt/app COPY ./ . RUN npm run build EXPOSE 1337 -CMD ["npm", "run", "develop"] +CMD ["npm", "run", "start"] From f33da2a8e95cc52bc7e87307d5387181a20d8df4 Mon Sep 17 00:00:00 2001 From: Vukasin Paunovic Date: Wed, 28 Aug 2024 09:55:51 +0200 Subject: [PATCH 3/4] feat: change abstract, motivation, rationale, name maxlength --- .../proposal-content/schema.json | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/backend/src/api/proposal-content/content-types/proposal-content/schema.json b/backend/src/api/proposal-content/content-types/proposal-content/schema.json index f8f298e..da764da 100644 --- a/backend/src/api/proposal-content/content-types/proposal-content/schema.json +++ b/backend/src/api/proposal-content/content-types/proposal-content/schema.json @@ -20,25 +20,25 @@ "default": false }, "prop_abstract": { - "type": "text", - "maxLength": 256 - }, + "type": "text", + "maxLength": 2500 + }, "prop_motivation": { - "type": "text", - "maxLength": 256 - }, + "type": "text", + "maxLength": 12000 + }, "prop_rationale": { - "type": "text", - "maxLength": 256 - }, + "type": "text", + "maxLength": 12000 + }, "gov_action_type_id": { "type": "string" }, "prop_name": { - "type": "string", - "required": true, - "maxLength": 60 - }, + "type": "string", + "required": true, + "maxLength": 80 + }, "prop_receiving_address": { "type": "string", "required": false, From 5a86ecd4430f698f6f3e2b8bef3d5d418e6f4271 Mon Sep 17 00:00:00 2001 From: Vukasin Paunovic Date: Wed, 28 Aug 2024 10:00:34 +0200 Subject: [PATCH 4/4] refactor: change node_env to production in dockerfile --- backend/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index 4b15f75..10e1b4b 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,7 +1,7 @@ # path: ./Dockerfile FROM node:alpine RUN apk update && apk add --no-cache build-base gcc autoconf automake zlib-dev libpng-dev nasm bash vips-dev -ARG NODE_ENV=development +ARG NODE_ENV=production ENV NODE_ENV=${NODE_ENV} WORKDIR /opt/ COPY ./package*.json ./