From aa5088cc9742cfe77747a800e590291eff232e40 Mon Sep 17 00:00:00 2001 From: wancat Date: Wed, 6 Dec 2023 15:07:46 +0800 Subject: [PATCH 1/5] feat: add mongo dump and restore script --- docker-scripts.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/docker-scripts.sh b/docker-scripts.sh index bb7b24b..2c14551 100755 --- a/docker-scripts.sh +++ b/docker-scripts.sh @@ -29,4 +29,38 @@ down() { docker compose -f docker-compose.testing.yml down } +dump() { + # Define service name and dump directory name + SERVICE_NAME="db" + DUMP_NAME="mongodump-$(date --iso).archive" + CONTAINER_ID=$(docker compose ps -q $SERVICE_NAME) + + # Fetch credentials from Docker environment variables + MONGO_URL=$(docker compose exec -T backend printenv MONGO_URL) + echo mongo uri: $MONGO_URL + + # Dump MongoDB data using credentials + docker compose exec -T $SERVICE_NAME sh -c "mongodump --gzip --archive=/tmp/$DUMP_NAME -d odyssey-test" && + + # Copy the dump from the container to the host + # Note: You will need to know the exact container name for this step + docker cp ${CONTAINER_ID}:/tmp/$DUMP_NAME . && + + echo "MongoDB data dumped successfully." +} + +restore() { + # Define service name and dump directory name + SERVICE_NAME="db" + DUMP_NAME=$1 + CONTAINER_ID=$(docker compose ps -q $SERVICE_NAME) + + # Copy the dump from the host to the container + docker cp $DUMP_NAME ${CONTAINER_ID}:/tmp && + + # Dump MongoDB data using credentials + docker compose exec -T $SERVICE_NAME sh -c "mongorestore --gzip --archive=/tmp/$DUMP_NAME" && + + echo "MongoDB data dumped successfully." +} $@ \ No newline at end of file From bfa7ed1cf9f65df614757a9c5914b658b72f4c1b Mon Sep 17 00:00:00 2001 From: wancat Date: Wed, 6 Dec 2023 15:10:04 +0800 Subject: [PATCH 2/5] fix: require CI to be passed before deployment --- .github/workflows/production.yml | 2 +- .github/workflows/staging.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 6819074..394004e 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -15,7 +15,7 @@ jobs: secrets: inherit build: - # needs: ci-checks + needs: ci-checks uses: ./.github/workflows/build.yml secrets: inherit diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 2da7352..e65c376 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -15,7 +15,7 @@ jobs: secrets: inherit build: - # needs: ci-checks + needs: ci-checks uses: ./.github/workflows/build.yml secrets: inherit From d34ae3ef7ac922ebd40df7b28cd98c98c5542118 Mon Sep 17 00:00:00 2001 From: wancat Date: Wed, 6 Dec 2023 15:17:13 +0800 Subject: [PATCH 3/5] feat: change code review model to save budget --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 35ddc0f..325224f 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -25,7 +25,7 @@ jobs: uses: mattzcarey/code-review-gpt@v0.1.4-alpha with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - MODEL: 'gpt-4' + MODEL: 'gpt-4-1106-preview' GITHUB_TOKEN: ${{ github.token }} build: From 7ef77267d3029a03fceec8a6bdfb732982e837ea Mon Sep 17 00:00:00 2001 From: wancat Date: Wed, 6 Dec 2023 15:21:32 +0800 Subject: [PATCH 4/5] fix: update to use main branch action --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 325224f..5d5cd3c 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -22,7 +22,7 @@ jobs: fetch-depth: 0 - name: Code Review GPT - uses: mattzcarey/code-review-gpt@v0.1.4-alpha + uses: mattzcarey/code-review-gpt@main with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} MODEL: 'gpt-4-1106-preview' From 2ce277c7e58825e8243d70e1da4c9beadb24de8c Mon Sep 17 00:00:00 2001 From: wancat Date: Wed, 6 Dec 2023 15:25:15 +0800 Subject: [PATCH 5/5] fix: gpt-4-turbo not supported yet, rollback --- .github/workflows/pull-request.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 5d5cd3c..0c2f197 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -22,10 +22,10 @@ jobs: fetch-depth: 0 - name: Code Review GPT - uses: mattzcarey/code-review-gpt@main + uses: mattzcarey/code-review-gpt@v0.1.4-alpha with: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} - MODEL: 'gpt-4-1106-preview' + MODEL: 'gpt-3.5-turbo' GITHUB_TOKEN: ${{ github.token }} build: