From d1a1f9c6c6616c11e2bfeedd949acfbcf82496a1 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 5 Aug 2024 05:16:03 -0500 Subject: [PATCH 1/9] ci: try pulling latest tag --- .github/workflows/tests.yml | 15 +++++++++++++-- autotick-bot/install_bot_code.sh | 1 - 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 62c165774..e9528363b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,17 @@ jobs: shell: bash -leo pipefail {0} steps: + - name: get latest release + id: latest_release + run: | + latest_tag=$(gh repos/{owner}/{repo}/releases/latest --jq '.tag_name') + echo "tag_name=${tag}" >> "$GITHUB_OUTPUT" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + ref: ${{ steps.latest_release.outputs.tag_name }} - uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1 with: @@ -34,12 +44,12 @@ jobs: - name: configure conda and install code run: | - export GIT_FULL_HASH=`git rev-parse HEAD` - export RUN_URL="" pip install --no-deps --no-build-isolation -e . - name: test versions run: | + python -c "import conda_forge_tick; print(conda_forge_tick.__version__, flush=True)" + cd .. python -c "import conda_forge_tick; assert conda_forge_tick.__version__ != '0.0.0'" cd - @@ -86,6 +96,7 @@ jobs: tests env: MONGODB_CONNECTION_STRING: "mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000" + RUN_URL: "" - name: upload codecov uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4 diff --git a/autotick-bot/install_bot_code.sh b/autotick-bot/install_bot_code.sh index 36fe0cbb6..190b1c303 100644 --- a/autotick-bot/install_bot_code.sh +++ b/autotick-bot/install_bot_code.sh @@ -32,7 +32,6 @@ conda update conda-forge-pinning --yes cd cf-scripts -export GIT_FULL_HASH=$(git rev-parse HEAD) pip install --no-deps --no-build-isolation -e . cd .. From 34a7e6cff87370c81a9397a6ae5a8b2faf67b9eb Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 5 Aug 2024 05:17:35 -0500 Subject: [PATCH 2/9] fix: wrong command name --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e9528363b..cd9ec0411 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: - name: get latest release id: latest_release run: | - latest_tag=$(gh repos/{owner}/{repo}/releases/latest --jq '.tag_name') + latest_tag=$(gh api repos/{owner}/{repo}/releases/latest --jq '.tag_name') echo "tag_name=${tag}" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ecf7c0cdf5e327d736e16f6b17f1bad2118caba6 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 5 Aug 2024 05:18:36 -0500 Subject: [PATCH 3/9] fix: cannot resolve repo --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cd9ec0411..6b879947c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,7 +27,7 @@ jobs: - name: get latest release id: latest_release run: | - latest_tag=$(gh api repos/{owner}/{repo}/releases/latest --jq '.tag_name') + latest_tag=$(gh api repos/regro/cf-scripts/releases/latest --jq '.tag_name') echo "tag_name=${tag}" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From be5a68a74e31e0f6793ff0886fd934c0eb09cf6c Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 5 Aug 2024 05:20:34 -0500 Subject: [PATCH 4/9] debug: print out value --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6b879947c..2818ecd3a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,6 +28,7 @@ jobs: id: latest_release run: | latest_tag=$(gh api repos/regro/cf-scripts/releases/latest --jq '.tag_name') + echo "latest release: ${latest_tag}" echo "tag_name=${tag}" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7d2af415d28031383a101ec7f711cc7f0f508ae2 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 5 Aug 2024 05:21:50 -0500 Subject: [PATCH 5/9] debug: try fetching tags --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2818ecd3a..c1d1ba9d9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -36,6 +36,7 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: ref: ${{ steps.latest_release.outputs.tag_name }} + fetch-tags: true - uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1 with: From e4fbd733c605c98c6ced3e290b11cec152bdb005 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 5 Aug 2024 05:23:48 -0500 Subject: [PATCH 6/9] debug: try a standard checkout --- .github/workflows/tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c1d1ba9d9..0765ef908 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,8 +35,7 @@ jobs: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: - ref: ${{ steps.latest_release.outputs.tag_name }} - fetch-tags: true + fetch-depth: 0 - uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1 with: @@ -46,6 +45,7 @@ jobs: - name: configure conda and install code run: | + git checkout ${{ steps.latest_release.outputs.tag_name }} pip install --no-deps --no-build-isolation -e . - name: test versions From 2368207c9eabf77726e731fbc4b785e082d895b3 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 5 Aug 2024 05:26:15 -0500 Subject: [PATCH 7/9] fix: variables mucked up --- .github/workflows/tests.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0765ef908..032455d61 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -27,15 +27,15 @@ jobs: - name: get latest release id: latest_release run: | - latest_tag=$(gh api repos/regro/cf-scripts/releases/latest --jq '.tag_name') - echo "latest release: ${latest_tag}" - echo "tag_name=${tag}" >> "$GITHUB_OUTPUT" + tag_name=$(gh api repos/regro/cf-scripts/releases/latest --jq '.tag_name') + echo "latest release: ${tag_name}" + echo "tag_name=${tag_name}" >> "$GITHUB_OUTPUT" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: - fetch-depth: 0 + ref: ${{ steps.latest_release.outputs.tag_name }} - uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1 with: @@ -45,7 +45,6 @@ jobs: - name: configure conda and install code run: | - git checkout ${{ steps.latest_release.outputs.tag_name }} pip install --no-deps --no-build-isolation -e . - name: test versions From 6c54072a2a39d5700f75f897fa7062072f905d99 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 5 Aug 2024 05:46:57 -0500 Subject: [PATCH 8/9] feat: try feedstocks job using tag --- .github/workflows/bot-feedstocks.yml | 10 ++++++++++ .github/workflows/tests.yml | 13 ------------- README.md | 5 +++-- autotick-bot/install_bot_code.sh | 4 ++-- conda_forge_tick/utils.py | 5 ++++- 5 files changed, 19 insertions(+), 18 deletions(-) diff --git a/.github/workflows/bot-feedstocks.yml b/.github/workflows/bot-feedstocks.yml index df2e8e419..611649d8d 100644 --- a/.github/workflows/bot-feedstocks.yml +++ b/.github/workflows/bot-feedstocks.yml @@ -15,8 +15,18 @@ jobs: shell: bash -leo pipefail {0} steps: + - name: get latest release + id: latest_release + run: | + tag_name=$(gh api repos/regro/cf-scripts/releases/latest --jq '.tag_name') + echo "latest release: ${tag_name}" + echo "tag_name=${tag_name}" >> "$GITHUB_OUTPUT" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 with: + ref: ${{ steps.latest_release.outputs.tag_name }} path: cf-scripts - uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 032455d61..a83561c54 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,18 +24,7 @@ jobs: shell: bash -leo pipefail {0} steps: - - name: get latest release - id: latest_release - run: | - tag_name=$(gh api repos/regro/cf-scripts/releases/latest --jq '.tag_name') - echo "latest release: ${tag_name}" - echo "tag_name=${tag_name}" >> "$GITHUB_OUTPUT" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 - with: - ref: ${{ steps.latest_release.outputs.tag_name }} - uses: mamba-org/setup-micromamba@f8b8a1e23a26f60a44c853292711bacfd3eac822 # v1 with: @@ -49,8 +38,6 @@ jobs: - name: test versions run: | - python -c "import conda_forge_tick; print(conda_forge_tick.__version__, flush=True)" - cd .. python -c "import conda_forge_tick; assert conda_forge_tick.__version__ != '0.0.0'" cd - diff --git a/README.md b/README.md index b31be2e4b..19521dc62 100644 --- a/README.md +++ b/README.md @@ -228,6 +228,7 @@ If your migrator needs special configuration, you should write a new factory fun - `RUN_URL`: set to the URL of the CI build (now set to a GHA run URL) - `MEMORY_LIMIT_GB`: set to the memory limit in GB for the bot - `BOT_TOKEN`: a GitHub token for the bot user +- `CF_TICK_CONTAINER_TAG`: set this to override the default container tag used in production runs, otherwise the value of `__version__` is used ### Running Tests @@ -356,11 +357,11 @@ This is an important number to know when proposing a migration ### `conda-forge-tick` Container Image and Dockerfile The bot relies on a container image to run certain tasks. The image is built from the `Dockerfile` in the root of -this repository and hosted via `ghcr.io`. The `latest` tag is used for production jobs and updated automatically +this repository and hosted via `ghcr.io`. The `__version__` tag is used for production jobs and updated automatically when PRs are merged. The container is typically run via ```bash -docker run --rm -t conda-forge-tick:latest python /opt/autotick-bot/docker/run_bot_task.py +docker run --rm -t conda-forge-tick:<__version__> python /opt/autotick-bot/docker/run_bot_task.py ``` See the [run_bot_task.py](docker/run_bot_task.py) script for more information. diff --git a/autotick-bot/install_bot_code.sh b/autotick-bot/install_bot_code.sh index 190b1c303..775ca1d65 100644 --- a/autotick-bot/install_bot_code.sh +++ b/autotick-bot/install_bot_code.sh @@ -22,8 +22,6 @@ sudo apt-get autoclean -y >& /dev/null sudo docker image prune --all --force df -h -docker pull ghcr.io/regro/conda-forge-tick:latest - git config --global user.name regro-cf-autotick-bot git config --global user.email 36490558+regro-cf-autotick-bot@users.noreply.github.com git config --global pull.rebase false @@ -43,6 +41,8 @@ else echo "Skipping cloning of cf-graph and pinning feedstock" fi +docker pull ghcr.io/regro/conda-forge-tick:$(python -c "import conda_forge_tick; print(conda_forge_tick.__version__)") + echo -e "\n\n============================================\n============================================" conda info conda config --show-sources diff --git a/conda_forge_tick/utils.py b/conda_forge_tick/utils.py index a94e0063c..678b7806f 100644 --- a/conda_forge_tick/utils.py +++ b/conda_forge_tick/utils.py @@ -22,6 +22,7 @@ import ruamel.yaml from . import sensitive_env +from ._version import __version__ from .lazy_json_backends import LazyJson if typing.TYPE_CHECKING: @@ -122,7 +123,9 @@ def get_default_container_name(): if os.environ.get("CF_TICK_PYTEST", "false") == "true": cname = "conda-forge-tick:test" else: - cname = "ghcr.io/regro/conda-forge-tick:latest" + cname = "ghcr.io/regro/conda-forge-tick:" + os.environ.get( + "CF_TICK_CONTAINER_TAG", __version__ + ) return cname From d560a99bb5eb68a7445f0a933a7cb59298f1e345 Mon Sep 17 00:00:00 2001 From: beckermr Date: Mon, 5 Aug 2024 05:52:05 -0500 Subject: [PATCH 9/9] feat: override tags for other jobs --- .github/workflows/bot-bot.yml | 1 + .github/workflows/bot-cache.yml | 1 + .github/workflows/bot-make-graph.yml | 2 ++ .github/workflows/bot-make-migrators.yml | 1 + .github/workflows/bot-prs.yml | 1 + .github/workflows/bot-pypi-mapping.yml | 2 ++ .github/workflows/bot-update-status-page.yml | 1 + .github/workflows/bot-versions.yml | 1 + 8 files changed, 10 insertions(+) diff --git a/.github/workflows/bot-bot.yml b/.github/workflows/bot-bot.yml index a8b11d110..3d35fb116 100644 --- a/.github/workflows/bot-bot.yml +++ b/.github/workflows/bot-bot.yml @@ -54,6 +54,7 @@ jobs: MEMORY_LIMIT_GB: 7 CF_TICK_GRAPH_DATA_BACKENDS: "${{ vars.CF_TICK_GRAPH_DATA_BACKENDS }}" MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }} + CF_TICK_CONTAINER_TAG: latest - name: status of changes if: github.ref == 'refs/heads/master' && always() && ! env.CI_SKIP diff --git a/.github/workflows/bot-cache.yml b/.github/workflows/bot-cache.yml index 6a7aca04a..d4143f2a6 100644 --- a/.github/workflows/bot-cache.yml +++ b/.github/workflows/bot-cache.yml @@ -62,6 +62,7 @@ jobs: env: CF_TICK_GRAPH_DATA_BACKENDS: "${{ vars.CF_TICK_GRAPH_DATA_BACKENDS }}" MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }} + CF_TICK_CONTAINER_TAG: latest bot-cache-trigger: needs: bot-cache diff --git a/.github/workflows/bot-make-graph.yml b/.github/workflows/bot-make-graph.yml index f95d147a9..f23f7016c 100644 --- a/.github/workflows/bot-make-graph.yml +++ b/.github/workflows/bot-make-graph.yml @@ -51,6 +51,7 @@ jobs: CF_TICK_GRAPH_DATA_BACKENDS: "${{ vars.CF_TICK_GRAPH_DATA_BACKENDS }}" MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }} BOT_JOB: ${{ matrix.job_num }} + CF_TICK_CONTAINER_TAG: latest - name: deploy if: github.ref == 'refs/heads/master' && always() && ! env.CI_SKIP @@ -113,6 +114,7 @@ jobs: env: CF_TICK_GRAPH_DATA_BACKENDS: "${{ vars.CF_TICK_GRAPH_DATA_BACKENDS }}" MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }} + CF_TICK_CONTAINER_TAG: latest - name: deploy if: github.ref == 'refs/heads/master' && always() && ! env.CI_SKIP diff --git a/.github/workflows/bot-make-migrators.yml b/.github/workflows/bot-make-migrators.yml index 87b4e2140..060bb7921 100644 --- a/.github/workflows/bot-make-migrators.yml +++ b/.github/workflows/bot-make-migrators.yml @@ -47,6 +47,7 @@ jobs: env: CF_TICK_GRAPH_DATA_BACKENDS: "${{ vars.CF_TICK_GRAPH_DATA_BACKENDS }}" MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }} + CF_TICK_CONTAINER_TAG: latest - name: deploy if: github.ref == 'refs/heads/master' && always() && ! env.CI_SKIP diff --git a/.github/workflows/bot-prs.yml b/.github/workflows/bot-prs.yml index 65cee0579..fae76bcbc 100644 --- a/.github/workflows/bot-prs.yml +++ b/.github/workflows/bot-prs.yml @@ -54,6 +54,7 @@ jobs: BOT_JOB: ${{ matrix.job_num }} CF_TICK_GRAPH_DATA_BACKENDS: "${{ vars.CF_TICK_GRAPH_DATA_BACKENDS }}" MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }} + CF_TICK_CONTAINER_TAG: latest - name: deploy if: github.ref == 'refs/heads/master' && ! cancelled() && ! env.CI_SKIP diff --git a/.github/workflows/bot-pypi-mapping.yml b/.github/workflows/bot-pypi-mapping.yml index b9ce6d694..69f8e0ea8 100644 --- a/.github/workflows/bot-pypi-mapping.yml +++ b/.github/workflows/bot-pypi-mapping.yml @@ -45,6 +45,7 @@ jobs: conda-forge-tick make-import-to-package-mapping env: BOT_TOKEN: ${{ secrets.AUTOTICK_BOT_TOKEN }} + CF_TICK_CONTAINER_TAG: latest - name: build pypi mapping if: success() && ! env.CI_SKIP @@ -54,6 +55,7 @@ jobs: conda-forge-tick make-mappings env: BOT_TOKEN: ${{ secrets.AUTOTICK_BOT_TOKEN }} + CF_TICK_CONTAINER_TAG: latest - name: deploy if: github.ref == 'refs/heads/master' && ! cancelled() && ! env.CI_SKIP diff --git a/.github/workflows/bot-update-status-page.yml b/.github/workflows/bot-update-status-page.yml index e8f7cdf3c..0bf5e03b8 100644 --- a/.github/workflows/bot-update-status-page.yml +++ b/.github/workflows/bot-update-status-page.yml @@ -43,6 +43,7 @@ jobs: conda-forge-tick make-status-report env: BOT_TOKEN: ${{ secrets.AUTOTICK_BOT_TOKEN }} + CF_TICK_CONTAINER_TAG: latest - name: deploy if: github.ref == 'refs/heads/master' && ! cancelled() && ! env.CI_SKIP diff --git a/.github/workflows/bot-versions.yml b/.github/workflows/bot-versions.yml index 32c4b2cda..9f186b77d 100644 --- a/.github/workflows/bot-versions.yml +++ b/.github/workflows/bot-versions.yml @@ -51,6 +51,7 @@ jobs: BOT_JOB: ${{ matrix.job_num }} CF_TICK_GRAPH_DATA_BACKENDS: "${{ vars.CF_TICK_GRAPH_DATA_BACKENDS }}" MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }} + CF_TICK_CONTAINER_TAG: latest - name: deploy if: github.ref == 'refs/heads/master' && ! cancelled() && ! env.CI_SKIP