mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-22 05:36:16 +00:00
chore(ci): remove old releases from forgejo-integration
The releases are created when: * a tag is pushed to the integration repository it will create a vX.Y.Z release * a new commit is pushed to a branch and mirrored to the integration repository, it will create a vX.Y-test release named after the branch When both vX.Y.Z and vX.Y-test release are present, the end-to-end tests will use vX.Y.Z because it comes first in release sort order. This ensures that a last round of end-to-end tests is run from the release built in the integration repository, exactly as it will be published and signed. In between stable releases, the vX.Y-test releases are built daily and must be used instead for end-to-end testing so that problems can be detected as soon as possible. For that to happen, the stable release must be removed from the integration repository and this is done 24h after they were published. The vX.Y-test releases are removed if they have not been updated in 18 months. As of August 2024 it is possible for a LTS to still be needed in tests over a year after it was last updated, although it is unlikely that such a lack of activity happens, there is no reason to remove the test release before that.
This commit is contained in:
parent
3b82a634c5
commit
6e94be527a
40
.forgejo/workflows/forgejo-integration-cleanup.yml
Normal file
40
.forgejo/workflows/forgejo-integration-cleanup.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
schedule:
|
||||
- cron: '@daily'
|
||||
|
||||
jobs:
|
||||
integration-cleanup:
|
||||
if: vars.ROLE == 'forgejo-integration'
|
||||
runs-on: docker
|
||||
container:
|
||||
image: 'code.forgejo.org/oci/node:20-bookworm'
|
||||
steps:
|
||||
|
||||
- name: apt install curl jq
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update -qq
|
||||
apt-get -q install -qq -y curl jq
|
||||
|
||||
- name: remove old releases and tags
|
||||
run: |
|
||||
url=https://any:${{ secrets.TOKEN }}@codeberg.org
|
||||
curl -sS "$url/api/v1/repos/forgejo-integration/forgejo/releases" | jq -r '.[] | "\(.published_at) \(.tag_name)"' | sort | while read published_at version ; do
|
||||
if echo $version | grep -e '-test$' >/dev/null; then
|
||||
old="18 months"
|
||||
else
|
||||
old="1 day"
|
||||
fi
|
||||
too_old=$(env -i date --date="- $old" +%F)
|
||||
too_old_seconds=$(env -i date --date="- $old" +%s)
|
||||
published_at_seconds=$(env -i date --date="$published_at" +%s)
|
||||
if test $published_at_seconds -le $too_old_seconds ; then
|
||||
echo "$version was published more than $old ago ($published_at <= $too_old) and will be removed"
|
||||
curl -X DELETE -sS "$url/api/v1/repos/forgejo-integration/forgejo/releases/tags/$version"
|
||||
curl -X DELETE -sS "$url/api/v1/repos/forgejo-integration/forgejo/tags/$version"
|
||||
else
|
||||
echo "$version was published less than $old ago"
|
||||
fi
|
||||
done
|
Loading…
Reference in a new issue