From caefada677d717643958e288fad7ac4146d51789 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Tue, 12 Dec 2023 09:32:41 +0100 Subject: [PATCH 1/5] cicd: test updater staging script --- Resources/scripts/updater.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/Resources/scripts/updater.sh b/Resources/scripts/updater.sh index 35466ae92..b93b7d631 100644 --- a/Resources/scripts/updater.sh +++ b/Resources/scripts/updater.sh @@ -104,6 +104,7 @@ get_invokator_pr_number() { # Clone the repository containing the static JSON files clone() { git clone "https://github.com/${org}/${data_repo}.git" "$data_repo" + cd "$data_repo" && git checkout staging } # Configure git to use the supplied user when committing From a2ef2e9fdc901013c219e3e2368b2330a0d166cd Mon Sep 17 00:00:00 2001 From: Naramsim Date: Tue, 12 Dec 2023 09:39:12 +0100 Subject: [PATCH 2/5] cicd: run in shell --- Resources/scripts/updater.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/scripts/updater.sh b/Resources/scripts/updater.sh index b93b7d631..9739de815 100644 --- a/Resources/scripts/updater.sh +++ b/Resources/scripts/updater.sh @@ -104,7 +104,7 @@ get_invokator_pr_number() { # Clone the repository containing the static JSON files clone() { git clone "https://github.com/${org}/${data_repo}.git" "$data_repo" - cd "$data_repo" && git checkout staging + (cd "$data_repo" && git checkout staging) } # Configure git to use the supplied user when committing From ca9ba173ca0bc50b7ea13ff4191552b65b81a2f9 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Wed, 13 Dec 2023 02:36:44 +0100 Subject: [PATCH 3/5] cicd: use newer images --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9d88e45b4..ca9a35331 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -39,10 +39,9 @@ jobs: - run: name: Build database command: make build-db - deploy: machine: - image: ubuntu-2004:202111-01 # https://circleci.com/docs/2.0/configuration-reference/#available-machine-images with Docker 18.09.3. Newer images don't work + image: ubuntu-2204:2023.10.1 resource_class: large steps: - checkout From 912f1353deedeebe0015f32fa8401a1e24de5f28 Mon Sep 17 00:00:00 2001 From: Naramsim Date: Wed, 13 Dec 2023 03:33:03 +0100 Subject: [PATCH 4/5] cicd: run on custom network/refactor commit message --- Resources/scripts/updater.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Resources/scripts/updater.sh b/Resources/scripts/updater.sh index 9739de815..27ac9fd1b 100644 --- a/Resources/scripts/updater.sh +++ b/Resources/scripts/updater.sh @@ -177,7 +177,8 @@ run_updater() { fi # Run the updater - docker run --privileged -e REPO_POKEAPI_CHECKOUT_OBJECT="$CIRCLE_SHA1" -e COMMIT_EMAIL="$email" -e COMMIT_NAME="$username" -e BRANCH_NAME="$branch_name" -e REPO_POKEAPI="https://github.com/$org/$engine_repo.git" -e REPO_DATA="https://$MACHINE_USER_GITHUB_API_TOKEN@github.com/$org/$data_repo.git" -e RUN_AS='root' pokeapi-updater + docker network create pokeapi + docker run --privileged --network pokeapi --network-alias docker -e REPO_POKEAPI_CHECKOUT_OBJECT="$CIRCLE_SHA1" -e COMMIT_EMAIL="$email" -e COMMIT_NAME="$username" -e BRANCH_NAME="$branch_name" -e REPO_POKEAPI="https://github.com/$org/$engine_repo.git" -e REPO_DATA="https://$MACHINE_USER_GITHUB_API_TOKEN@github.com/$org/$data_repo.git" -e COMMIT_MESSAGE="[Updater Bot] Regenerate data from https://github.com/$org/$engine_repo/pull/$(get_invokator_pr_number)" -e RUN_AS='root' pokeapi-updater return_code=$? if [ "$return_code" -eq 2 ]; then cleanexit 'no-new-data' "Generated data is the same as old data, skipping deploy" From bd6b4c82c584edbce4df68a2f90a74d4ece98c1e Mon Sep 17 00:00:00 2001 From: Naramsim Date: Wed, 13 Dec 2023 08:26:31 +0100 Subject: [PATCH 5/5] cicd: revert checking out staging/add commit and push --- Resources/scripts/updater.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Resources/scripts/updater.sh b/Resources/scripts/updater.sh index 27ac9fd1b..b0b2517d3 100644 --- a/Resources/scripts/updater.sh +++ b/Resources/scripts/updater.sh @@ -104,7 +104,6 @@ get_invokator_pr_number() { # Clone the repository containing the static JSON files clone() { git clone "https://github.com/${org}/${data_repo}.git" "$data_repo" - (cd "$data_repo" && git checkout staging) } # Configure git to use the supplied user when committing @@ -178,7 +177,7 @@ run_updater() { # Run the updater docker network create pokeapi - docker run --privileged --network pokeapi --network-alias docker -e REPO_POKEAPI_CHECKOUT_OBJECT="$CIRCLE_SHA1" -e COMMIT_EMAIL="$email" -e COMMIT_NAME="$username" -e BRANCH_NAME="$branch_name" -e REPO_POKEAPI="https://github.com/$org/$engine_repo.git" -e REPO_DATA="https://$MACHINE_USER_GITHUB_API_TOKEN@github.com/$org/$data_repo.git" -e COMMIT_MESSAGE="[Updater Bot] Regenerate data from https://github.com/$org/$engine_repo/pull/$(get_invokator_pr_number)" -e RUN_AS='root' pokeapi-updater + docker run --privileged --network pokeapi --network-alias docker -e REPO_POKEAPI_CHECKOUT_OBJECT="$CIRCLE_SHA1" -e COMMIT_EMAIL="$email" -e COMMIT_NAME="$username" -e BRANCH_NAME="$branch_name" -e REPO_POKEAPI="https://github.com/$org/$engine_repo.git" -e REPO_DATA="https://$MACHINE_USER_GITHUB_API_TOKEN@github.com/$org/$data_repo.git" -e COMMIT_MESSAGE="[Updater Bot] Regenerate data from https://github.com/$org/$engine_repo/pull/$(get_invokator_pr_number)" -e COMMIT_AND_PUSH='true' -e RUN_AS='root' pokeapi-updater return_code=$? if [ "$return_code" -eq 2 ]; then cleanexit 'no-new-data' "Generated data is the same as old data, skipping deploy"