From 5337a0e223aecf3446886edbb187dcdf7b74213e Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Wed, 22 Oct 2025 13:39:10 -0700 Subject: [PATCH 1/6] Enable expiration of CICD job artifacts We have accumulated nearly 200GB of old artifacts that we do not need. --- .gitlab-ci.yml | 4 ++++ changelog.d/ci-artifacts.skip | 0 2 files changed, 4 insertions(+) create mode 100644 changelog.d/ci-artifacts.skip diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 675d0e067..1e86d0aab 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,5 +1,9 @@ image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.14.5-otp-25 +default: + artifacts: + expire_in: 1 week + variables: &global_variables # Only used for the release ELIXIR_VER: 1.17.3 diff --git a/changelog.d/ci-artifacts.skip b/changelog.d/ci-artifacts.skip new file mode 100644 index 000000000..e69de29bb From aab65fe854863e2a82cd6b7b0dbeff6d90c0ed2c Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 23 Oct 2025 10:58:11 -0700 Subject: [PATCH 2/6] GitLab support for default artifacts setting is broken https://gitlab.com/gitlab-org/gitlab/-/issues/404563 --- .gitlab-ci.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e86d0aab..a959c37ee 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,9 +1,5 @@ image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.14.5-otp-25 -default: - artifacts: - expire_in: 1 week - variables: &global_variables # Only used for the release ELIXIR_VER: 1.17.3 @@ -22,6 +18,10 @@ workflow: when: never - if: $CI_COMMIT_BRANCH +# Default artifacts configuration +.default_artifacts: &default_artifacts + expire_in: 30 days + cache: &global_cache_policy key: $CI_JOB_IMAGE-$CI_COMMIT_SHORT_SHA paths: @@ -59,6 +59,7 @@ check-changelog: before_script: '' after_script: '' cache: {} + artifacts: *default_artifacts script: - apk add git - sh ./tools/check-changelog @@ -74,6 +75,7 @@ check-changelog: .using-ci-base: tags: - amd64 + artifacts: *default_artifacts build-1.14.5-otp-25: extends: @@ -104,6 +106,7 @@ spec-build: artifacts: paths: - spec.json + expire_in: 42 years script: - mix pleroma.openapi_spec spec.json @@ -141,6 +144,7 @@ unit-testing-1.14.5-otp-25: - mix pleroma.test_runner --cover --preload-modules coverage: '/^Line total: ([^ ]*%)$/' artifacts: + expire_in: 30 days reports: coverage_report: coverage_format: cobertura @@ -158,6 +162,7 @@ unit-testing-1.17.1-otp-26: formatting-1.15: extends: .build_changes_policy + artifacts: *default_artifacts image: &formatting_elixir elixir:1.15-alpine stage: lint cache: *testing_cache_policy @@ -172,6 +177,7 @@ formatting-1.15: cycles-1.15: extends: .build_changes_policy + artifacts: *default_artifacts image: *formatting_elixir stage: lint cache: {} @@ -195,7 +201,7 @@ dialyzer: - .using-ci-base stage: lint allow_failure: true - when: manual + when: manual cache: *testing_cache_policy tags: - feld @@ -204,6 +210,7 @@ dialyzer: docs-deploy: stage: deploy + artifacts: *default_artifacts cache: *testing_cache_policy image: alpine:latest only: @@ -228,6 +235,7 @@ review_app: except: - master - develop + artifacts: *default_artifacts script: - echo "$CI_ENVIRONMENT_SLUG" - mkdir -p ~/.ssh @@ -247,6 +255,7 @@ spec-deploy: artifacts: paths: - spec.json + expire_in: 30 days only: - develop@pleroma/pleroma image: alpine:latest @@ -259,6 +268,7 @@ spec-deploy: stop_review_app: image: alpine:3.9 stage: deploy + artifacts: *default_artifacts before_script: - apk update && apk add openssh-client git when: manual From a39f08242a73683a6f2da648b0c96893db4e0077 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 23 Oct 2025 11:44:11 -0700 Subject: [PATCH 3/6] CI: Allow running pipelines from web or directly for a tag --- .gitlab-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a959c37ee..78750e099 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,6 +14,10 @@ variables: &global_variables workflow: rules: - if: $CI_PIPELINE_SOURCE == "merge_request_event" + - if: $CI_COMMIT_BRANCH == "develop" + - if: $CI_COMMIT_BRANCH == "stable" + - if: $CI_PIPELINE_SOURCE == "web" + - if: $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS when: never - if: $CI_COMMIT_BRANCH From ea38015c9c0b9f115ce5e2e4768d9a1775c56757 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 23 Oct 2025 12:12:19 -0700 Subject: [PATCH 4/6] CI: use triggers for docs and api-docs deployments This is a "bridge job" which is more efficient. We do not need a token or API call then to make the CI run in the target repos. --- .gitlab-ci.yml | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 78750e099..d9a2fdb0f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -214,16 +214,14 @@ dialyzer: docs-deploy: stage: deploy - artifacts: *default_artifacts - cache: *testing_cache_policy - image: alpine:latest + trigger: + project: pleroma/docs + branch: develop + strategy: depend only: - stable@pleroma/pleroma - develop@pleroma/pleroma - before_script: - - apk add curl - script: - - curl --fail-with-body -X POST -F"token=$CI_JOB_TOKEN" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" https://git.pleroma.social/api/v4/projects/673/trigger/pipeline + review_app: image: alpine:3.9 stage: deploy @@ -256,18 +254,12 @@ review_app: spec-deploy: stage: deploy - artifacts: - paths: - - spec.json - expire_in: 30 days + trigger: + project: pleroma/api-docs + branch: develop + strategy: depend only: - develop@pleroma/pleroma - image: alpine:latest - before_script: - - apk add curl - script: - - curl --fail-with-body -X POST -F"token=$CI_JOB_TOKEN" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" -F"variables[JOB_REF]=$CI_JOB_ID" https://git.pleroma.social/api/v4/projects/1130/trigger/pipeline - stop_review_app: image: alpine:3.9 From 464fb3fb602cf8ca80408e16ad05fbe81a69ef52 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 23 Oct 2025 13:41:26 -0700 Subject: [PATCH 5/6] Fix branch names for pleroma/docs and pleroma/api-docs triggers --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d9a2fdb0f..be50cf01e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -216,7 +216,7 @@ docs-deploy: stage: deploy trigger: project: pleroma/docs - branch: develop + branch: master strategy: depend only: - stable@pleroma/pleroma @@ -256,7 +256,7 @@ spec-deploy: stage: deploy trigger: project: pleroma/api-docs - branch: develop + branch: master strategy: depend only: - develop@pleroma/pleroma From 929ed42a44742ffd7ea0683a2665422b301e13d1 Mon Sep 17 00:00:00 2001 From: Mark Felder Date: Thu, 23 Oct 2025 21:10:13 -0700 Subject: [PATCH 6/6] CI: Use the dotenv report method to capture the spec-build internal job id and pass it through to the spec-deploy job --- .gitlab-ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index be50cf01e..30adf4fff 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -110,9 +110,12 @@ spec-build: artifacts: paths: - spec.json + reports: + dotenv: build.env expire_in: 42 years script: - mix pleroma.openapi_spec spec.json + - echo "SPEC_BUILD_JOB_ID=$CI_JOB_ID" >> build.env benchmark: extends: @@ -260,6 +263,8 @@ spec-deploy: strategy: depend only: - develop@pleroma/pleroma + variables: + SPEC_BUILD_JOB_ID: $SPEC_BUILD_JOB_ID stop_review_app: image: alpine:3.9