From f0fc011ceedb872404451f8919c99cc70b313b1f Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 11:01:09 +0700 Subject: [PATCH 01/64] Intitial empty branch From 9b3b4fc25d268f6b1ff510e77598729f2b91af69 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 11:20:20 +0700 Subject: [PATCH 02/64] ci (test): add testing ci file (#10) --- .github/workflows/continuous-integration.yml | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/continuous-integration.yml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..c99538c --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,27 @@ +name: Testing Continuous Integration +run-name: ${{ github.actor }} is testing Github Actions + +on: [push] + +jobs: + Explore-Github-Actions: + runs-on: ubuntu-latest + steps: + - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." + + - run: echo "This job is now running on a ${{ runner.os }} server hosted by Github." + + - run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." + + - name: Checkout repository code + uses: actions/checkout@v4 + + - run: echo "The ${{ github.repository }} repository has been cloned to the runner." + + - run: echo "The workflow is now ready to test your code on the runner." + + - name: List files in the repository + run: | + ls ${{ github.workspace }} + + - run: echo "This job's status is ${{ job.status }}." From 605a003b508444aa23210cc262678750677cf9d9 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 12:22:28 +0700 Subject: [PATCH 03/64] ci (test): test docker build+push image 1 (#10) --- .github/workflows/continuous-integration.yml | 43 +++++++++++++++++++- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c99538c..b91dbaf 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -3,8 +3,13 @@ run-name: ${{ github.actor }} is testing Github Actions on: [push] +env: + REGISTRY: ghcr.io + UPSTREAM_APP_IMAGE_NAME: upstream-app + KAFKA_CONNECT_IMAGE_NAME: kafka-connect + jobs: - Explore-Github-Actions: + Explore github actions: runs-on: ubuntu-latest steps: - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." @@ -22,6 +27,40 @@ jobs: - name: List files in the repository run: | - ls ${{ github.workspace }} + ls -lah ${{ github.workspace }} + + - run: echo "This job's status is ${{ job.status }}." + + Build and Push image to ghcr.io registry: + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository code + uses: actions/checkout@v4 + + - name: Login to the container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.UPSTREAM_APP_IMAGE_NAME }} + + - name: Build and push image + uses: docker/build-push-action@v5 + with: + context: . + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} - run: echo "This job's status is ${{ job.status }}." From cfa08dac028f6a35f19b5f82566fa766fb929ff5 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 12:24:51 +0700 Subject: [PATCH 04/64] ci (test): test docker build+push image 2 (#10) --- .github/workflows/continuous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index b91dbaf..ced313b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -9,7 +9,7 @@ env: KAFKA_CONNECT_IMAGE_NAME: kafka-connect jobs: - Explore github actions: + Explore-github-actions: runs-on: ubuntu-latest steps: - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." @@ -31,7 +31,7 @@ jobs: - run: echo "This job's status is ${{ job.status }}." - Build and Push image to ghcr.io registry: + Build-and-push-image-to-container-registry: runs-on: ubuntu-latest permissions: From 4e9e76b05a78897c9c9959f18da101745240d09d Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 13:12:17 +0700 Subject: [PATCH 05/64] ci (test): test docker build+push image 3 (#10) --- .docker/images/app/Dockerfile | 3 ++- .github/workflows/continuous-integration.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.docker/images/app/Dockerfile b/.docker/images/app/Dockerfile index c509ef1..42e21b4 100644 --- a/.docker/images/app/Dockerfile +++ b/.docker/images/app/Dockerfile @@ -1,7 +1,8 @@ FROM python:3.11-slim # Label for github packages -LABEL org.opencontainers.image.source https://github.com/lelouvincx/Chinh-Dinh-training +LABEL org.opencontainers.image.source=https://github.com/lelouvincx/Chinh-Dinh-training +LABEL org.opencontainers.image.description="Data generator (called upstream-app), generates data to source_db." WORKDIR /app diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index ced313b..e85bb3b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -59,7 +59,8 @@ jobs: uses: docker/build-push-action@v5 with: context: . - push: false + file: .docker/images/app/Dockerfile + push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From c66075d079e8584c72df3204c5ccd01ba9fddc73 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 13:47:58 +0700 Subject: [PATCH 06/64] ci (test): test check-change-upstream-app 1 (#10) --- .github/workflows/continuous-integration.yml | 28 +++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e85bb3b..e386d61 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -9,8 +9,8 @@ env: KAFKA_CONNECT_IMAGE_NAME: kafka-connect jobs: - Explore-github-actions: - runs-on: ubuntu-latest + explore-github-actions: + runs-on: ubuntu-22.04 steps: - run: echo "The job was automatically triggered by a ${{ github.event_name }} event." @@ -31,8 +31,25 @@ jobs: - run: echo "This job's status is ${{ job.status }}." - Build-and-push-image-to-container-registry: - runs-on: ubuntu-latest + check-changes-upstream-app: + runs-on: ubuntu-22.04 + outputs: + img: ${{ steps.changes.outputs.img }} + steps: + - name: Checkout repository code + uses: actions/checkout@v4 + + - name: Check changes + id: changes + with: + filters: | + img: + - ".docker/images/app/**" + + build-push-upstream-app: + needs: check-changes-upstream-app + if: ${{ needs.check-changes-upstream-app.outputs.img == 'true' }} + runs-on: ubuntu-22.04 permissions: contents: read @@ -42,6 +59,9 @@ jobs: - name: Checkout repository code uses: actions/checkout@v4 + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + - name: Login to the container registry uses: docker/login-action@v3 with: From 7cd7a259ecb91aa18f1cc337a9e171c970cbb031 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 13:49:32 +0700 Subject: [PATCH 07/64] ci (test): test check-change-upstream-app 2 (#10) --- .github/workflows/continuous-integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e386d61..802fa5f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -40,6 +40,7 @@ jobs: uses: actions/checkout@v4 - name: Check changes + uses: dorny/paths-filter@v2 id: changes with: filters: | From a259dee6071b15d7ddcf2e43d99f39854d8150ac Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 13:53:33 +0700 Subject: [PATCH 08/64] docs: add badge for CI into readme, also test check-change job --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9725893..e1b616d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Project: Database Replication +[![Testing Continuous Integration](https://github.com/lelouvincx/Chinh-Dinh-training/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/lelouvincx/Chinh-Dinh-training/actions/workflows/continuous-integration.yml) + - [Project: Database Replication](#project-database-replication) - [Tasks](#tasks) - [Local development guide](#local-development-guide) From f8b5be7c30721dc9870d28b9569fc319cd1e8f5e Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 13:59:09 +0700 Subject: [PATCH 09/64] ci (test): test check-change-upstream-app 3 (#10) --- .github/workflows/continuous-integration.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 802fa5f..f56c6fd 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -43,6 +43,8 @@ jobs: uses: dorny/paths-filter@v2 id: changes with: + base: ${{ github.ref }} + ref: ${{ github.ref }} filters: | img: - ".docker/images/app/**" From b3309726baec35d9e23b48427b455838ed4642c8 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 14:04:44 +0700 Subject: [PATCH 10/64] ci (test): test check-changes 4 (#10) --- .github/workflows/continuous-integration.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f56c6fd..35888b1 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -31,10 +31,11 @@ jobs: - run: echo "This job's status is ${{ job.status }}." - check-changes-upstream-app: + check-changes: runs-on: ubuntu-22.04 outputs: - img: ${{ steps.changes.outputs.img }} + upstream-app: ${{ steps.changes.outputs.upstream-app }} + kafka-connect: ${{ steps.changes.outputs.kafka-connect }} steps: - name: Checkout repository code uses: actions/checkout@v4 @@ -46,12 +47,14 @@ jobs: base: ${{ github.ref }} ref: ${{ github.ref }} filters: | - img: + upstream-app: - ".docker/images/app/**" + kafka-connect: + - ".docker/images/kafka-connect/**" build-push-upstream-app: - needs: check-changes-upstream-app - if: ${{ needs.check-changes-upstream-app.outputs.img == 'true' }} + needs: check-changes + if: ${{ needs.check-changes.outputs.upstream-app == 'true' }} runs-on: ubuntu-22.04 permissions: @@ -86,5 +89,3 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - - - run: echo "This job's status is ${{ job.status }}." From c5dc470309072fe2615992d5478f031ff62b941d Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 14:06:46 +0700 Subject: [PATCH 11/64] ci (test): test check-changes 5 (#10) --- .docker/images/kafka-connect/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.docker/images/kafka-connect/Dockerfile b/.docker/images/kafka-connect/Dockerfile index 813277e..01c2a99 100644 --- a/.docker/images/kafka-connect/Dockerfile +++ b/.docker/images/kafka-connect/Dockerfile @@ -1,7 +1,7 @@ FROM confluentinc/cp-server-connect:7.1.1 # Label for github packages -LABEL org.opencontainers.image.source https://github.com/lelouvincx/Chinh-Dinh-training +LABEL org.opencontainers.image.source=https://github.com/lelouvincx/Chinh-Dinh-training # Install debezium-connector-postgresql and kafka-connect-jdbc RUN echo "INFO: Installing Connectors" From 2ea91e7b064fcdbe2a84bb691ee30a5c48af42bc Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 14:09:58 +0700 Subject: [PATCH 12/64] ci (test): test build-push-kafka-connect 1 (#10) --- .docker/images/kafka-connect/Dockerfile | 1 + .github/workflows/continuous-integration.yml | 38 ++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/.docker/images/kafka-connect/Dockerfile b/.docker/images/kafka-connect/Dockerfile index 01c2a99..b6f642c 100644 --- a/.docker/images/kafka-connect/Dockerfile +++ b/.docker/images/kafka-connect/Dockerfile @@ -9,4 +9,5 @@ RUN confluent-hub install --no-prompt debezium/debezium-connector-postgresql:2.2 RUN confluent-hub install --no-prompt confluentinc/kafka-connect-jdbc:10.7.4 RUN echo "INFO: Launching Kafka Connect workers" + CMD [ "/etc/confluent/docker/run" ] diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 35888b1..96cc69a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -89,3 +89,41 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + build-push-kafka-connect: + needs: check-changes + if: ${{ needs.check-changes.outputs.kafka-connect == 'true' }} + runs-on: ubuntu-22.04 + + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository code + uses: actions/checkout@v4 + + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + + - name: Login to the container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.KAFKA_CONNECT_IMAGE_NAME }} + + - name: Build and push image + uses: docker/build-push-action@v5 + with: + context: . + file: .docker/images/kafka-connect/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 5ed80dc87b0055e3bf9cdc6a3d07ab072b41bded Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 14:24:17 +0700 Subject: [PATCH 13/64] ci (test): test env vars 1 --- .github/workflows/continuous-integration.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 96cc69a..d40f4d8 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -1,13 +1,16 @@ name: Testing Continuous Integration run-name: ${{ github.actor }} is testing Github Actions + on: [push] + env: REGISTRY: ghcr.io UPSTREAM_APP_IMAGE_NAME: upstream-app KAFKA_CONNECT_IMAGE_NAME: kafka-connect + jobs: explore-github-actions: runs-on: ubuntu-22.04 @@ -25,6 +28,9 @@ jobs: - run: echo "The workflow is now ready to test your code on the runner." + - name: View environment variables + run: printenv + - name: List files in the repository run: | ls -lah ${{ github.workspace }} @@ -33,9 +39,11 @@ jobs: check-changes: runs-on: ubuntu-22.04 + outputs: upstream-app: ${{ steps.changes.outputs.upstream-app }} kafka-connect: ${{ steps.changes.outputs.kafka-connect }} + steps: - name: Checkout repository code uses: actions/checkout@v4 From bf1783849b2c55486e2865436bd84d5c7f977cf9 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:01:42 +0700 Subject: [PATCH 14/64] ci (test): test env vars 2 --- .github/workflows/continuous-integration.yml | 37 +++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index d40f4d8..744361b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -5,10 +5,6 @@ run-name: ${{ github.actor }} is testing Github Actions on: [push] -env: - REGISTRY: ghcr.io - UPSTREAM_APP_IMAGE_NAME: upstream-app - KAFKA_CONNECT_IMAGE_NAME: kafka-connect jobs: @@ -65,6 +61,10 @@ jobs: if: ${{ needs.check-changes.outputs.upstream-app == 'true' }} runs-on: ubuntu-22.04 + env: + REGISTRY: ghcr.io + UPSTREAM_APP_IMAGE_NAME: upstream-app + permissions: contents: read packages: write @@ -103,6 +103,10 @@ jobs: if: ${{ needs.check-changes.outputs.kafka-connect == 'true' }} runs-on: ubuntu-22.04 + env: + REGISTRY: ghcr.io + KAFKA_CONNECT_IMAGE_NAME: kafka-connect + permissions: contents: read packages: write @@ -135,3 +139,28 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + + unit-test-upstream-app: + needs: build-push-upstream-app + runs-on: ubuntu-22.04 + + env: + POSTGRES_USER: ${{ vars.POSTGRES_USER }} + POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} + POSTGRES_DB: ${{ vars.POSTGRES_DB }} + POSTGRES_PORT: ${{ vars.POSTGRES_PORT }} + REGISTRY: ghcr.io + UPSTREAM_APP_IMAGE_NAME: upstream-app + + steps: + - name: Extract metadata (tags, labels) from existing docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.UPSTREAM_APP_IMAGE_NAME }} + + - name: Export image's tag + run: export TAG=${{ steps.meta.outputs.tags }} + + - name: View environment variables + run: printenv From eef66d8e17fa44128defc294bf75ebc8344a2532 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:05:54 +0700 Subject: [PATCH 15/64] ci (test): test env vars 3 --- .github/workflows/continuous-integration.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 744361b..c1ff4c0 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -142,6 +142,9 @@ jobs: unit-test-upstream-app: needs: build-push-upstream-app + if: | # Always run after build-push-upstream-app + always && + (needs.build-push-upstream-app.result == 'success' || needs.build-push-upstream-app.result == 'skipped') runs-on: ubuntu-22.04 env: From ec268ee20df3ae924f133884c2812182737c1dcf Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:07:09 +0700 Subject: [PATCH 16/64] ci (test): test env vars 4 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c1ff4c0..5cd7bbf 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -143,7 +143,7 @@ jobs: unit-test-upstream-app: needs: build-push-upstream-app if: | # Always run after build-push-upstream-app - always && + always() && (needs.build-push-upstream-app.result == 'success' || needs.build-push-upstream-app.result == 'skipped') runs-on: ubuntu-22.04 From 85471244277d4c3ab0f2a012071110f9fb7e6da2 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:21:25 +0700 Subject: [PATCH 17/64] ci (test): test env vars 5 --- .github/workflows/continuous-integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 5cd7bbf..5db438e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -148,7 +148,7 @@ jobs: runs-on: ubuntu-22.04 env: - POSTGRES_USER: ${{ vars.POSTGRES_USER }} + POSTGRES_USER: ${{ vars.development.POSTGRES_USER }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} POSTGRES_DB: ${{ vars.POSTGRES_DB }} POSTGRES_PORT: ${{ vars.POSTGRES_PORT }} @@ -162,8 +162,8 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.UPSTREAM_APP_IMAGE_NAME }} - - name: Export image's tag - run: export TAG=${{ steps.meta.outputs.tags }} + - name: Export image + run: export IMAGE_UPSTREAM_APP=${{ steps.meta.outputs.tags }} - name: View environment variables run: printenv From 7df5af556281a306256d2f335ca3a326bd002bc7 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:33:31 +0700 Subject: [PATCH 18/64] ci (test): test env vars 6 --- .github/workflows/continuous-integration.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 5db438e..42ddd2d 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -148,7 +148,7 @@ jobs: runs-on: ubuntu-22.04 env: - POSTGRES_USER: ${{ vars.development.POSTGRES_USER }} + POSTGRES_USER: ${{ secrets.POSTGRES_USER }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} POSTGRES_DB: ${{ vars.POSTGRES_DB }} POSTGRES_PORT: ${{ vars.POSTGRES_PORT }} @@ -162,8 +162,5 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.UPSTREAM_APP_IMAGE_NAME }} - - name: Export image - run: export IMAGE_UPSTREAM_APP=${{ steps.meta.outputs.tags }} - - name: View environment variables run: printenv From e0d9855fe190fd26a43a0c94c540284fa84818ad Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:39:46 +0700 Subject: [PATCH 19/64] ci (test): unit test 1 --- .github/workflows/continuous-integration.yml | 15 ++++++--- app/tests/docker-compose.yml | 33 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 app/tests/docker-compose.yml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 42ddd2d..dd073a5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -150,17 +150,24 @@ jobs: env: POSTGRES_USER: ${{ secrets.POSTGRES_USER }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} - POSTGRES_DB: ${{ vars.POSTGRES_DB }} - POSTGRES_PORT: ${{ vars.POSTGRES_PORT }} + POSTGRES_DB: ${{ secrets.POSTGRES_DB }} + POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} REGISTRY: ghcr.io UPSTREAM_APP_IMAGE_NAME: upstream-app steps: + - name: Checkout repository code + uses: actions/checkout@v4 + - name: Extract metadata (tags, labels) from existing docker id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.UPSTREAM_APP_IMAGE_NAME }} - - name: View environment variables - run: printenv + - name: Unit test + uses: cloudposse/github-action-docker-compose-test-run@v0.1.3 + with: + file: app/tests/docker-compose.yml + service: upstream-app + command: python -m pytest --log-cli-level info -p no:warnings -v /app/tests diff --git a/app/tests/docker-compose.yml b/app/tests/docker-compose.yml new file mode 100644 index 0000000..03781af --- /dev/null +++ b/app/tests/docker-compose.yml @@ -0,0 +1,33 @@ +version: "3.4" + +services: + source_db: + image: postgres:14-alpine + container_name: "source_db" + expose: + - "5432" + volumes: + - .docker/postgres-add-de-user.sh:/docker-entrypoint-initdb.d/postgres-add-de-user.sh + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_DB=${POSTGRES_DB} + - PGDATA=/var/lib/postgresql/pgdata + restart: unless-stopped + + upstream-app: + image: ${DOCKER_METADATA_OUTPUT_TAGS} + container_name: "upstream-app" + ports: + - "8501:8501" + volumes: + - ./app:/app + environment: + - POSTGRES_USER=${POSTGRES_USER} + - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} + - POSTGRES_HOST=source_db + - POSTGRES_PORT=${POSTGRES_PORT} + - POSTGRES_DB=${POSTGRES_DB} + restart: on-failure + depends_on: + - source_db From 5c55207d85fba81785d4f4a2d5326e348c3643c4 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:41:33 +0700 Subject: [PATCH 20/64] ci (test): unit test 2 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index dd073a5..b364d79 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -166,7 +166,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.UPSTREAM_APP_IMAGE_NAME }} - name: Unit test - uses: cloudposse/github-action-docker-compose-test-run@v0.1.3 + uses: cloudposse/github-action-docker-compose-test-run@main with: file: app/tests/docker-compose.yml service: upstream-app From b867320480348089260de71353c95c8348a58aba Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:45:11 +0700 Subject: [PATCH 21/64] ci (test): unit test 3 --- .github/workflows/continuous-integration.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index b364d79..516b4f2 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -147,6 +147,10 @@ jobs: (needs.build-push-upstream-app.result == 'success' || needs.build-push-upstream-app.result == 'skipped') runs-on: ubuntu-22.04 + permissions: + contents: read + packages: read + env: POSTGRES_USER: ${{ secrets.POSTGRES_USER }} POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} From 883962ee99697b20b60e0120a6f831f9d6e45d73 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:47:45 +0700 Subject: [PATCH 22/64] ci (test): unit test 4 --- .github/workflows/continuous-integration.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 516b4f2..eb7c6d8 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -163,6 +163,16 @@ jobs: - name: Checkout repository code uses: actions/checkout@v4 + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + + - name: Login to the container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) from existing docker id: meta uses: docker/metadata-action@v5 From 9a3f65c4ed2ae2b645ef39d216991c92003a5f5b Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 15:54:46 +0700 Subject: [PATCH 23/64] ci (test): unit test 5 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index eb7c6d8..8e8cf1f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -184,4 +184,4 @@ jobs: with: file: app/tests/docker-compose.yml service: upstream-app - command: python -m pytest --log-cli-level info -p no:warnings -v /app/tests + command: /usr/local/bin/python -m pytest --log-cli-level info -p no:warnings -v /app/tests From cbaf3593bc12547eecfcb2c8bfe56c9c6dc4ab8c Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 16:04:42 +0700 Subject: [PATCH 24/64] ci (test): unit test 6 --- .github/workflows/continuous-integration.yml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8e8cf1f..0027c60 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -5,8 +5,6 @@ run-name: ${{ github.actor }} is testing Github Actions on: [push] - - jobs: explore-github-actions: runs-on: ubuntu-22.04 @@ -163,25 +161,22 @@ jobs: - name: Checkout repository code uses: actions/checkout@v4 - - name: Setup QEMU - uses: docker/setup-qemu-action@v3 - - - name: Login to the container registry - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) from existing docker id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.UPSTREAM_APP_IMAGE_NAME }} + - name: View the environment variables + run: printenv + - name: Unit test uses: cloudposse/github-action-docker-compose-test-run@main with: + login: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + registry: ${{ env.REGISTRY }} file: app/tests/docker-compose.yml service: upstream-app + entrypoint: /bin/bash command: /usr/local/bin/python -m pytest --log-cli-level info -p no:warnings -v /app/tests From 9f7d271002eda2feba30a94279d3fc7e1cb1f415 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 16:12:05 +0700 Subject: [PATCH 25/64] ci (test): unit test 7 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0027c60..aaf07d3 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: /usr/local/bin/python -m pytest --log-cli-level info -p no:warnings -v /app/tests + command: python -m pytest --log-cli-level info -p no:warnings -v /app/tests From a59b7742d415685b99311ef5a5e92fb8b5bc2c9f Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 16:18:41 +0700 Subject: [PATCH 26/64] ci (test): unit test 8 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index aaf07d3..8364bab 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: python -m pytest --log-cli-level info -p no:warnings -v /app/tests + command: which python From 8f8448cd51ea332778fb5e45bd7564425539087c Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 16:21:02 +0700 Subject: [PATCH 27/64] ci (test): unit test 9 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8364bab..232cb8b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: which python + command: which python && ls -lah /app/tests From 056a247d8c156c934f7ce099bbf32988fcf89d60 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 16:23:53 +0700 Subject: [PATCH 28/64] ci (test): unit test 10 --- .github/workflows/continuous-integration.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 232cb8b..386e734 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -176,6 +176,7 @@ jobs: login: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ${{ env.REGISTRY }} + workdir: ${GITHUB_WORKSPACE} file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash From ce1cde4724298a236e466e8937bc072d5268f0d1 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 16:26:04 +0700 Subject: [PATCH 29/64] ci (test): unit test 11 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 386e734..57a6f89 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -180,4 +180,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: which python && ls -lah /app/tests + command: which python && ls -lah ./app/tests From fc32f1823e9de57cbba54d04dd1dbab2c8386ef3 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 16:29:47 +0700 Subject: [PATCH 30/64] ci (test): unit test 12 --- .github/workflows/continuous-integration.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 57a6f89..d08168f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -176,8 +176,7 @@ jobs: login: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} registry: ${{ env.REGISTRY }} - workdir: ${GITHUB_WORKSPACE} file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: which python && ls -lah ./app/tests + command: which python && ls -lah ${GITHUB_WORKSPACE}/app/tests From 9ce9ea1080f6a9a8a8f4b2f393c88291805e69ce Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Tue, 10 Oct 2023 16:38:55 +0700 Subject: [PATCH 31/64] ci (test): unit test 13 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index d08168f..c8ea03f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: which python && ls -lah ${GITHUB_WORKSPACE}/app/tests + command: which python && ls -lah ${GITHUB_WORKSPACE}/app/tests && cat /etc/os-release From 91724b3cc6ab1e9adf54d48932cfb34505c527b5 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:03:59 +0700 Subject: [PATCH 32/64] ci (test): unit test 14 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c8ea03f..2d84c36 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: which python && ls -lah ${GITHUB_WORKSPACE}/app/tests && cat /etc/os-release + command: echo 1 && docker-compose ps -a From 34e94f4a8a889f36af313f80951056e628827af2 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:10:15 +0700 Subject: [PATCH 33/64] ci (test): unit test 15 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 2d84c36..2746dfa 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: echo 1 && docker-compose ps -a + command: cat /etc/os-release && docker-compose ps -a From dd8c55bb31966a06a34f0cc51442b99247406ab2 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:16:09 +0700 Subject: [PATCH 34/64] ci (test): unit test 16 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 2746dfa..978000f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: cat /etc/os-release && docker-compose ps -a + command: which python && docker-compose ps -a From 59bbc929735a5cc818ebd9bf294b6668e7c83f62 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:18:44 +0700 Subject: [PATCH 35/64] ci (test): unit test 17 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 978000f..5207a79 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: which python && docker-compose ps -a + command: which python && docker-compose -f app/tests/docker-compose.yml ps -a From df7056541253cb45d2a964abe2126a482ad09564 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:22:47 +0700 Subject: [PATCH 36/64] ci (test): unit test 18 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 5207a79..200042f 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: which python && docker-compose -f app/tests/docker-compose.yml ps -a + command: which python && docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pip show pytest From 174ce7bc16cf285113a8f868c4cfe1bdd6b0c5f6 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:25:59 +0700 Subject: [PATCH 37/64] ci (test): unit test 18 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 200042f..f043611 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -179,4 +179,4 @@ jobs: file: app/tests/docker-compose.yml service: upstream-app entrypoint: /bin/bash - command: which python && docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pip show pytest + command: which python && docker-compose -f app/tests/docker-compose.yml exec -T upstream-app python -m pip show pytest From d3c2fbf04d74e2a52da943e86d8cd9b10fdcb979 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:32:53 +0700 Subject: [PATCH 38/64] ci (test): unit test 19 --- .github/workflows/continuous-integration.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index f043611..3a9b252 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -170,13 +170,13 @@ jobs: - name: View the environment variables run: printenv - - name: Unit test - uses: cloudposse/github-action-docker-compose-test-run@main - with: - login: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - registry: ${{ env.REGISTRY }} - file: app/tests/docker-compose.yml - service: upstream-app - entrypoint: /bin/bash - command: which python && docker-compose -f app/tests/docker-compose.yml exec -T upstream-app python -m pip show pytest + - name: Setup docker-compose + uses: KengoTODA/actions-setup-docker-compose@main + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Compose up services + run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d + + - name: View running services + run: docker-compose -f app/test/docker-compose.yml ps -a From 6236b5d75337f1f79e88341cdb85fcf9e03edec0 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:35:28 +0700 Subject: [PATCH 39/64] ci (test): unit test 20 --- .github/workflows/continuous-integration.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 3a9b252..8f25f98 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -161,6 +161,16 @@ jobs: - name: Checkout repository code uses: actions/checkout@v4 + - name: Setup QEMU + uses: docker/setup-qemu-action@v3 + + - name: Login to the container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Extract metadata (tags, labels) from existing docker id: meta uses: docker/metadata-action@v5 From db363b984bb52605ae2530bab14e589ad3ed4912 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:39:25 +0700 Subject: [PATCH 40/64] ci (test): unit test 21 --- .github/workflows/continuous-integration.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 8f25f98..e856a13 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -186,7 +186,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Compose up services - run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d + run: cd ${GITHUB_WORKSPACE} && docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d - name: View running services - run: docker-compose -f app/test/docker-compose.yml ps -a + run: cd ${GITHUB_WORKSPACE} && docker-compose -f app/test/docker-compose.yml ps -a From 8cf21ea1bb047433d908d9ae604adf1252cea5fc Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:41:39 +0700 Subject: [PATCH 41/64] ci (test): unit test 22 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e856a13..e9b698d 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -189,4 +189,4 @@ jobs: run: cd ${GITHUB_WORKSPACE} && docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d - name: View running services - run: cd ${GITHUB_WORKSPACE} && docker-compose -f app/test/docker-compose.yml ps -a + run: cd ${GITHUB_WORKSPACE} && docker-compose -f app/tests/docker-compose.yml ps -a From 0ac3f09c83db7dbb6d63ca18234c8a08c6742664 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:45:46 +0700 Subject: [PATCH 42/64] ci (test): unit test 23 --- .github/workflows/continuous-integration.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index e9b698d..a4239a3 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -177,16 +177,19 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ github.actor }}/${{ env.UPSTREAM_APP_IMAGE_NAME }} - - name: View the environment variables - run: printenv - - name: Setup docker-compose uses: KengoTODA/actions-setup-docker-compose@main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Compose up services - run: cd ${GITHUB_WORKSPACE} && docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d + run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d - name: View running services - run: cd ${GITHUB_WORKSPACE} && docker-compose -f app/tests/docker-compose.yml ps -a + run: docker-compose -f app/tests/docker-compose.yml ps -a + + - name: Unit tests + run: docker-compose -f app/tests/docker-compose.yml exec -T upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests + + - name: Compose down services + run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d From b6e804fc56250bb99f92305e430bfbc28137e455 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:51:13 +0700 Subject: [PATCH 43/64] ci (test): unit test 24 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index a4239a3..5aa9f3e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -189,7 +189,7 @@ jobs: run: docker-compose -f app/tests/docker-compose.yml ps -a - name: Unit tests - run: docker-compose -f app/tests/docker-compose.yml exec -T upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests + run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec -T upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d From 2eda27845ac032cd1f73210ee30ad51a6f7c790e Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:55:17 +0700 Subject: [PATCH 44/64] ci (test): unit test 25 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 5aa9f3e..0e4d746 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -189,7 +189,7 @@ jobs: run: docker-compose -f app/tests/docker-compose.yml ps -a - name: Unit tests - run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec -T upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests + run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d From 458cfcd23646563bd2a4494dccab935160a658cb Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 12:58:34 +0700 Subject: [PATCH 45/64] ci (test): unit test 26 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0e4d746..180e451 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -189,7 +189,7 @@ jobs: run: docker-compose -f app/tests/docker-compose.yml ps -a - name: Unit tests - run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests + run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec -it upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d From f358a15ed4169c2b8700b5fb3057b598c7fdede3 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 13:01:36 +0700 Subject: [PATCH 46/64] ci (test): unit test 27 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 180e451..3da19bb 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -189,7 +189,7 @@ jobs: run: docker-compose -f app/tests/docker-compose.yml ps -a - name: Unit tests - run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec -it upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests + run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec -it upstream-app python -m pip show pytest - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d From 08b4073bff32e414110baf3fd76532c5b9a7cec4 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 13:07:17 +0700 Subject: [PATCH 47/64] ci (test): unit test 28 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 3da19bb..c70b67b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -189,7 +189,7 @@ jobs: run: docker-compose -f app/tests/docker-compose.yml ps -a - name: Unit tests - run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec -it upstream-app python -m pip show pytest + run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec -it upstream-app python -m pytest -v /app/tests - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d From 9e1c757fa13e07948f44a6557e5effbe2243650d Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 13:15:10 +0700 Subject: [PATCH 48/64] ci (test): unit test 29 --- .github/workflows/continuous-integration.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index c70b67b..10b34b6 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -182,6 +182,9 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: View current working dir + run: pwd && ls -lah + - name: Compose up services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d @@ -189,7 +192,7 @@ jobs: run: docker-compose -f app/tests/docker-compose.yml ps -a - name: Unit tests - run: docker-compose --log-level DEBUG -f app/tests/docker-compose.yml exec -it upstream-app python -m pytest -v /app/tests + run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests - name: Compose down services - run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d + run: docker-compose version && docker-compose -f app/tests/docker-compose.yml down From 23b8173e46bb0b1f9212912cea8c7269da2570cc Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 13:19:07 +0700 Subject: [PATCH 49/64] ci (test): unit test 30 --- .github/workflows/continuous-integration.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 10b34b6..47f6261 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -191,8 +191,11 @@ jobs: - name: View running services run: docker-compose -f app/tests/docker-compose.yml ps -a - - name: Unit tests - run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests + - name: View inside the upstream-app + run: docker-compose -f app/tests/docker-compose.yml exec upstream-app ls -lah + + # - name: Unit tests + # run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml down From 3b87016671327f6d5c198224b6b73c0acf81bbce Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 13:23:35 +0700 Subject: [PATCH 50/64] ci (test): unit test 31 --- .github/workflows/continuous-integration.yml | 3 +++ app/tests/docker-compose.yml | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 47f6261..77a0538 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -191,6 +191,9 @@ jobs: - name: View running services run: docker-compose -f app/tests/docker-compose.yml ps -a + - name: View current working dir + run: docker-compose -f app/tests/docker-compose.yml exec upstream-app pwd + - name: View inside the upstream-app run: docker-compose -f app/tests/docker-compose.yml exec upstream-app ls -lah diff --git a/app/tests/docker-compose.yml b/app/tests/docker-compose.yml index 03781af..18e4b3e 100644 --- a/app/tests/docker-compose.yml +++ b/app/tests/docker-compose.yml @@ -20,8 +20,6 @@ services: container_name: "upstream-app" ports: - "8501:8501" - volumes: - - ./app:/app environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} From 5fef87b75774fcc45185fc99d0779933b4522514 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 13:25:45 +0700 Subject: [PATCH 51/64] ci (test): unit test 32 --- .github/workflows/continuous-integration.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 77a0538..10b34b6 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -191,14 +191,8 @@ jobs: - name: View running services run: docker-compose -f app/tests/docker-compose.yml ps -a - - name: View current working dir - run: docker-compose -f app/tests/docker-compose.yml exec upstream-app pwd - - - name: View inside the upstream-app - run: docker-compose -f app/tests/docker-compose.yml exec upstream-app ls -lah - - # - name: Unit tests - # run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests + - name: Unit tests + run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml down From 93dcae5193d1854bd9747ea111546acf13caf8be Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 13:36:26 +0700 Subject: [PATCH 52/64] ci (test): unit test 33 --- .docker/images/app/.dockerignore | 6 +++++- app/app/gen_data.py | 6 +++++- app/app/psql_connector.py | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.docker/images/app/.dockerignore b/.docker/images/app/.dockerignore index f250cab..d0f2707 100644 --- a/.docker/images/app/.dockerignore +++ b/.docker/images/app/.dockerignore @@ -1,2 +1,6 @@ -__pycache__/ +.pytest_cache +.ruff_cache +__pycache__ logs/ +.coverage +experiment.ipynb diff --git a/app/app/gen_data.py b/app/app/gen_data.py index dacac03..f7ccd85 100644 --- a/app/app/gen_data.py +++ b/app/app/gen_data.py @@ -18,7 +18,11 @@ logger = logging.getLogger(__name__) # File handler -f_handler = logging.FileHandler(os.path.dirname(__file__) + f"/logs/{__name__}.log") +log_dir = os.path.dirname(__file__) + "/logs" +if not os.path.exists(log_dir): + os.mkdir(log_dir) + +f_handler = logging.FileHandler(log_dir + f"/{__name__}.log") f_handler.setLevel(logging.INFO) f_format = logging.Formatter("[ %(asctime)s - %(levelname)s - %(name)s ] %(message)s") f_handler.setFormatter(f_format) diff --git a/app/app/psql_connector.py b/app/app/psql_connector.py index 7c4789e..184c550 100644 --- a/app/app/psql_connector.py +++ b/app/app/psql_connector.py @@ -6,11 +6,15 @@ from psycopg2 import OperationalError # Init logging +log_dir = os.path.dirname(__file__) + "/logs" +if not os.path.exists(log_dir): + os.mkdir(log_dir) + logging.basicConfig( level=logging.INFO, format="[ %(name)s - %(asctime)s %(levelname)s ] %(message)s", handlers=[ - logging.FileHandler(os.path.dirname(__file__) + f"/logs/{__name__}.log"), + logging.FileHandler(log_dir + f"/{__name__}.log"), logging.StreamHandler(), ], ) From 7bb726bc9fcf4dbe882f265ede40147dc4066ac4 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 13:48:06 +0700 Subject: [PATCH 53/64] ci (test): unit test 34 --- .github/workflows/continuous-integration.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 10b34b6..6afc9a6 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -191,8 +191,11 @@ jobs: - name: View running services run: docker-compose -f app/tests/docker-compose.yml ps -a - - name: Unit tests - run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests + - name: View environments of upstream-app + run: docker-compose -f app/tests/docker-compose.yml exec upstream-app printenv + + # - name: Unit tests + # run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml down From 0f537731f1b4fadcf709d9d415f085f0d528b5a8 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 13:54:11 +0700 Subject: [PATCH 54/64] ci (test): unit test 35 --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6afc9a6..0a0dfe5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -183,7 +183,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: View current working dir - run: pwd && ls -lah + run: pwd && ls -lah && printenv - name: Compose up services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d From 97650e6b052b2bdf71051926a07a49305068a825 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 14:02:17 +0700 Subject: [PATCH 55/64] ci (test): unit test 36 --- .github/workflows/continuous-integration.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0a0dfe5..0fdf913 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -186,6 +186,11 @@ jobs: run: pwd && ls -lah && printenv - name: Compose up services + env: + POSTGRES_USER: ${{ secrets.POSTGRES_USER }} + POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} + POSTGRES_DB: ${{ secrets.POSTGRES_DB }} + POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d - name: View running services From 16e16e069a8bd65a4afb0a95ffa27be6faef774a Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 14:08:24 +0700 Subject: [PATCH 56/64] ci (test): unit test 37 --- .github/workflows/continuous-integration.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 0fdf913..aea4365 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -145,9 +145,7 @@ jobs: (needs.build-push-upstream-app.result == 'success' || needs.build-push-upstream-app.result == 'skipped') runs-on: ubuntu-22.04 - permissions: - contents: read - packages: read + permissions: read-all env: POSTGRES_USER: ${{ secrets.POSTGRES_USER }} @@ -186,11 +184,6 @@ jobs: run: pwd && ls -lah && printenv - name: Compose up services - env: - POSTGRES_USER: ${{ secrets.POSTGRES_USER }} - POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} - POSTGRES_DB: ${{ secrets.POSTGRES_DB }} - POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d - name: View running services From 9a261feee192d10c1b860c53749c6a1fc07ced6c Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 14:12:32 +0700 Subject: [PATCH 57/64] ci (test): unit test 38 --- .github/workflows/continuous-integration.yml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index aea4365..4c4e69a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -145,13 +145,11 @@ jobs: (needs.build-push-upstream-app.result == 'success' || needs.build-push-upstream-app.result == 'skipped') runs-on: ubuntu-22.04 - permissions: read-all - env: - POSTGRES_USER: ${{ secrets.POSTGRES_USER }} - POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} - POSTGRES_DB: ${{ secrets.POSTGRES_DB }} - POSTGRES_PORT: ${{ secrets.POSTGRES_PORT }} + POSTGRES_USER: admin + POSTGRES_PASSWORD: admin123 + POSTGRES_DB: wideworldimporters + POSTGRES_PORT: 5432 REGISTRY: ghcr.io UPSTREAM_APP_IMAGE_NAME: upstream-app @@ -192,8 +190,8 @@ jobs: - name: View environments of upstream-app run: docker-compose -f app/tests/docker-compose.yml exec upstream-app printenv - # - name: Unit tests - # run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests + - name: Unit tests + run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml down From 073fa9ec3c1b02fc46355319c945e369fff70c59 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 14:20:51 +0700 Subject: [PATCH 58/64] ci (test): unit test 39 --- .github/workflows/continuous-integration.yml | 1 + app/tests/test_gen_data.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 4c4e69a..7faf0d1 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -51,6 +51,7 @@ jobs: filters: | upstream-app: - ".docker/images/app/**" + - "app/**" kafka-connect: - ".docker/images/kafka-connect/**" diff --git a/app/tests/test_gen_data.py b/app/tests/test_gen_data.py index 3a8f167..70d6608 100644 --- a/app/tests/test_gen_data.py +++ b/app/tests/test_gen_data.py @@ -1,4 +1,5 @@ -from app.gen_data import Table, PsqlConnector +from app.psql_connector import PsqlConnector +from app.gen_data import Table from conftest import psql_params from sqlalchemy import text import pytest @@ -14,7 +15,7 @@ def test_connecting(self): with engine.connect() as cursor: is_connected = True cursor.commit() - assert is_connected is True, "Not connected to database" + assert is_connected is True, "Not connected to database." @pytest.mark.dependency(depends=["TEST_CONNECTING"]) def test_update_attributes(self): From 2f9a32d69dcda4428c8ce5301836edbc10ebe89b Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 14:31:36 +0700 Subject: [PATCH 59/64] ci (test): unit test 40 --- app/tests/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/tests/docker-compose.yml b/app/tests/docker-compose.yml index 18e4b3e..0588ce2 100644 --- a/app/tests/docker-compose.yml +++ b/app/tests/docker-compose.yml @@ -4,8 +4,8 @@ services: source_db: image: postgres:14-alpine container_name: "source_db" - expose: - - "5432" + ports: + - "5432:5432" volumes: - .docker/postgres-add-de-user.sh:/docker-entrypoint-initdb.d/postgres-add-de-user.sh environment: From df8c480bff6c941fa45a6ba0bbc605f0dcb6be4c Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 15:22:09 +0700 Subject: [PATCH 60/64] ci (test): unit test 41 --- .github/workflows/continuous-integration.yml | 4 ++-- app/tests/docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7faf0d1..6e09a3a 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -186,13 +186,13 @@ jobs: run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d - name: View running services - run: docker-compose -f app/tests/docker-compose.yml ps -a + run: docker-compose -f app/tests/docker-compose.yml ps -a && sleep 15 - name: View environments of upstream-app run: docker-compose -f app/tests/docker-compose.yml exec upstream-app printenv - name: Unit tests - run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest -v /app/tests + run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests - name: Compose down services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml down diff --git a/app/tests/docker-compose.yml b/app/tests/docker-compose.yml index 0588ce2..042cc8d 100644 --- a/app/tests/docker-compose.yml +++ b/app/tests/docker-compose.yml @@ -16,7 +16,7 @@ services: restart: unless-stopped upstream-app: - image: ${DOCKER_METADATA_OUTPUT_TAGS} + image: ghcr.io/lelouvincx/upstream-app:${DOCKER_METADATA_OUTPUT_VERSION} container_name: "upstream-app" ports: - "8501:8501" From c6888de544fa16d7a28c952c59551fb98ee78ee9 Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 15:30:40 +0700 Subject: [PATCH 61/64] ci (test): unit test 42 --- .github/workflows/continuous-integration.yml | 6 +----- app/tests/docker-compose.yml | 2 ++ 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6e09a3a..21fbd4c 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -51,7 +51,6 @@ jobs: filters: | upstream-app: - ".docker/images/app/**" - - "app/**" kafka-connect: - ".docker/images/kafka-connect/**" @@ -180,7 +179,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: View current working dir - run: pwd && ls -lah && printenv + run: pwd && ls -a && ls -lah app - name: Compose up services run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d @@ -188,9 +187,6 @@ jobs: - name: View running services run: docker-compose -f app/tests/docker-compose.yml ps -a && sleep 15 - - name: View environments of upstream-app - run: docker-compose -f app/tests/docker-compose.yml exec upstream-app printenv - - name: Unit tests run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests diff --git a/app/tests/docker-compose.yml b/app/tests/docker-compose.yml index 042cc8d..dabaa84 100644 --- a/app/tests/docker-compose.yml +++ b/app/tests/docker-compose.yml @@ -20,6 +20,8 @@ services: container_name: "upstream-app" ports: - "8501:8501" + volumes: + - app:/app environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} From 8606a922b0dccb5b26237f00d1317af9ef755e0a Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Wed, 11 Oct 2023 15:39:56 +0700 Subject: [PATCH 62/64] ci (test): unit test 43 --- .github/workflows/continuous-integration.yml | 6 +++--- app/tests/docker-compose.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 21fbd4c..6e59d56 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -182,13 +182,13 @@ jobs: run: pwd && ls -a && ls -lah app - name: Compose up services - run: docker-compose version && docker-compose -f app/tests/docker-compose.yml up -d + run: docker-compose version && docker-compose -f app/tests/docker-compose.yml --project-directory . up -d - name: View running services run: docker-compose -f app/tests/docker-compose.yml ps -a && sleep 15 - name: Unit tests - run: docker-compose -f app/tests/docker-compose.yml exec upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests + run: docker-compose -f app/tests/docker-compose.yml --project-directory . exec upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests - name: Compose down services - run: docker-compose version && docker-compose -f app/tests/docker-compose.yml down + run: docker-compose -f app/tests/docker-compose.yml --project-directory . down diff --git a/app/tests/docker-compose.yml b/app/tests/docker-compose.yml index dabaa84..66ba50d 100644 --- a/app/tests/docker-compose.yml +++ b/app/tests/docker-compose.yml @@ -21,7 +21,7 @@ services: ports: - "8501:8501" volumes: - - app:/app + - ./app:/app environment: - POSTGRES_USER=${POSTGRES_USER} - POSTGRES_PASSWORD=${POSTGRES_PASSWORD} From 6bed9ec0a85b4ff75f29a528f917faf171a1240d Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Sun, 10 Dec 2023 12:39:53 +0700 Subject: [PATCH 63/64] ci: update connectors --- connectors/sink-db.json | 2 +- connectors/source-db.json | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/connectors/sink-db.json b/connectors/sink-db.json index 709aec5..9288a4a 100644 --- a/connectors/sink-db.json +++ b/connectors/sink-db.json @@ -1,5 +1,5 @@ { - "name": "sink-public-test-v1", + "name": "sink-public-test-v3", "config": { "connector.class": "io.confluent.connect.jdbc.JdbcSinkConnector", "tasks.max": 2, diff --git a/connectors/source-db.json b/connectors/source-db.json index bdbd13f..757cb55 100644 --- a/connectors/source-db.json +++ b/connectors/source-db.json @@ -1,5 +1,5 @@ { - "name": "source-v2", + "name": "source-public-test-v1", "config": { "connector.class": "io.debezium.connector.postgresql.PostgresConnector", "plugin.name": "pgoutput", @@ -10,7 +10,8 @@ "topic.creation.default.partitions": "1", "include.schema.changes": "true", "schema.include.list": "public", - "slot.name": "dbz", + "table.include.list": "public.test", + "slot.name": "dbz_public_test", "slot.drop_on_stop": "true", "transforms": "route", "transforms.route.type": "org.apache.kafka.connect.transforms.RegexRouter", From 3f6be4316fb04718b4b61f7329c0e00f69aca96b Mon Sep 17 00:00:00 2001 From: lelouvincx Date: Sun, 10 Dec 2023 12:40:10 +0700 Subject: [PATCH 64/64] ci: update running workflow --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 6e59d56..01955ac 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -185,7 +185,7 @@ jobs: run: docker-compose version && docker-compose -f app/tests/docker-compose.yml --project-directory . up -d - name: View running services - run: docker-compose -f app/tests/docker-compose.yml ps -a && sleep 15 + run: docker-compose -f app/tests/docker-compose.yml --project-directory . ps -a && sleep 15 - name: Unit tests run: docker-compose -f app/tests/docker-compose.yml --project-directory . exec upstream-app python -m pytest --log-cli-level info -p no:warnings -v /app/tests