Merge pull request 'woodpecker-releases' (#7878) from woodpecker-releases into develop
Reviewed-on: https://git.pleroma.social/pleroma/pleroma/pulls/7878
This commit is contained in:
commit
93c155e4fa
12 changed files with 1077 additions and 9 deletions
|
|
@ -1,9 +1,16 @@
|
||||||
when:
|
when:
|
||||||
- event: pull_request
|
- event: pull_request
|
||||||
|
|
||||||
|
variables:
|
||||||
|
script_file_entrypoint: &script_file_entrypoint
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
check-changelog:
|
check-changelog:
|
||||||
image: docker.io/alpine:3.23
|
image: docker.io/alpine:3.23
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
commands:
|
commands:
|
||||||
- apk add --no-cache git
|
- apk add --no-cache git
|
||||||
- sh ./tools/check-changelog
|
- sh ./tools/check-changelog
|
||||||
|
|
|
||||||
53
.woodpecker/docker-combine.yaml
Normal file
53
.woodpecker/docker-combine.yaml
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**", "Dockerfile" ]
|
||||||
|
- event: tag
|
||||||
|
- event: manual
|
||||||
|
branch: stable
|
||||||
|
|
||||||
|
depends_on:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
skip_clone: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
docker-develop-combine:
|
||||||
|
image: git.fluffytail.org/phnt/wpc-docker-tagger:latest
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
settings: &docker_settings
|
||||||
|
registry: "git.pleroma.social"
|
||||||
|
image: "pleroma/pleroma"
|
||||||
|
architectures: [amd64, arm64]
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
- develop
|
||||||
|
- ${CI_COMMIT_SHA:0:8}
|
||||||
|
username:
|
||||||
|
from_secret: pleroma-ci-user
|
||||||
|
password:
|
||||||
|
from_secret: pleroma-ci-password
|
||||||
|
|
||||||
|
docker-stable-combine:
|
||||||
|
image: git.fluffytail.org/phnt/wpc-docker-tagger:latest
|
||||||
|
when:
|
||||||
|
- evaluate: 'CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG == ""'
|
||||||
|
settings:
|
||||||
|
<<: *docker_settings
|
||||||
|
tags: &stable_docker_tags
|
||||||
|
- latest
|
||||||
|
- stable
|
||||||
|
- ${CI_COMMIT_SHA:0:8}
|
||||||
|
|
||||||
|
docker-stable-tag-combine:
|
||||||
|
image: git.fluffytail.org/phnt/wpc-docker-tagger:latest
|
||||||
|
when:
|
||||||
|
- event: tag
|
||||||
|
- evaluate: 'CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG != ""'
|
||||||
|
settings:
|
||||||
|
<<: *docker_settings
|
||||||
|
tags:
|
||||||
|
- <<: *stable_docker_tags
|
||||||
|
- ${CI_COMMIT_TAG}
|
||||||
94
.woodpecker/docker.yaml
Normal file
94
.woodpecker/docker.yaml
Normal file
|
|
@ -0,0 +1,94 @@
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**", "Dockerfile" ]
|
||||||
|
- event: tag
|
||||||
|
- event: manual
|
||||||
|
branch: stable
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
|
||||||
|
# This is needed for the when clauses below.
|
||||||
|
labels:
|
||||||
|
platform: ${platform}
|
||||||
|
memory: 'high'
|
||||||
|
|
||||||
|
variables:
|
||||||
|
docker_variables: &docker_variables
|
||||||
|
repo: pleroma/pleroma
|
||||||
|
registry: git.pleroma.social
|
||||||
|
username:
|
||||||
|
from_secret: pleroma-ci-user
|
||||||
|
password:
|
||||||
|
from_secret: pleroma-ci-password
|
||||||
|
kaniko_image: &kaniko_image woodpeckerci/plugin-kaniko:2.3.1
|
||||||
|
|
||||||
|
steps:
|
||||||
|
docker-develop-amd64:
|
||||||
|
image: woodpeckerci/plugin-kaniko:2.3.1
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
settings:
|
||||||
|
<<: *docker_variables
|
||||||
|
tags:
|
||||||
|
- latest-amd64
|
||||||
|
- develop-amd64
|
||||||
|
- ${CI_COMMIT_SHA:0:8}-amd64
|
||||||
|
|
||||||
|
docker-develop-arm64:
|
||||||
|
image: woodpeckerci/plugin-kaniko:2.3.1
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
settings:
|
||||||
|
<<: *docker_variables
|
||||||
|
tags:
|
||||||
|
- latest-arm64
|
||||||
|
- develop-arm64
|
||||||
|
- ${CI_COMMIT_SHA:0:8}-arm64
|
||||||
|
|
||||||
|
docker-stable-amd64:
|
||||||
|
image: *kaniko_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG == ""'
|
||||||
|
settings:
|
||||||
|
<<: *docker_variables
|
||||||
|
tags: &amd64_tags
|
||||||
|
- latest-amd64
|
||||||
|
- stable-amd64
|
||||||
|
- ${CI_COMMIT_SHA:0:8}-amd64
|
||||||
|
|
||||||
|
docker-stable-tag-amd64:
|
||||||
|
image: *kaniko_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG != ""'
|
||||||
|
settings:
|
||||||
|
<<: *docker_variables
|
||||||
|
tags:
|
||||||
|
- <<: *amd64_tags
|
||||||
|
- ${CI_COMMIT_TAG}-amd64
|
||||||
|
|
||||||
|
docker-stable-arm64:
|
||||||
|
image: *kaniko_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG == ""'
|
||||||
|
settings:
|
||||||
|
<<: *docker_variables
|
||||||
|
tags: &arm64_tags
|
||||||
|
- latest-arm64
|
||||||
|
- stable-arm64
|
||||||
|
- ${CI_COMMIT_SHA:0:8}-arm64
|
||||||
|
|
||||||
|
docker-stable-tag-arm64:
|
||||||
|
image: *kaniko_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable" && CI_COMMIT_TAG != ""'
|
||||||
|
settings:
|
||||||
|
<<: *docker_variables
|
||||||
|
tags:
|
||||||
|
- <<: *arm64_tags
|
||||||
|
- ${CI_COMMIT_TAG}-arm64
|
||||||
|
|
@ -5,10 +5,17 @@ when:
|
||||||
branch: ${CI_REPO_DEFAULT_BRANCH}
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
path: [ "*.ex", "*.eex", "*.exs", "mix.lock", ".woodpecker/**" ]
|
path: [ "*.ex", "*.eex", "*.exs", "mix.lock", ".woodpecker/**" ]
|
||||||
|
|
||||||
|
variables:
|
||||||
|
script_file_entrypoint: &script_file_entrypoint
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
mix-format:
|
mix-format:
|
||||||
image: &elixir-image
|
image: &elixir-image
|
||||||
docker.io/elixir:1.15-alpine
|
docker.io/elixir:1.15-alpine
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
failure: ignore
|
failure: ignore
|
||||||
commands:
|
commands:
|
||||||
- |
|
- |
|
||||||
|
|
@ -19,6 +26,7 @@ steps:
|
||||||
|
|
||||||
credo:
|
credo:
|
||||||
image: *elixir-image
|
image: *elixir-image
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
failure: ignore
|
failure: ignore
|
||||||
environment:
|
environment:
|
||||||
MIX_ENV: test
|
MIX_ENV: test
|
||||||
|
|
@ -55,6 +63,7 @@ steps:
|
||||||
|
|
||||||
ensure-status:
|
ensure-status:
|
||||||
image: *elixir-image
|
image: *elixir-image
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
commands: |
|
commands: |
|
||||||
if test -f fail.stamp; then
|
if test -f fail.stamp; then
|
||||||
echo "One or more previous steps fails. Failing workflow..."
|
echo "One or more previous steps fails. Failing workflow..."
|
||||||
|
|
|
||||||
284
.woodpecker/otp-musl.yaml
Normal file
284
.woodpecker/otp-musl.yaml
Normal file
|
|
@ -0,0 +1,284 @@
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||||
|
- event: tag
|
||||||
|
- event: manual
|
||||||
|
branch: stable
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm
|
||||||
|
- linux/arm64
|
||||||
|
|
||||||
|
# This is needed for the when clauses below.
|
||||||
|
# When the platform clause is fixed, this might not be needed anymore
|
||||||
|
labels:
|
||||||
|
platform: ${platform}
|
||||||
|
|
||||||
|
variables:
|
||||||
|
script_file_entrypoint: &script_file_entrypoint
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||||
|
build_cmds: &build_cmds
|
||||||
|
- apk add git build-base cmake file-dev openssl vips-dev zip
|
||||||
|
- echo "import Config" > config/prod.secret.exs
|
||||||
|
- mix local.hex --force
|
||||||
|
- mix local.rebar --force
|
||||||
|
- mix deps.get --only prod
|
||||||
|
- mkdir release
|
||||||
|
- export PLEROMA_BUILD_BRANCH=${CI_COMMIT_BRANCH}
|
||||||
|
- mix release --path release
|
||||||
|
build_image_amd64: &build_image_amd64 docker.io/hexpm/elixir-amd64:1.17.3-erlang-27.3.4.2-alpine-3.22.1
|
||||||
|
build_image_arm: &build_image_arm docker.io/arm32v7/elixir:1.17.3-alpine
|
||||||
|
build_image_arm64: &build_image_arm64 docker.io/hexpm/elixir-arm64:1.17.3-erlang-27.3.4.2-alpine-3.22.1
|
||||||
|
artifacts_uploader_image: &artifacts_uploader_image docker.io/woodpeckercommunity/plugin-gitea-package:0.5.0
|
||||||
|
artifacts_uploader_settings: &artifacts_uploader_settings
|
||||||
|
user:
|
||||||
|
from_secret: pleroma-ci-user
|
||||||
|
password:
|
||||||
|
from_secret: pleroma-ci-password
|
||||||
|
owner: 'pleroma'
|
||||||
|
env: &env
|
||||||
|
MIX_ENV: prod
|
||||||
|
VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
|
||||||
|
|
||||||
|
steps:
|
||||||
|
otp-develop-amd64-musl:
|
||||||
|
image: *build_image_amd64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
environment: *env
|
||||||
|
commands: &amd64_build
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl.zip release
|
||||||
|
|
||||||
|
otp-stable-amd64-musl:
|
||||||
|
image: *build_image_amd64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||||
|
environment: *env
|
||||||
|
commands: *amd64_build
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
otp-stable-tag-amd64-musl:
|
||||||
|
image: *build_image_amd64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
environment: *env
|
||||||
|
commands:
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-amd64-musl.zip release
|
||||||
|
|
||||||
|
otp-develop-arm-musl:
|
||||||
|
image: *build_image_arm
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
environment: *env
|
||||||
|
commands: &arm_build
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl.zip release
|
||||||
|
|
||||||
|
otp-stable-arm-musl:
|
||||||
|
image: *build_image_arm
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||||
|
environment: *env
|
||||||
|
commands: *arm_build
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
otp-stable-tag-arm-musl:
|
||||||
|
image: *build_image_arm
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
environment: *env
|
||||||
|
commands:
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-arm-musl.zip release
|
||||||
|
|
||||||
|
otp-develop-arm64-musl:
|
||||||
|
image: *build_image_arm64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
environment: *env
|
||||||
|
commands: &arm64_build
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl.zip release
|
||||||
|
|
||||||
|
otp-stable-arm64-musl:
|
||||||
|
image: *build_image_arm64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||||
|
environment: *env
|
||||||
|
commands: *arm64_build
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
otp-stable-tag-arm64-musl:
|
||||||
|
image: *build_image_arm64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
environment: *env
|
||||||
|
commands:
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-arm64-musl.zip release
|
||||||
|
|
||||||
|
upload-artifacts-amd64-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-amd64-musl
|
||||||
|
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||||
|
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||||
|
|
||||||
|
upload-latest-amd64-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-amd64-musl
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-artifacts-tag-amd64-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-amd64-musl
|
||||||
|
package_version: stable-${CI_COMMIT_SHA:0:8}-amd64-musl
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||||
|
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-latest-tag-amd64-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-amd64-musl
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-amd64-musl.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
upload-artifacts-arm-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm-musl
|
||||||
|
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||||
|
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||||
|
|
||||||
|
upload-latest-arm-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm-musl
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-artifacts-tag-arm-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-arm-musl
|
||||||
|
package_version: stable-${CI_COMMIT_SHA:0:8}-arm-musl
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||||
|
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-latest-tag-arm-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-arm-musl
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm-musl.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
upload-artifacts-arm64-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm64-musl
|
||||||
|
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||||
|
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||||
|
|
||||||
|
upload-latest-arm64-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm64-musl
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-artifacts-tag-arm64-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-arm64-musl
|
||||||
|
package_version: stable-${CI_COMMIT_SHA:0:8}-arm64-musl
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||||
|
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-latest-tag-arm64-musl:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-arm64-musl
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm64-musl.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
285
.woodpecker/otp.yaml
Normal file
285
.woodpecker/otp.yaml
Normal file
|
|
@ -0,0 +1,285 @@
|
||||||
|
when:
|
||||||
|
- event: push
|
||||||
|
branch: ${CI_REPO_DEFAULT_BRANCH}
|
||||||
|
path: [ "**/*.ex", "**/*.eex", "**/*.exs", "mix.lock", ".woodpecker/**" ]
|
||||||
|
- event: tag
|
||||||
|
- event: manual
|
||||||
|
branch: stable
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
platform:
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm
|
||||||
|
- linux/arm64
|
||||||
|
|
||||||
|
# This is needed for the when clauses below.
|
||||||
|
# When the platform clause is fixed, this might not be needed anymore
|
||||||
|
labels:
|
||||||
|
platform: ${platform}
|
||||||
|
|
||||||
|
variables:
|
||||||
|
script_file_entrypoint: &script_file_entrypoint
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||||
|
build_cmds: &build_cmds
|
||||||
|
- apt-get update && apt-get install -y cmake libmagic-dev libvips-dev erlang-dev git build-essential zip
|
||||||
|
- echo "import Config" > config/prod.secret.exs
|
||||||
|
- mix local.hex --force
|
||||||
|
- mix local.rebar --force
|
||||||
|
- mix deps.get --only prod
|
||||||
|
- mkdir release
|
||||||
|
- export PLEROMA_BUILD_BRANCH=${CI_COMMIT_BRANCH}
|
||||||
|
- mix release --path release
|
||||||
|
build_image_amd64: &build_image_amd64 docker.io/hexpm/elixir-amd64:1.17.3-erlang-27.3.4.2-ubuntu-noble-20250716
|
||||||
|
build_image_arm: &build_image_arm docker.io/arm32v7/elixir:1.17.3
|
||||||
|
build_image_arm64: &build_image_arm64 docker.io/hexpm/elixir-arm64:1.17.3-erlang-27.3.4.2-ubuntu-noble-20250716
|
||||||
|
artifacts_uploader_image: &artifacts_uploader_image docker.io/woodpeckercommunity/plugin-gitea-package:0.5.0
|
||||||
|
artifacts_uploader_settings: &artifacts_uploader_settings
|
||||||
|
user:
|
||||||
|
from_secret: pleroma-ci-user
|
||||||
|
password:
|
||||||
|
from_secret: pleroma-ci-password
|
||||||
|
owner: 'pleroma'
|
||||||
|
env: &env
|
||||||
|
MIX_ENV: prod
|
||||||
|
VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
|
||||||
|
DEBIAN_FRONTEND: noninteractive
|
||||||
|
|
||||||
|
steps:
|
||||||
|
otp-develop-amd64:
|
||||||
|
image: *build_image_amd64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
environment: *env
|
||||||
|
commands: &amd64_build
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64.zip release
|
||||||
|
|
||||||
|
otp-stable-amd64:
|
||||||
|
image: *build_image_amd64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||||
|
environment: *env
|
||||||
|
commands: *amd64_build
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
otp-stable-tag-amd64:
|
||||||
|
image: *build_image_amd64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
environment: *env
|
||||||
|
commands:
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-amd64.zip release
|
||||||
|
|
||||||
|
otp-develop-arm:
|
||||||
|
image: *build_image_arm
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
environment: *env
|
||||||
|
commands: &arm_build
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm.zip release
|
||||||
|
|
||||||
|
otp-stable-arm:
|
||||||
|
image: *build_image_arm
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||||
|
environment: *env
|
||||||
|
commands: *arm_build
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
otp-stable-tag-arm:
|
||||||
|
image: *build_image_arm
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
environment: *env
|
||||||
|
commands:
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-arm.zip release
|
||||||
|
|
||||||
|
otp-develop-arm64:
|
||||||
|
image: *build_image_arm64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
environment: *env
|
||||||
|
commands: &arm64_build
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64.zip release
|
||||||
|
|
||||||
|
otp-stable-arm64:
|
||||||
|
image: *build_image_arm64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual" && CI_COMMIT_BRANCH == "stable"'
|
||||||
|
environment: *env
|
||||||
|
commands: *arm64_build
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
otp-stable-tag-arm64:
|
||||||
|
image: *build_image_arm64
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
environment: *env
|
||||||
|
commands:
|
||||||
|
- <<: *build_cmds
|
||||||
|
- zip -9rq stable-${CI_COMMIT_SHA:0:8}-arm64.zip release
|
||||||
|
|
||||||
|
upload-artifacts-amd64:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-amd64
|
||||||
|
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||||
|
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||||
|
|
||||||
|
upload-latest-amd64:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-amd64
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-artifacts-tag-amd64:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-amd64
|
||||||
|
package_version: stable-${CI_COMMIT_SHA:0:8}-amd64
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||||
|
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-latest-tag-amd64:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/amd64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-amd64
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-amd64.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
upload-artifacts-arm:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm
|
||||||
|
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||||
|
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||||
|
|
||||||
|
upload-latest-arm:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-artifacts-tag-arm:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-arm
|
||||||
|
package_version: stable-${CI_COMMIT_SHA:0:8}-arm
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||||
|
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-latest-tag-arm:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-arm
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
upload-artifacts-arm64:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm64
|
||||||
|
package_version: ${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||||
|
file_name: pleroma-${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||||
|
|
||||||
|
upload-latest-arm64:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "push" && CI_COMMIT_BRANCH == "${CI_REPO_DEFAULT_BRANCH}"'
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "manual"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-${CI_COMMIT_BRANCH}-arm64
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./${CI_COMMIT_BRANCH}-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-artifacts-tag-arm64:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-arm64
|
||||||
|
package_version: stable-${CI_COMMIT_SHA:0:8}-arm64
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||||
|
file_name: pleroma-stable-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||||
|
|
||||||
|
# Tag events don't have CI_COMMIT_BRANCH set, hardcode stable
|
||||||
|
upload-latest-tag-arm64:
|
||||||
|
image: *artifacts_uploader_image
|
||||||
|
when:
|
||||||
|
- evaluate: 'platform == "linux/arm64" && CI_PIPELINE_EVENT == "tag"'
|
||||||
|
settings:
|
||||||
|
<<: *artifacts_uploader_settings
|
||||||
|
package_name: pleroma-otp-stable-arm64
|
||||||
|
package_version: latest
|
||||||
|
file_source: ./stable-${CI_COMMIT_SHA:0:8}-arm64.zip
|
||||||
|
file_name: pleroma.zip
|
||||||
|
update: 'true'
|
||||||
|
|
@ -8,9 +8,16 @@ when:
|
||||||
depends_on:
|
depends_on:
|
||||||
- lint
|
- lint
|
||||||
|
|
||||||
|
variables:
|
||||||
|
script_file_entrypoint: &script_file_entrypoint
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
unit-testing-elixir-1.15:
|
unit-testing-elixir-1.15:
|
||||||
image: elixir:1.15-alpine
|
image: elixir:1.15-alpine
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
environment:
|
environment:
|
||||||
MIX_ENV: test
|
MIX_ENV: test
|
||||||
DB_HOST: postgres
|
DB_HOST: postgres
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,16 @@ when:
|
||||||
depends_on:
|
depends_on:
|
||||||
- lint
|
- lint
|
||||||
|
|
||||||
|
variables:
|
||||||
|
script_file_entrypoint: &script_file_entrypoint
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- 'printf "%s" "$CI_SCRIPT" | base64 -d > /tmp/ci-script.sh && /bin/sh -xe /tmp/ci-script.sh'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
unit-testing-elixir-1.18:
|
unit-testing-elixir-1.18:
|
||||||
image: elixir:1.18-otp-27-alpine
|
image: elixir:1.18-otp-27-alpine
|
||||||
|
entrypoint: *script_file_entrypoint
|
||||||
environment:
|
environment:
|
||||||
MIX_ENV: test
|
MIX_ENV: test
|
||||||
DB_HOST: postgres
|
DB_HOST: postgres
|
||||||
|
|
|
||||||
0
changelog.d/woodpecker-release-pipeline.skip
Normal file
0
changelog.d/woodpecker-release-pipeline.skip
Normal file
|
|
@ -5,7 +5,10 @@
|
||||||
defmodule Pleroma.ReleaseTasks do
|
defmodule Pleroma.ReleaseTasks do
|
||||||
@repo Pleroma.Repo
|
@repo Pleroma.Repo
|
||||||
|
|
||||||
def run(args) do
|
# TODO: Kept for some backwards compatibility with buggy pleroma_ctl,
|
||||||
|
# if a mismatch between pleroma_ctl and Pleroma accidentaly happens.
|
||||||
|
# Remove in the future.
|
||||||
|
def run(args) when is_binary(args) do
|
||||||
[task | args] = String.split(args)
|
[task | args] = String.split(args)
|
||||||
|
|
||||||
case task do
|
case task do
|
||||||
|
|
@ -16,6 +19,20 @@ defmodule Pleroma.ReleaseTasks do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# HACK: Script arguments need to be received as a list, otherwise (quoted) arguments with
|
||||||
|
# whitespace will be broken. Previously the broken string form above was used,
|
||||||
|
# escaping in the shell does not help.
|
||||||
|
def run(args) when is_list(args) do
|
||||||
|
[task | args] = args
|
||||||
|
|
||||||
|
case task do
|
||||||
|
"migrate" -> migrate(args)
|
||||||
|
"create" -> create()
|
||||||
|
"rollback" -> rollback(args)
|
||||||
|
task -> mix_task(task, args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def find_module(task) do
|
def find_module(task) do
|
||||||
module_name =
|
module_name =
|
||||||
task
|
task
|
||||||
|
|
|
||||||
|
|
@ -78,14 +78,19 @@ update() {
|
||||||
|
|
||||||
RELEASE_ROOT=$(dirname "$SCRIPTPATH")
|
RELEASE_ROOT=$(dirname "$SCRIPTPATH")
|
||||||
uri="https://git.pleroma.social"
|
uri="https://git.pleroma.social"
|
||||||
project_id="2"
|
project_name="pleroma"
|
||||||
project_branch="${BRANCH:-$(detect_branch)}"
|
package_base="${uri}/api/packages/${project_name}/generic"
|
||||||
flavour="${FLAVOUR:-$(detect_flavour)}"
|
if [ -n "$FULL_URI" ]; then
|
||||||
|
full_uri="$FULL_URI"
|
||||||
|
else
|
||||||
|
project_branch="${BRANCH:-$(detect_branch)}"
|
||||||
|
flavour="${FLAVOUR:-$(detect_flavour)}"
|
||||||
|
full_uri="${package_base}"/pleroma-otp-"${project_branch}"-"${flavour}"/latest/pleroma.zip
|
||||||
|
fi
|
||||||
tmp="${TMP_DIR:-/tmp}"
|
tmp="${TMP_DIR:-/tmp}"
|
||||||
artifact="$tmp/pleroma.zip"
|
artifact="$tmp/pleroma.zip"
|
||||||
full_uri="${FULL_URI:-${uri}/api/v4/projects/${project_id}/jobs/artifacts/${project_branch}/download?job=${flavour}}"
|
|
||||||
echo "Downloading the artifact from ${full_uri} to ${artifact}"
|
echo "Downloading the artifact from ${full_uri} to ${artifact}"
|
||||||
curl "$full_uri" -o "${artifact}"
|
curl -fL "$full_uri" -o "${artifact}"
|
||||||
echo "Unpacking ${artifact} to ${tmp}"
|
echo "Unpacking ${artifact} to ${tmp}"
|
||||||
unzip -q "$artifact" -d "$tmp"
|
unzip -q "$artifact" -d "$tmp"
|
||||||
echo "Copying files over to $RELEASE_ROOT"
|
echo "Copying files over to $RELEASE_ROOT"
|
||||||
|
|
@ -137,7 +142,14 @@ else
|
||||||
SCRIPT=$(realpath "$0")
|
SCRIPT=$(realpath "$0")
|
||||||
SCRIPTPATH=$(dirname "$SCRIPT")
|
SCRIPTPATH=$(dirname "$SCRIPT")
|
||||||
|
|
||||||
FULL_ARGS="$*"
|
# HACK: Script arguments need to be sent as an array to Mix tasks, otherwise they will break (quoted) arguments with whitespace.
|
||||||
|
# Previously it was sent as string, which would get split on whitespace on the task side.
|
||||||
|
# Encode as Elixir binary literals to avoid string escaping and interpolation issues.
|
||||||
|
PREPARED_ARGS=""
|
||||||
|
for arg in "$@"; do
|
||||||
|
bytes=$(printf '%s' "$arg" | od -An -v -tu1 | tr -s '[:space:]' ',' | sed 's/^,//; s/,$//')
|
||||||
|
PREPARED_ARGS="$PREPARED_ARGS <<$bytes>>,"
|
||||||
|
done
|
||||||
|
|
||||||
ACTION="$1"
|
ACTION="$1"
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
|
|
@ -154,8 +166,8 @@ else
|
||||||
if [ "$ACTION" = "update" ]; then
|
if [ "$ACTION" = "update" ]; then
|
||||||
update "$@"
|
update "$@"
|
||||||
elif [ "$ACTION" = "migrate" ] || [ "$ACTION" = "rollback" ] || [ "$ACTION" = "create" ] || [ "$ACTION $SUBACTION" = "instance gen" ] || [ "$PLEROMA_CTL_RPC_DISABLED" = true ]; then
|
elif [ "$ACTION" = "migrate" ] || [ "$ACTION" = "rollback" ] || [ "$ACTION" = "create" ] || [ "$ACTION $SUBACTION" = "instance gen" ] || [ "$PLEROMA_CTL_RPC_DISABLED" = true ]; then
|
||||||
"$SCRIPTPATH"/pleroma eval 'Pleroma.ReleaseTasks.run("'"$FULL_ARGS"'")'
|
"$SCRIPTPATH"/pleroma eval 'Pleroma.ReleaseTasks.run(['"${PREPARED_ARGS%%,}"'])'
|
||||||
else
|
else
|
||||||
"$SCRIPTPATH"/pleroma rpc 'Pleroma.ReleaseTasks.run("'"$FULL_ARGS"'")'
|
"$SCRIPTPATH"/pleroma rpc 'Pleroma.ReleaseTasks.run(['"${PREPARED_ARGS%%,}"'])'
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
293
test/pleroma/pleroma_ctl_test.exs
Normal file
293
test/pleroma/pleroma_ctl_test.exs
Normal file
|
|
@ -0,0 +1,293 @@
|
||||||
|
# Pleroma: A lightweight social networking server
|
||||||
|
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
||||||
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
defmodule Pleroma.PleromaCtlTest do
|
||||||
|
use ExUnit.Case, async: false
|
||||||
|
|
||||||
|
@pleroma_ctl Path.expand("../../rel/files/bin/pleroma_ctl", __DIR__)
|
||||||
|
|
||||||
|
setup do
|
||||||
|
tmp_dir =
|
||||||
|
Path.join(System.tmp_dir!(), "pleroma_ctl_test_#{System.unique_integer([:positive])}")
|
||||||
|
|
||||||
|
release_root = Path.join(tmp_dir, "release")
|
||||||
|
bin_dir = Path.join(release_root, "bin")
|
||||||
|
|
||||||
|
File.mkdir_p!(bin_dir)
|
||||||
|
File.cp!(@pleroma_ctl, Path.join(bin_dir, "pleroma_ctl"))
|
||||||
|
File.chmod!(Path.join(bin_dir, "pleroma_ctl"), 0o755)
|
||||||
|
|
||||||
|
on_exit(fn -> File.rm_rf!(tmp_dir) end)
|
||||||
|
|
||||||
|
{:ok, tmp_dir: tmp_dir, release_root: release_root, bin_dir: bin_dir}
|
||||||
|
end
|
||||||
|
|
||||||
|
test "update downloads branch-scoped latest OTP package", %{
|
||||||
|
tmp_dir: tmp_dir,
|
||||||
|
bin_dir: bin_dir,
|
||||||
|
release_root: release_root
|
||||||
|
} do
|
||||||
|
stubs_dir = Path.join(tmp_dir, "stubs")
|
||||||
|
curl_args_path = Path.join(tmp_dir, "curl.args")
|
||||||
|
File.mkdir_p!(stubs_dir)
|
||||||
|
write_update_stubs(stubs_dir, curl_args_path, "unused", "glibc")
|
||||||
|
|
||||||
|
update_tmp_dir = Path.join(tmp_dir, "update_tmp")
|
||||||
|
File.mkdir_p!(update_tmp_dir)
|
||||||
|
|
||||||
|
{output, status} =
|
||||||
|
System.cmd(
|
||||||
|
Path.join(bin_dir, "pleroma_ctl"),
|
||||||
|
[
|
||||||
|
"update",
|
||||||
|
"--branch",
|
||||||
|
"develop",
|
||||||
|
"--flavour",
|
||||||
|
"amd64",
|
||||||
|
"--tmp-dir",
|
||||||
|
update_tmp_dir,
|
||||||
|
"--no-rm"
|
||||||
|
],
|
||||||
|
env: [{"PATH", stubs_dir <> ":" <> System.get_env("PATH", "")}],
|
||||||
|
stderr_to_stdout: true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert status == 0, output
|
||||||
|
assert File.exists?(Path.join(release_root, "bin/marker"))
|
||||||
|
|
||||||
|
assert ["-fL", url, "-o", artifact_path] =
|
||||||
|
curl_args_path
|
||||||
|
|> File.read!()
|
||||||
|
|> String.split("\n", trim: true)
|
||||||
|
|
||||||
|
assert url ==
|
||||||
|
"https://git.pleroma.social/api/packages/pleroma/generic/pleroma-otp-develop-amd64/latest/pleroma.zip"
|
||||||
|
|
||||||
|
assert artifact_path == Path.join(update_tmp_dir, "pleroma.zip")
|
||||||
|
end
|
||||||
|
|
||||||
|
test "update detects stable branch and local flavour", %{
|
||||||
|
tmp_dir: tmp_dir,
|
||||||
|
bin_dir: bin_dir,
|
||||||
|
release_root: release_root
|
||||||
|
} do
|
||||||
|
stubs_dir = Path.join(tmp_dir, "stubs")
|
||||||
|
curl_args_path = Path.join(tmp_dir, "curl.args")
|
||||||
|
File.mkdir_p!(stubs_dir)
|
||||||
|
write_update_stubs(stubs_dir, curl_args_path, "x86_64", "glibc")
|
||||||
|
write_start_erl_data(release_root, "2.10.0")
|
||||||
|
|
||||||
|
{output, status} =
|
||||||
|
System.cmd(
|
||||||
|
Path.join(bin_dir, "pleroma_ctl"),
|
||||||
|
["update", "--tmp-dir", create_update_tmp_dir(tmp_dir), "--no-rm"],
|
||||||
|
env: [{"PATH", stubs_dir <> ":" <> System.get_env("PATH", "")}],
|
||||||
|
stderr_to_stdout: true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert status == 0, output
|
||||||
|
|
||||||
|
assert curl_url(curl_args_path) ==
|
||||||
|
"https://git.pleroma.social/api/packages/pleroma/generic/pleroma-otp-stable-amd64/latest/pleroma.zip"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "update detects develop branch and musl arm flavour", %{
|
||||||
|
tmp_dir: tmp_dir,
|
||||||
|
bin_dir: bin_dir,
|
||||||
|
release_root: release_root
|
||||||
|
} do
|
||||||
|
stubs_dir = Path.join(tmp_dir, "stubs")
|
||||||
|
curl_args_path = Path.join(tmp_dir, "curl.args")
|
||||||
|
File.mkdir_p!(stubs_dir)
|
||||||
|
write_update_stubs(stubs_dir, curl_args_path, "armv7l", "musl")
|
||||||
|
write_start_erl_data(release_root, "2.10.0.develop")
|
||||||
|
|
||||||
|
{output, status} =
|
||||||
|
System.cmd(
|
||||||
|
Path.join(bin_dir, "pleroma_ctl"),
|
||||||
|
["update", "--tmp-dir", create_update_tmp_dir(tmp_dir), "--no-rm"],
|
||||||
|
env: [{"PATH", stubs_dir <> ":" <> System.get_env("PATH", "")}],
|
||||||
|
stderr_to_stdout: true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert status == 0, output
|
||||||
|
|
||||||
|
assert curl_url(curl_args_path) ==
|
||||||
|
"https://git.pleroma.social/api/packages/pleroma/generic/pleroma-otp-develop-arm-musl/latest/pleroma.zip"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "update with zip URL bypasses branch and flavour detection", %{
|
||||||
|
tmp_dir: tmp_dir,
|
||||||
|
bin_dir: bin_dir,
|
||||||
|
release_root: release_root
|
||||||
|
} do
|
||||||
|
stubs_dir = Path.join(tmp_dir, "stubs")
|
||||||
|
curl_args_path = Path.join(tmp_dir, "curl.args")
|
||||||
|
File.mkdir_p!(stubs_dir)
|
||||||
|
write_update_stubs(stubs_dir, curl_args_path, "unsupported-arch", "unsupported-libc")
|
||||||
|
write_start_erl_data(release_root, "2.10.0.custombranch")
|
||||||
|
|
||||||
|
custom_url = "https://example.test/custom.zip"
|
||||||
|
|
||||||
|
{output, status} =
|
||||||
|
System.cmd(
|
||||||
|
Path.join(bin_dir, "pleroma_ctl"),
|
||||||
|
[
|
||||||
|
"update",
|
||||||
|
"--zip-url",
|
||||||
|
custom_url,
|
||||||
|
"--tmp-dir",
|
||||||
|
create_update_tmp_dir(tmp_dir),
|
||||||
|
"--no-rm"
|
||||||
|
],
|
||||||
|
env: [{"PATH", stubs_dir <> ":" <> System.get_env("PATH", "")}],
|
||||||
|
stderr_to_stdout: true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert status == 0, output
|
||||||
|
assert curl_url(curl_args_path) == custom_url
|
||||||
|
end
|
||||||
|
|
||||||
|
test "passes arguments with spaces and Elixir string metacharacters", %{
|
||||||
|
tmp_dir: tmp_dir,
|
||||||
|
bin_dir: bin_dir
|
||||||
|
} do
|
||||||
|
capture_path = Path.join(tmp_dir, "captured_args")
|
||||||
|
eval_path = Path.join(tmp_dir, "pleroma_ctl_eval.exs")
|
||||||
|
|
||||||
|
write_executable(Path.join(bin_dir, "pleroma"), """
|
||||||
|
#!/bin/sh
|
||||||
|
{
|
||||||
|
printf '%s\n' 'defmodule Pleroma.ReleaseTasks do'
|
||||||
|
printf '%s\n' ' def run(args), do: File.write!(System.fetch_env!("PLEROMA_CTL_CAPTURE"), :erlang.term_to_binary(args))'
|
||||||
|
printf '%s\n' 'end'
|
||||||
|
printf '%s\n' "$2"
|
||||||
|
} > "$PLEROMA_CTL_EVAL_FILE"
|
||||||
|
|
||||||
|
exec elixir "$PLEROMA_CTL_EVAL_FILE"
|
||||||
|
""")
|
||||||
|
|
||||||
|
{output, status} =
|
||||||
|
System.cmd(
|
||||||
|
Path.join(bin_dir, "pleroma_ctl"),
|
||||||
|
[
|
||||||
|
"user",
|
||||||
|
"",
|
||||||
|
"has space",
|
||||||
|
~s(has "quote"),
|
||||||
|
~s(has \\ backslash),
|
||||||
|
~S(#{:not_interpolated})
|
||||||
|
],
|
||||||
|
env: [
|
||||||
|
{"PLEROMA_CTL_CAPTURE", capture_path},
|
||||||
|
{"PLEROMA_CTL_EVAL_FILE", eval_path}
|
||||||
|
],
|
||||||
|
stderr_to_stdout: true
|
||||||
|
)
|
||||||
|
|
||||||
|
assert status == 0, output
|
||||||
|
|
||||||
|
assert capture_path
|
||||||
|
|> File.read!()
|
||||||
|
|> :erlang.binary_to_term() == [
|
||||||
|
"user",
|
||||||
|
"",
|
||||||
|
"has space",
|
||||||
|
~s(has "quote"),
|
||||||
|
~s(has \\ backslash),
|
||||||
|
~S(#{:not_interpolated})
|
||||||
|
]
|
||||||
|
end
|
||||||
|
|
||||||
|
defp write_executable(path, contents) do
|
||||||
|
File.write!(path, contents)
|
||||||
|
File.chmod!(path, 0o755)
|
||||||
|
end
|
||||||
|
|
||||||
|
defp write_start_erl_data(release_root, version) do
|
||||||
|
releases_dir = Path.join(release_root, "releases")
|
||||||
|
File.mkdir_p!(releases_dir)
|
||||||
|
File.write!(Path.join(releases_dir, "start_erl.data"), "erts-15.0 #{version}\n")
|
||||||
|
end
|
||||||
|
|
||||||
|
defp create_update_tmp_dir(tmp_dir) do
|
||||||
|
update_tmp_dir = Path.join(tmp_dir, "update_tmp")
|
||||||
|
File.mkdir_p!(update_tmp_dir)
|
||||||
|
update_tmp_dir
|
||||||
|
end
|
||||||
|
|
||||||
|
defp write_update_stubs(stubs_dir, curl_args_path, arch, libc) do
|
||||||
|
write_executable(Path.join(stubs_dir, "curl"), """
|
||||||
|
#!/bin/sh
|
||||||
|
printf '%s\n' "$@" > "#{curl_args_path}"
|
||||||
|
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-o)
|
||||||
|
artifact="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
: > "$artifact"
|
||||||
|
""")
|
||||||
|
|
||||||
|
write_executable(Path.join(stubs_dir, "unzip"), """
|
||||||
|
#!/bin/sh
|
||||||
|
while [ $# -gt 0 ]; do
|
||||||
|
case "$1" in
|
||||||
|
-d)
|
||||||
|
dest="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir -p "$dest/release/bin"
|
||||||
|
printf 'marker' > "$dest/release/bin/marker"
|
||||||
|
""")
|
||||||
|
|
||||||
|
write_executable(Path.join(stubs_dir, "uname"), """
|
||||||
|
#!/bin/sh
|
||||||
|
printf '%s\n' '#{arch}'
|
||||||
|
""")
|
||||||
|
|
||||||
|
write_executable(Path.join(stubs_dir, "getconf"), getconf_stub(libc))
|
||||||
|
|
||||||
|
write_executable(Path.join(stubs_dir, "ldd"), """
|
||||||
|
#!/bin/sh
|
||||||
|
printf '%s\n' 'musl libc (mock)'
|
||||||
|
""")
|
||||||
|
end
|
||||||
|
|
||||||
|
defp getconf_stub("glibc") do
|
||||||
|
"""
|
||||||
|
#!/bin/sh
|
||||||
|
printf '%s\n' 'glibc 2.40'
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
|
||||||
|
defp getconf_stub(_libc) do
|
||||||
|
"""
|
||||||
|
#!/bin/sh
|
||||||
|
exit 1
|
||||||
|
"""
|
||||||
|
end
|
||||||
|
|
||||||
|
defp curl_url(curl_args_path) do
|
||||||
|
["-fL", url, "-o", _artifact_path] =
|
||||||
|
curl_args_path
|
||||||
|
|> File.read!()
|
||||||
|
|> String.split("\n", trim: true)
|
||||||
|
|
||||||
|
url
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Add table
Add a link
Reference in a new issue