From c89f137fe9dc11d3a05b846cec5cd2848cc9ff66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=A9o=20M=C3=A9vollon?= <38255502+matmut7@users.noreply.github.com> Date: Mon, 31 Jul 2023 18:33:03 +0200 Subject: [PATCH 1/3] s3-client image draft (#1028) --- .github/workflows/s3-client.tag.yaml | 23 +++++++++++++++ .github/workflows/s3-client.yaml | 31 ++++++++++++++++++++ package.json | 3 +- s3-client/.editorconfig | 10 +++++++ s3-client/.gitignore | 11 +++++++ s3-client/CHANGELOG.md | 0 s3-client/Dockerfile | 20 +++++++++++++ s3-client/README.md | 3 ++ s3-client/package.json | 11 +++++++ s3-client/tests/container-structure-test.yml | 11 +++++++ yarn.lock | 6 ++++ 11 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/s3-client.tag.yaml create mode 100644 .github/workflows/s3-client.yaml create mode 100644 s3-client/.editorconfig create mode 100644 s3-client/.gitignore create mode 100644 s3-client/CHANGELOG.md create mode 100644 s3-client/Dockerfile create mode 100644 s3-client/README.md create mode 100644 s3-client/package.json create mode 100644 s3-client/tests/container-structure-test.yml diff --git a/.github/workflows/s3-client.tag.yaml b/.github/workflows/s3-client.tag.yaml new file mode 100644 index 000000000..15c438d07 --- /dev/null +++ b/.github/workflows/s3-client.tag.yaml @@ -0,0 +1,23 @@ +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event.ref }}-${{ github.event_name }} +jobs: + build: + uses: ./.github/workflows/workflow.build.yaml + secrets: inherit + with: + name: s3-client + + version_test: + container: "docker://ghcr.io/socialgouv/docker/s3-client:sha-${{ github.sha }}" + name: Test Version + needs: [build] + runs-on: ubuntu-latest + steps: + - run: aws --version + +name: "s3-client" +on: + push: + tags: + - "s3-client@**" diff --git a/.github/workflows/s3-client.yaml b/.github/workflows/s3-client.yaml new file mode 100644 index 000000000..19e8ef194 --- /dev/null +++ b/.github/workflows/s3-client.yaml @@ -0,0 +1,31 @@ +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event.ref }}-${{ github.event_name }} +jobs: + build: + uses: ./.github/workflows/workflow.build.yaml + secrets: inherit + with: + name: s3-client + + version_test: + container: "docker://ghcr.io/socialgouv/docker/s3-client:sha-${{ github.sha }}" + name: Test Version + needs: [build] + runs-on: ubuntu-latest + steps: + - run: aws --version + +name: "s3-client" +on: + push: + branches: + - "**" + - "!master" + - "!alpha" + - "!beta" + paths: + - "s3-client/**" + - ".github/workflows/s3-client.yaml" + - ".github/workflows/s3-client.tag.yaml" + - ".github/workflows/workflow.build.yaml" diff --git a/package.json b/package.json index 5fe9991de..8d300e92c 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "wait-for-postgres", "datasette", "git", - "check-cluster-images" + "check-cluster-images", + "s3-client" ], "packageManager": "yarn@3.5.1", "private": true diff --git a/s3-client/.editorconfig b/s3-client/.editorconfig new file mode 100644 index 000000000..1ed453a37 --- /dev/null +++ b/s3-client/.editorconfig @@ -0,0 +1,10 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.{js,json,yml}] +charset = utf-8 +indent_style = space +indent_size = 2 diff --git a/s3-client/.gitignore b/s3-client/.gitignore new file mode 100644 index 000000000..8410b55f1 --- /dev/null +++ b/s3-client/.gitignore @@ -0,0 +1,11 @@ +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions + +# Swap the comments on the following lines if you don't wish to use zero-installs +# Documentation here: https://yarnpkg.com/features/zero-installs +!.yarn/cache +#.pnp.* diff --git a/s3-client/CHANGELOG.md b/s3-client/CHANGELOG.md new file mode 100644 index 000000000..e69de29bb diff --git a/s3-client/Dockerfile b/s3-client/Dockerfile new file mode 100644 index 000000000..496f3bfbd --- /dev/null +++ b/s3-client/Dockerfile @@ -0,0 +1,20 @@ +ARG UBUNTU_VERSION=22.04 +FROM ubuntu:$UBUNTU_VERSION + +# hadolint ignore=DL3008 +RUN apt-get update && \ + apt-get install -yq --no-install-recommends \ + ca-certificates \ + curl \ + unzip \ + postgresql-client \ + && rm -rf /var/lib/apt/lists/* + +RUN groupadd -g 1001 ubuntu && useradd -rm -d /home/ubuntu -s /bin/bash -g ubuntu -G sudo -u 1001 ubuntu +ENV HOME=/home/ubuntu + +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ + unzip awscliv2.zip && \ + ./aws/install + +USER 1001 diff --git a/s3-client/README.md b/s3-client/README.md new file mode 100644 index 000000000..2a3ea27f8 --- /dev/null +++ b/s3-client/README.md @@ -0,0 +1,3 @@ +# s3-client + +Image with `psql` and `awscli` diff --git a/s3-client/package.json b/s3-client/package.json new file mode 100644 index 000000000..6208ce0ff --- /dev/null +++ b/s3-client/package.json @@ -0,0 +1,11 @@ +{ + "name": "s3-client", + "packageManager": "yarn@3.5.1", + "scripts": { + "build": "docker build -t ${SG_DOCKER_IMAGE:-'socialgouv_docker_psql'} .", + "test": "yarn test:e2e && yarn test:structure", + "test:e2e": "$(yarn bin:bats) tests/*", + "test:structure": "$(yarn bin:container-structure-test) test --image ${SG_DOCKER_IMAGE:-'socialgouv_docker_psql'} --config tests/container-structure-test.yml -v debug" + }, + "private": true +} diff --git a/s3-client/tests/container-structure-test.yml b/s3-client/tests/container-structure-test.yml new file mode 100644 index 000000000..3e22be47b --- /dev/null +++ b/s3-client/tests/container-structure-test.yml @@ -0,0 +1,11 @@ +schemaVersion: "2.0.0" + +commandTests: + - name: "psql version" + command: "psql" + args: ["--version"] + expectedOutput: ["psql \\(PostgreSQL\\) \\d+\\.\\d+"] + - name: "aws version" + command: "aws" + args: ["--version"] + expectedOutput: ["aws-cli.*"] diff --git a/yarn.lock b/yarn.lock index 2a2893644..e2a926413 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5100,6 +5100,12 @@ __metadata: languageName: node linkType: hard +"s3-client@workspace:s3-client": + version: 0.0.0-use.local + resolution: "s3-client@workspace:s3-client" + languageName: unknown + linkType: soft + "safe-buffer@npm:~5.1.0, safe-buffer@npm:~5.1.1": version: 5.1.2 resolution: "safe-buffer@npm:5.1.2" From f793a870c3e6ea571b3ed00700fe8368eff0f4a5 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Mon, 31 Jul 2023 18:36:41 +0200 Subject: [PATCH 2/3] chore: schedule on weekends --- .github/renovate.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/renovate.json b/.github/renovate.json index bdf4fd060..f1c71931c 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -1,7 +1,8 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", "extends": ["github>SocialGouv/renovate-config"], - "stabilityDays": 3, + "minimumReleaseAge": 3, + "schedule": "every weekend", "packageRules": [ { "matchDatasources": ["docker", "github-tags", "github-releases", "repology"], From a23b7c0ac7d781ec5762ec0e3a95cf52e25a4b14 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Mon, 31 Jul 2023 18:37:38 +0200 Subject: [PATCH 3/3] Update renovate.json --- .github/renovate.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/renovate.json b/.github/renovate.json index f1c71931c..29e861995 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -3,6 +3,7 @@ "extends": ["github>SocialGouv/renovate-config"], "minimumReleaseAge": 3, "schedule": "every weekend", + "rebaseWhen": "conflicted", "packageRules": [ { "matchDatasources": ["docker", "github-tags", "github-releases", "repology"],