diff --git a/.credo.exs b/.credo.exs
index b85898af3..a467f2951 100644
--- a/.credo.exs
+++ b/.credo.exs
@@ -83,6 +83,7 @@
# lanodan: I think PreferImplicitTry should be consistency, and the behaviour seems
# inconsistent, see: https://github.com/rrrene/credo/issues/224
{Credo.Check.Readability.PreferImplicitTry, false},
+ {Credo.Check.Readability.PipeIntoAnonymousFunctions, exit_status: 0},
{Credo.Check.Readability.RedundantBlankLines},
{Credo.Check.Readability.StringSigils},
{Credo.Check.Readability.TrailingBlankLine},
@@ -90,6 +91,7 @@
{Credo.Check.Readability.VariableNames},
{Credo.Check.Readability.Semicolons},
{Credo.Check.Readability.SpaceAfterCommas},
+ {Credo.Check.Readability.WithSingleClause, exit_status: 0},
{Credo.Check.Refactor.DoubleBooleanNegation},
{Credo.Check.Refactor.CondStatements},
{Credo.Check.Refactor.CyclomaticComplexity},
diff --git a/.dialyzer_ignore.exs b/.dialyzer_ignore.exs
new file mode 100644
index 000000000..865e7d782
--- /dev/null
+++ b/.dialyzer_ignore.exs
@@ -0,0 +1,6 @@
+[
+{"lib/cachex.ex", "Unknown type: Spec.cache/0."},
+{"lib/pleroma/web/plugs/rate_limiter.ex", "The pattern can never match the type {:commit, _} | {:ignore, _}."},
+{"lib/pleroma/web/plugs/rate_limiter.ex", "Function get_scale/2 will never be called."},
+{"lib/pleroma/web/plugs/rate_limiter.ex", "Function initialize_buckets!/1 will never be called."}
+]
diff --git a/.gitignore b/.gitignore
index da73b6f36..3b672184e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -48,6 +48,7 @@ docs/generated_config.md
# Code test coverage
/cover
/Elixir.*.coverdata
+/coverage.xml
.idea
pleroma.iml
@@ -56,5 +57,6 @@ pleroma.iml
.tool-versions
# Editor temp files
-/*~
-/*#
+*~
+*#
+*.swp
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3ac30b13d..21d7b2242 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,12 +1,22 @@
-image: elixir:1.9.4
+image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.13.4-otp-24
variables: &global_variables
+ # Only used for the release
+ ELIXIR_VER: 1.13.4
POSTGRES_DB: pleroma_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
DB_HOST: postgres
+ DB_PORT: "5432"
MIX_ENV: test
+workflow:
+ rules:
+ - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+ - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
+ when: never
+ - if: $CI_COMMIT_BRANCH
+
cache: &global_cache_policy
key:
files:
@@ -17,41 +27,78 @@ cache: &global_cache_policy
stages:
- build
+ - lint
- test
+ - check-changelog
- benchmark
- deploy
- release
- docker
+ - docker-combine
before_script:
- echo $MIX_ENV
- rm -rf _build/*/lib/pleroma
- - apt-get update && apt-get install -y cmake
- - mix local.hex --force
- - mix local.rebar --force
- mix deps.get
- - apt-get -qq update
- - apt-get install -y libmagic-dev
after_script:
- rm -rf _build/*/lib/pleroma
-build:
+check-changelog:
+ stage: check-changelog
+ image: alpine
+ rules:
+ - if: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'pleroma/pleroma' && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == 'weblate-extract'
+ when: never
+ - if: $CI_MERGE_REQUEST_SOURCE_PROJECT_PATH == 'pleroma/pleroma' && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME == 'weblate'
+ when: never
+ - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "develop"
+ before_script: ''
+ after_script: ''
+ cache: {}
+ script:
+ - apk add git
+ - sh ./tools/check-changelog
+
+.build_changes_policy:
+ rules:
+ - changes:
+ - ".gitlab-ci.yml"
+ - "**/*.ex"
+ - "**/*.exs"
+ - "mix.lock"
+
+.using-ci-base:
+ tags:
+ - amd64
+
+build-1.13.4:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
stage: build
- only:
- changes:
- - "**/*.ex"
- - "**/*.exs"
- - "mix.lock"
+ script:
+ - mix compile --force
+
+build-1.15.7-otp-25:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
+ stage: build
+ image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.15-otp25
+ allow_failure: true
script:
- mix compile --force
spec-build:
- stage: test
- only:
- changes:
- - "lib/pleroma/web/api_spec/**/*.ex"
- - "lib/pleroma/web/api_spec.ex"
+ extends:
+ - .using-ci-base
+ stage: build
+ rules:
+ - changes:
+ - ".gitlab-ci.yml"
+ - "lib/pleroma/web/api_spec/**/*.ex"
+ - "lib/pleroma/web/api_spec.ex"
artifacts:
paths:
- spec.json
@@ -59,12 +106,14 @@ spec-build:
- mix pleroma.openapi_spec spec.json
benchmark:
+ extends:
+ - .using-ci-base
stage: benchmark
when: manual
variables:
MIX_ENV: benchmark
services:
- - name: postgres:9.6
+ - name: postgres:11.22-alpine
alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
script:
@@ -72,102 +121,99 @@ benchmark:
- mix ecto.migrate
- mix pleroma.load_testing
-unit-testing:
+unit-testing-1.12.3:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
stage: test
- only:
- changes:
- - "**/*.ex"
- - "**/*.exs"
- - "mix.lock"
- retry: 2
cache: &testing_cache_policy
<<: *global_cache_policy
policy: pull
-
- services:
- - name: postgres:13
+ services: &testing_services
+ - name: postgres:13-alpine
alias: postgres
command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- script:
- - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
+ script: &testing_script
- mix ecto.create
- mix ecto.migrate
- - mix coveralls --preload-modules
+ - mix test --cover --preload-modules
+ coverage: '/^Line total: ([^ ]*%)$/'
+ artifacts:
+ reports:
+ coverage_report:
+ coverage_format: cobertura
+ path: coverage.xml
-# Removed to fix CI issue. In this early state it wasn't adding much value anyway.
-# TODO Fix and reinstate federated testing
-# federated-testing:
-# stage: test
-# cache: *testing_cache_policy
-# services:
-# - name: minibikini/postgres-with-rum:12
-# alias: postgres
-# command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
-# script:
-# - mix deps.get
-# - mix ecto.create
-# - mix ecto.migrate
-# - epmd -daemon
-# - mix test --trace --only federated
-
-unit-testing-rum:
+unit-testing-1.15.7-otp-25:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
+ stage: test
+ image: git.pleroma.social:5050/pleroma/pleroma/ci-base:elixir-1.15-otp25
+ allow_failure: true
+ cache: *testing_cache_policy
+ services: *testing_services
+ script: *testing_script
+
+unit-testing-1.12-erratic:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
stage: test
- only:
- changes:
- - "**/*.ex"
- - "**/*.exs"
- - "mix.lock"
retry: 2
+ allow_failure: true
cache: *testing_cache_policy
- services:
- - name: minibikini/postgres-with-rum:12
- alias: postgres
- command: ["postgres", "-c", "fsync=off", "-c", "synchronous_commit=off", "-c", "full_page_writes=off"]
- variables:
- <<: *global_variables
- RUM_ENABLED: "true"
+ services: *testing_services
script:
- - apt-get update && apt-get install -y libimage-exiftool-perl ffmpeg
- mix ecto.create
- mix ecto.migrate
- - "mix ecto.migrate --migrations-path priv/repo/optional_migrations/rum_indexing/"
- - mix test --preload-modules
+ - mix test --only=erratic
-lint:
- stage: test
- only:
- changes:
- - "**/*.ex"
- - "**/*.exs"
- - "mix.lock"
+formatting-1.13:
+ extends: .build_changes_policy
+ image: &formatting_elixir elixir:1.13-alpine
+ stage: lint
cache: *testing_cache_policy
+ before_script: ¤t_bfr_script
+ - apk update
+ - apk add build-base cmake file-dev git openssl
+ - mix local.hex --force
+ - mix local.rebar --force
+ - mix deps.get
script:
- mix format --check-formatted
+cycles-1.13:
+ extends: .build_changes_policy
+ image: *formatting_elixir
+ stage: lint
+ cache: {}
+ before_script: *current_bfr_script
+ script:
+ - mix compile
+ - mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}'
+
analysis:
- stage: test
- only:
- changes:
- - "**/*.ex"
- - "**/*.exs"
- - "mix.lock"
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
+ stage: lint
cache: *testing_cache_policy
script:
- mix credo --strict --only=warnings,todo,fixme,consistency,readability
-cycles:
- stage: test
- image: elixir:1.11
- only:
- changes:
- - "**/*.ex"
- - "**/*.exs"
- - "mix.lock"
- cache: {}
+dialyzer:
+ extends:
+ - .build_changes_policy
+ - .using-ci-base
+ stage: lint
+ allow_failure: true
+ when: manual
+ cache: *testing_cache_policy
+ tags:
+ - feld
script:
- - mix deps.get
- - mix compile
- - mix xref graph --format cycles --label compile | awk '{print $0} END{exit ($0 != "No cycles found")}'
+ - mix dialyzer
docs-deploy:
stage: deploy
@@ -179,7 +225,7 @@ docs-deploy:
before_script:
- apk add curl
script:
- - curl -X POST -F"token=$DOCS_PIPELINE_TRIGGER" -F'ref=master' -F"variables[BRANCH]=$CI_COMMIT_REF_NAME" https://git.pleroma.social/api/v4/projects/673/trigger/pipeline
+ - 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
@@ -220,7 +266,7 @@ spec-deploy:
before_script:
- apk add curl
script:
- - curl -X POST -F"token=$API_DOCS_PIPELINE_TRIGGER" -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
+ - 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:
@@ -243,12 +289,14 @@ stop_review_app:
amd64:
stage: release
- image: elixir:1.10.3
+ image: elixir:$ELIXIR_VER
only: &release-only
- stable@pleroma/pleroma
- develop@pleroma/pleroma
- /^maint/.*$/@pleroma/pleroma
- /^release/.*$/@pleroma/pleroma
+ tags:
+ - amd64
artifacts: &release-artifacts
name: "pleroma-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA-$CI_JOB_NAME"
paths:
@@ -265,9 +313,10 @@ amd64:
- deps
variables: &release-variables
MIX_ENV: prod
+ VIX_COMPILATION_MODE: PLATFORM_PROVIDED_LIBVIPS
before_script: &before-release
- - apt-get update && apt-get install -y cmake libmagic-dev
- - echo "import Mix.Config" > config/prod.secret.exs
+ - apt-get update && apt-get install -y cmake libmagic-dev libvips-dev erlang-dev
+ - echo "import Config" > config/prod.secret.exs
- mix local.hex --force
- mix local.rebar --force
script: &release
@@ -281,12 +330,14 @@ amd64-musl:
stage: release
artifacts: *release-artifacts
only: *release-only
- image: elixir:1.10.3-alpine
+ image: elixir:$ELIXIR_VER-alpine
+ tags:
+ - amd64
cache: *release-cache
variables: *release-variables
before_script: &before-release-musl
- - apk add git gcc g++ musl-dev make cmake file-dev
- - echo "import Mix.Config" > config/prod.secret.exs
+ - apk add git build-base cmake file-dev openssl vips-dev
+ - echo "import Config" > config/prod.secret.exs
- mix local.hex --force
- mix local.rebar --force
script: *release
@@ -297,7 +348,7 @@ arm:
only: *release-only
tags:
- arm32-specified
- image: arm32v7/elixir:1.10.3
+ image: arm32v7/elixir:$ELIXIR_VER
cache: *release-cache
variables: *release-variables
before_script: *before-release
@@ -309,7 +360,7 @@ arm-musl:
only: *release-only
tags:
- arm32-specified
- image: arm32v7/elixir:1.10.3-alpine
+ image: arm32v7/elixir:$ELIXIR_VER-alpine
cache: *release-cache
variables: *release-variables
before_script: *before-release-musl
@@ -321,7 +372,7 @@ arm64:
only: *release-only
tags:
- arm
- image: arm64v8/elixir:1.10.3
+ image: arm64v8/elixir:$ELIXIR_VER
cache: *release-cache
variables: *release-variables
before_script: *before-release
@@ -333,110 +384,173 @@ arm64-musl:
only: *release-only
tags:
- arm
- image: arm64v8/elixir:1.10.3-alpine
+ image: arm64v8/elixir:$ELIXIR_VER-alpine
cache: *release-cache
variables: *release-variables
before_script: *before-release-musl
script: *release
-docker:
+.kaniko:
stage: docker
- image: docker:latest
+ image:
+ name: gcr.io/kaniko-project/executor:debug
+ entrypoint: [""]
cache: {}
dependencies: []
- variables: &docker-variables
- DOCKER_DRIVER: overlay2
- DOCKER_HOST: unix:///var/run/docker.sock
- IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
- IMAGE_TAG_SLUG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
- IMAGE_TAG_LATEST: $CI_REGISTRY_IMAGE:latest
- IMAGE_TAG_LATEST_STABLE: $CI_REGISTRY_IMAGE:latest-stable
- DOCKER_BUILDX_URL: https://github.com/docker/buildx/releases/download/v0.4.1/buildx-v0.4.1.linux-amd64
- DOCKER_BUILDX_HASH: 71a7d01439aa8c165a25b59c44d3f016fddbd98b
- before_script: &before-docker
- - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- - docker pull $IMAGE_TAG_SLUG || true
+ before_script: &before-kaniko
- export CI_JOB_TIMESTAMP=$(date --utc -Iseconds)
- export CI_VCS_REF=$CI_COMMIT_SHORT_SHA
- allow_failure: true
- script:
- - mkdir -p /root/.docker/cli-plugins
- - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
- - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
- - chmod +x ~/.docker/cli-plugins/docker-buildx
- - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- - docker buildx create --name mbuilder --driver docker-container --use
- - docker buildx inspect --bootstrap
- - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG -t $IMAGE_TAG_LATEST .
- tags:
- - dind
+ - export IMAGE_TAG=$CI_REGISTRY_IMAGE/$BUILD_ARCH_IMG_SUFFIX:$CI_COMMIT_SHORT_SHA
+ - export IMAGE_TAG_SLUG=$CI_REGISTRY_IMAGE/$BUILD_ARCH_IMG_SUFFIX:$CI_COMMIT_REF_SLUG
+ - export IMAGE_TAG_LATEST=$CI_REGISTRY_IMAGE/$BUILD_ARCH_IMG_SUFFIX:latest
+ - export IMAGE_TAG_LATEST_STABLE=$CI_REGISTRY_IMAGE/$BUILD_ARCH_IMG_SUFFIX:latest-stable
+ - mkdir -p /kaniko/.docker
+ - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
+
+.kaniko-latest:
+ extends: .kaniko
only:
- develop@pleroma/pleroma
-
-docker-stable:
- stage: docker
- image: docker:latest
- cache: {}
- dependencies: []
- variables: *docker-variables
- before_script: *before-docker
- allow_failure: true
script:
- - mkdir -p /root/.docker/cli-plugins
- - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
- - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
- - chmod +x ~/.docker/cli-plugins/docker-buildx
- - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- - docker buildx create --name mbuilder --driver docker-container --use
- - docker buildx inspect --bootstrap
- - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG -t $IMAGE_TAG_LATEST_STABLE .
- tags:
- - dind
+ - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --custom-platform=$BUILD_ARCH --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP --build-arg ELIXIR_IMG=$ELIXIR_IMG --destination $IMAGE_TAG --destination $IMAGE_TAG_SLUG --destination $IMAGE_TAG_LATEST
+
+.kaniko-stable:
+ extends: .kaniko
only:
- stable@pleroma/pleroma
+ script:
+ - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --custom-platform=$BUILD_ARCH --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP --build-arg ELIXIR_IMG=$ELIXIR_IMG --destination $IMAGE_TAG --destination $IMAGE_TAG_SLUG --destination $IMAGE_TAG_LATEST_STABLE
-docker-release:
- stage: docker
- image: docker:latest
- cache: {}
- dependencies: []
- variables: *docker-variables
- before_script: *before-docker
- allow_failure: true
- script:
- script:
- - mkdir -p /root/.docker/cli-plugins
- - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
- - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
- - chmod +x ~/.docker/cli-plugins/docker-buildx
- - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- - docker buildx create --name mbuilder --driver docker-container --use
- - docker buildx inspect --bootstrap
- - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG .
- tags:
- - dind
+.kaniko-release:
+ extends: .kaniko
only:
- /^release/.*$/@pleroma/pleroma
+ script:
+ - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --custom-platform=$BUILD_ARCH --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP --build-arg ELIXIR_IMG=$ELIXIR_IMG --destination $IMAGE_TAG --destination $IMAGE_TAG_SLUG
-docker-adhoc:
- stage: docker
- image: docker:latest
- cache: {}
- dependencies: []
- variables: *docker-variables
- before_script: *before-docker
- allow_failure: true
- script:
- script:
- - mkdir -p /root/.docker/cli-plugins
- - wget "${DOCKER_BUILDX_URL}" -O ~/.docker/cli-plugins/docker-buildx
- - echo "${DOCKER_BUILDX_HASH} /root/.docker/cli-plugins/docker-buildx" | sha1sum -c
- - chmod +x ~/.docker/cli-plugins/docker-buildx
- - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- - docker buildx create --name mbuilder --driver docker-container --use
- - docker buildx inspect --bootstrap
- - docker buildx build --platform linux/amd64,linux/arm/v7,linux/arm64/v8 --push --cache-from $IMAGE_TAG_SLUG --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP -t $IMAGE_TAG -t $IMAGE_TAG_SLUG .
- tags:
- - dind
+.kaniko-adhoc:
+ extends: .kaniko
only:
- /^build-docker/.*$/@pleroma/pleroma
+ script:
+ - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --custom-platform=$BUILD_ARCH --build-arg VCS_REF=$CI_VCS_REF --build-arg BUILD_DATE=$CI_JOB_TIMESTAMP --build-arg ELIXIR_IMG=$ELIXIR_IMG --destination $IMAGE_TAG --destination $IMAGE_TAG_SLUG
+
+.kaniko:linux/amd64:
+ variables:
+ BUILD_ARCH: linux/amd64
+ BUILD_ARCH_IMG_SUFFIX: linux-amd64
+ ELIXIR_IMG: hexpm/elixir
+ tags:
+ - amd64
+
+.kaniko:linux/arm64:
+ variables:
+ BUILD_ARCH: linux/arm64/v8
+ BUILD_ARCH_IMG_SUFFIX: linux-arm64-v8
+ ELIXIR_IMG: hexpm/elixir
+ tags:
+ - arm
+
+.kaniko:linux/arm:
+ variables:
+ BUILD_ARCH: linux/arm/v7
+ BUILD_ARCH_IMG_SUFFIX: linux-arm-v7
+ ELIXIR_IMG: git.pleroma.social:5050/pleroma/ci-image/elixir-linux-arm-v7
+ tags:
+ - arm32-specified
+
+kaniko-latest:linux/amd64:
+ extends:
+ - .kaniko-latest
+ - .kaniko:linux/amd64
+
+kaniko-latest:linux/arm64:
+ extends:
+ - .kaniko-latest
+ - .kaniko:linux/arm64
+
+kaniko-latest:linux/arm:
+ extends:
+ - .kaniko-latest
+ - .kaniko:linux/arm
+
+kaniko-stable:linux/amd64:
+ extends:
+ - .kaniko-stable
+ - .kaniko:linux/amd64
+
+kaniko-stable:linux/arm64:
+ extends:
+ - .kaniko-stable
+ - .kaniko:linux/arm64
+
+kaniko-stable:linux/arm:
+ extends:
+ - .kaniko-stable
+ - .kaniko:linux/arm
+
+kaniko-release:linux/amd64:
+ extends:
+ - .kaniko-release
+ - .kaniko:linux/amd64
+
+kaniko-release:linux/arm64:
+ extends:
+ - .kaniko-release
+ - .kaniko:linux/arm64
+
+kaniko-release:linux/arm:
+ extends:
+ - .kaniko-release
+ - .kaniko:linux/arm
+
+.docker-combine:
+ stage: docker-combine
+ image: docker:cli
+ cache: {}
+ before_script:
+ - 'BUILD_ARCHES="linux-amd64 linux-arm64-v8 linux-arm-v7"'
+ - export IMAGE_TAG=$CI_REGISTRY_IMAGE:$CI_COMMIT_SHORT_SHA
+ - export IMAGE_TAG_SLUG=$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
+ - export IMAGE_TAG_LATEST=$CI_REGISTRY_IMAGE:latest
+ - export IMAGE_TAG_LATEST_STABLE=$CI_REGISTRY_IMAGE:latest-stable
+ - 'IMAGES=; for arch in $BUILD_ARCHES; do IMAGES="$IMAGES $CI_REGISTRY_IMAGE/$arch:$CI_COMMIT_SHORT_SHA"; done'
+ - 'IMAGES_SLUG=; for arch in $BUILD_ARCHES; do IMAGES_SLUG="$IMAGES_SLUG $CI_REGISTRY_IMAGE/$arch:$CI_COMMIT_REF_SLUG"; done'
+ - 'IMAGES_LATEST=; for arch in $BUILD_ARCHES; do IMAGES_LATEST="$IMAGES_LATEST $CI_REGISTRY_IMAGE/$arch:latest"; done'
+ - 'IMAGES_LATEST_STABLE=; for arch in $BUILD_ARCHES; do IMAGES_LATEST_STABLE="$IMAGES_LATEST_STABLE $CI_REGISTRY_IMAGE/$arch:latest"; done'
+ - mkdir -p ~/.docker
+ - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > ~/.docker/config.json
+
+docker-combine:latest:
+ extends: .docker-combine
+ only:
+ - develop@pleroma/pleroma
+ script:
+ - 'docker manifest create $IMAGE_TAG $IMAGES'
+ - 'docker manifest push $IMAGE_TAG'
+ - 'docker manifest create $IMAGE_TAG_SLUG $IMAGES_SLUG'
+ - 'docker manifest push $IMAGE_TAG_SLUG'
+ - 'docker manifest create $IMAGE_TAG_LATEST $IMAGES_LATEST'
+ - 'docker manifest push $IMAGE_TAG_LATEST'
+
+docker-combine:stable:
+ extends: .docker-combine
+ only:
+ - stable@pleroma/pleroma
+ script:
+ - 'docker manifest create $IMAGE_TAG $IMAGES'
+ - 'docker manifest push $IMAGE_TAG'
+ - 'docker manifest create $IMAGE_TAG_SLUG $IMAGES_SLUG'
+ - 'docker manifest push $IMAGE_TAG_SLUG'
+ - 'docker manifest create $IMAGE_TAG_LATEST_STABLE $IMAGES_LATEST_STABLE'
+ - 'docker manifest push $IMAGE_TAG_LATEST_STABLE'
+
+docker-combine:release:
+ extends: .docker-combine
+ only:
+ - /^release/.*$/@pleroma/pleroma
+ script:
+ - 'docker manifest create $IMAGE_TAG $IMAGES'
+ - 'docker manifest push $IMAGE_TAG'
+ - 'docker manifest create $IMAGE_TAG_SLUG $IMAGES_SLUG'
+ - 'docker manifest push $IMAGE_TAG_SLUG'
diff --git a/.gitlab/merge_request_templates/Default.md b/.gitlab/merge_request_templates/Default.md
new file mode 100644
index 000000000..641d9cfd8
--- /dev/null
+++ b/.gitlab/merge_request_templates/Default.md
@@ -0,0 +1,10 @@
+### Checklist
+- [ ] Adding a changelog: In the `changelog.d` directory, create a file named ` Someone has requested password change for your account at #{instance_name()}. If it was you, visit the following link to proceed: reset password. If it was someone else, nothing to worry about: your data is secure and your password has not been changed. Someone has requested password change for your account at %{instance_name}. If it was you, visit the following link to proceed: reset password. If it was someone else, nothing to worry about: your data is secure and your password has not been changed. %{inviter_name} invites you to join %{instance_name}, an instance of Pleroma federated social networking platform. Click the following link to register: accept invitation. #{user.name} invites you to join #{instance_name()}, an instance of Pleroma federated social networking platform. Click the following link to register: accept invitation. Email confirmation is required to activate the account. Please click the following link to activate your account. Email confirmation is required to activate the account. Please click the following link to activate your account. Your account at #{instance_name()} is being reviewed by staff. You will receive another email once your account is approved. Your account at %{instance_name} is being reviewed by staff. You will receive another email once your account is approved. Your account at #{instance_name()} has been registered successfully. No further action is required to activate your account. Your account at %{instance_name} has been registered successfully. No further action is required to activate your account. You requested a full backup of your Pleroma account. It's ready for download: Admin @#{admin.nickname} requested a full backup of your Pleroma account. It's ready for download: You requested a full backup of your Pleroma account. It's ready for download: Admin @%{admin_nickname} requested a full backup of your Pleroma account. It's ready for download: tag
+ recipients_inline != "" && String.starts_with?(content, " ") ->
+ " " <> recipients_inline <> String.trim_leading(content, " ")
+
+ recipients_inline != "" ->
+ recipients_inline <> content
+
+ true ->
+ content
+ end
+
+ {:ok, put_in(object["object"]["content"], content)}
+ end
+
+ @impl true
+ def filter(object), do: {:ok, object}
+
+ @impl true
+ def describe, do: {:ok, %{}}
+end
diff --git a/lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex b/lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex
index b7db4fa3d..fdb9a9dba 100644
--- a/lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex
+++ b/lib/pleroma/web/activity_pub/mrf/hashtag_policy.ex
@@ -1,5 +1,5 @@
# Pleroma: A lightweight social networking server
-# Copyright © 2017-2021 Pleroma Authors .
` can be anything, but we recommend using a more or less unique identifier to avoid collisions, such as the branch name.
+
+ `
+
diff --git a/docs/installation/otp_vs_from_source_source.include b/docs/installation/otp_vs_from_source_source.include
new file mode 100644
index 000000000..9f7134229
--- /dev/null
+++ b/docs/installation/otp_vs_from_source_source.include
@@ -0,0 +1,3 @@
+{! backend/installation/otp_vs_from_source.include !}
+
+This guide covers a manual from-source installation. To install using OTP releases, please check for the presence of a distro package, failing that you can use [Pleroma-provided OTP binaries](./otp_en.md).
diff --git a/docs/installation/yunohost_en.md b/docs/installation/yunohost_en.md
new file mode 100644
index 000000000..4c34e85d5
--- /dev/null
+++ b/docs/installation/yunohost_en.md
@@ -0,0 +1,9 @@
+# Installing on Yunohost
+
+[YunoHost](https://yunohost.org) is a server operating system aimed at self-hosting. The YunoHost community maintains a package of Pleroma which allows you to install Pleroma on YunoHost. You can install it via the normal way through the admin web interface, or through the CLI. More information can be found at [the repo of the package](https://github.com/YunoHost-Apps/pleroma_ynh).
+
+## Questions
+
+Questions and problems related to the YunoHost parts can be done through the [regular YunoHost channels](https://yunohost.org/en/help).
+
+For questions about Pleroma, ask in [#pleroma:libera.chat](https://matrix.to/#/#pleroma:libera.chat) via Matrix or **#pleroma** on **libera.chat** via IRC.
diff --git a/elixir_buildpack.config b/elixir_buildpack.config
index 946408c12..1102e7145 100644
--- a/elixir_buildpack.config
+++ b/elixir_buildpack.config
@@ -1,2 +1,2 @@
-elixir_version=1.9.4
+elixir_version=1.10.4
erlang_version=22.3.4.1
diff --git a/installation/caddyfile-pleroma.example b/installation/caddyfile-pleroma.example
index 7985d9c67..cc7dda011 100644
--- a/installation/caddyfile-pleroma.example
+++ b/installation/caddyfile-pleroma.example
@@ -5,34 +5,13 @@
# 2. Copy this section into your Caddyfile and restart Caddy.
example.tld {
- log /var/log/caddy/pleroma_access.log
- errors /var/log/caddy/pleroma_error.log
+ log {
+ output file /var/log/caddy/pleroma.log
+ }
- gzip
+ encode gzip
# this is explicitly IPv4 since Pleroma.Web.Endpoint binds on IPv4 only
# and `localhost.` resolves to [::0] on some systems: see issue #930
- proxy / 127.0.0.1:4000 {
- websocket
- transparent
- }
-
- tls {
- # Remove the rest of the lines in here, if you want to support older devices
- key_type p256
- ciphers ECDHE-ECDSA-WITH-CHACHA20-POLY1305 ECDHE-RSA-WITH-CHACHA20-POLY1305 ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-RSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-RSA-AES128-GCM-SHA256
- }
-
- # If you do not want to use the mediaproxy function, remove these lines.
- # To use this directive, you need the http.cache plugin for Caddy.
- cache {
- match_path /media
- default_max_age 720m
- }
-
- cache {
- match_path /proxy
- default_max_age 720m
- }
- # Stop removing lines here.
+ reverse_proxy 127.0.0.1:4000
}
diff --git a/installation/download-mastofe-build.sh b/installation/download-mastofe-build.sh
deleted file mode 100755
index ee353c48c..000000000
--- a/installation/download-mastofe-build.sh
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/sh
-# Pleroma: A lightweight social networking server
-# Copyright © 2017-2021 Pleroma Authors Reset your password at #{instance_name()}
- Reset your password at %{instance_name}
+ You are invited to %{instance_name}
+ You are invited to #{instance_name()}
- Thank you for registering on %{instance_name}
+ Thank you for registering on #{instance_name()}
- Awaiting Approval
- Awaiting Approval
+ Hello @#{user.nickname},
- Hello @%{nickname},
+
#{quote_line}"
+ end
+
+ defp has_inline_quote?(content, quote_url) do
+ cond do
+ # Does the quote URL exist in the content?
+ content =~ quote_url -> true
+ # Does the content already have a .quote-inline span?
+ content =~ "" -> true
+ # No inline quote found
+ true -> false
+ end
+ end
+
+ defp filter_object(%{"quoteUrl" => quote_url} = object) do
+ content = object["content"] || ""
+
+ if has_inline_quote?(content, quote_url) do
+ object
+ else
+ template = Pleroma.Config.get([:mrf_inline_quote, :template])
+
+ content =
+ if String.ends_with?(content, "
.
"] do + when type in ["Create", "Update"] and content in [".", ".
"] do {:ok, put_in(object, ["object", "content"], "")} end diff --git a/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex b/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex index 0d7146738..2dfc9a901 100644 --- a/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex +++ b/lib/pleroma/web/activity_pub/mrf/normalize_markup.ex @@ -1,5 +1,5 @@ # Pleroma: A lightweight social networking server -# Copyright © 2017-2021 Pleroma Authors