2017-06-26 20:04:55 +00:00
|
|
|
variables:
|
|
|
|
IMAGE_NAME: funkwhale/funkwhale
|
2017-06-26 20:24:37 +00:00
|
|
|
IMAGE: $IMAGE_NAME:$CI_COMMIT_REF_NAME
|
2019-08-19 12:19:41 +00:00
|
|
|
IMAGE_LATEST: $IMAGE_NAME:latest
|
2019-01-16 10:56:58 +00:00
|
|
|
ALL_IN_ONE_IMAGE_NAME: funkwhale/all-in-one
|
|
|
|
ALL_IN_ONE_IMAGE: $ALL_IN_ONE_IMAGE_NAME:$CI_COMMIT_REF_NAME
|
2019-08-19 12:19:41 +00:00
|
|
|
ALL_IN_ONE_IMAGE_LATEST: $ALL_IN_ONE_IMAGE_NAME:latest
|
2018-01-09 19:47:03 +00:00
|
|
|
PIP_CACHE_DIR: "$CI_PROJECT_DIR/pip-cache"
|
2018-06-09 15:03:06 +00:00
|
|
|
PYTHONDONTWRITEBYTECODE: "true"
|
2018-07-04 16:31:29 +00:00
|
|
|
REVIEW_DOMAIN: preview.funkwhale.audio
|
2021-12-12 13:32:45 +00:00
|
|
|
REVIEW_INSTANCE_URL: https://funkwhale.juniorjpdj.pl
|
2021-09-09 15:45:11 +00:00
|
|
|
DOCKER_HOST: tcp://docker:2375/
|
|
|
|
DOCKER_DRIVER: overlay2
|
|
|
|
DOCKER_TLS_CERTDIR: ""
|
2021-11-06 21:55:25 +00:00
|
|
|
BUILD_PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
|
2017-06-26 20:04:55 +00:00
|
|
|
|
2017-06-25 17:12:23 +00:00
|
|
|
stages:
|
2022-01-28 12:33:39 +00:00
|
|
|
- build
|
2018-06-23 14:51:31 +00:00
|
|
|
- review
|
2018-06-09 14:00:00 +00:00
|
|
|
- lint
|
2021-05-28 09:39:27 +00:00
|
|
|
- test
|
2017-06-26 17:48:09 +00:00
|
|
|
- deploy
|
2021-04-25 19:52:56 +00:00
|
|
|
- deps
|
2017-06-25 17:13:46 +00:00
|
|
|
|
2018-06-24 10:37:01 +00:00
|
|
|
review_front:
|
2019-09-23 09:15:32 +00:00
|
|
|
interruptible: true
|
2018-06-23 14:51:31 +00:00
|
|
|
stage: review
|
2022-02-03 08:32:59 +00:00
|
|
|
image: node:16-buster
|
2018-06-23 14:51:31 +00:00
|
|
|
when: manual
|
|
|
|
allow_failure: true
|
2019-06-13 12:09:07 +00:00
|
|
|
variables:
|
|
|
|
BASE_URL: /-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/front-review/
|
|
|
|
VUE_APP_ROUTER_BASE_URL: /-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/front-review/
|
|
|
|
VUE_APP_INSTANCE_URL: $REVIEW_INSTANCE_URL
|
2021-12-12 13:32:45 +00:00
|
|
|
NODE_ENV: review
|
2018-06-23 14:51:31 +00:00
|
|
|
before_script:
|
2018-07-01 15:07:21 +00:00
|
|
|
- curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
|
|
|
|
- chmod +x /usr/local/bin/jq
|
2019-06-13 12:09:07 +00:00
|
|
|
- rm -rf front-review
|
|
|
|
- mkdir front-review
|
2018-06-23 14:51:31 +00:00
|
|
|
- cd front
|
|
|
|
script:
|
|
|
|
- yarn install
|
|
|
|
# this is to ensure we don't have any errors in the output,
|
2018-12-10 15:00:33 +00:00
|
|
|
# cf https://dev.funkwhale.audio/funkwhale/funkwhale/issues/169
|
2022-02-27 13:10:59 +00:00
|
|
|
- yarn run build --base ./ | tee /dev/stderr | (! grep -i 'ERROR in')
|
2019-06-13 12:09:07 +00:00
|
|
|
- cp -r dist/* ../front-review
|
|
|
|
artifacts:
|
|
|
|
expire_in: 2 weeks
|
|
|
|
paths:
|
|
|
|
- front-review
|
2018-06-23 14:51:31 +00:00
|
|
|
cache:
|
2018-07-04 16:31:29 +00:00
|
|
|
key: "funkwhale__front_dependencies"
|
2018-06-23 14:51:31 +00:00
|
|
|
paths:
|
|
|
|
- front/node_modules
|
|
|
|
- front/yarn.lock
|
|
|
|
only:
|
2018-07-01 14:21:08 +00:00
|
|
|
- branches
|
2018-06-23 14:51:31 +00:00
|
|
|
tags:
|
2019-06-13 12:09:07 +00:00
|
|
|
- docker
|
2018-06-24 10:37:01 +00:00
|
|
|
environment:
|
2019-06-13 12:09:07 +00:00
|
|
|
name: review/front/$CI_COMMIT_REF_NAME
|
|
|
|
url: http://$CI_PROJECT_NAMESPACE.pages.funkwhale.audio/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/front-review/index.html
|
2018-06-24 10:37:01 +00:00
|
|
|
|
2019-06-13 12:50:31 +00:00
|
|
|
review_docs:
|
2019-09-23 09:15:32 +00:00
|
|
|
interruptible: true
|
2019-06-13 12:50:31 +00:00
|
|
|
stage: review
|
|
|
|
when: manual
|
|
|
|
allow_failure: true
|
2022-03-02 14:50:59 +00:00
|
|
|
image: python:3.10
|
2019-06-13 12:50:31 +00:00
|
|
|
variables:
|
|
|
|
BUILD_PATH: "../docs-review"
|
|
|
|
before_script:
|
|
|
|
- rm -rf docs-review
|
|
|
|
- mkdir docs-review
|
|
|
|
- cd docs
|
|
|
|
- apt-get update
|
2022-03-02 14:50:59 +00:00
|
|
|
- apt-get install -y graphviz git
|
|
|
|
- pip install poetry
|
|
|
|
- poetry install
|
2022-03-21 11:12:36 +00:00
|
|
|
- git switch develop && git pull
|
|
|
|
- git switch stable && git pull
|
|
|
|
- git switch $CI_COMMIT_BRANCH && git pull
|
2019-06-13 12:50:31 +00:00
|
|
|
script:
|
2022-03-10 10:05:25 +00:00
|
|
|
- poetry run python -m sphinx . $BUILD_PATH
|
2019-06-13 12:50:31 +00:00
|
|
|
cache:
|
|
|
|
key: "$CI_PROJECT_ID__sphinx"
|
|
|
|
paths:
|
|
|
|
- "$PIP_CACHE_DIR"
|
|
|
|
artifacts:
|
|
|
|
expire_in: 2 weeks
|
|
|
|
paths:
|
|
|
|
- docs-review
|
|
|
|
only:
|
|
|
|
- branches
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
environment:
|
|
|
|
name: review/docs/$CI_COMMIT_REF_NAME
|
|
|
|
url: http://$CI_PROJECT_NAMESPACE.pages.funkwhale.audio/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/docs-review/index.html
|
|
|
|
|
2022-02-05 21:42:31 +00:00
|
|
|
changelog_snippet:
|
|
|
|
interruptible: true
|
2022-06-11 21:05:46 +00:00
|
|
|
image: alpine:3.16
|
2022-02-05 21:42:31 +00:00
|
|
|
stage: lint
|
|
|
|
before_script:
|
|
|
|
- apk add git
|
|
|
|
- git fetch origin $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
|
|
|
|
script:
|
|
|
|
- git diff --name-only FETCH_HEAD | grep "changes/changelog.d/*"
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_AUTHOR == 'Renovate Bot <bot@dev.funkwhale.audio>'
|
|
|
|
when: never
|
|
|
|
- if: $CI_MERGE_REQUEST_TITLE =~ /NOCHANGELOG/
|
|
|
|
when: never
|
|
|
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
|
|
|
|
|
|
|
|
2018-06-09 14:00:00 +00:00
|
|
|
black:
|
2019-09-23 09:15:32 +00:00
|
|
|
interruptible: true
|
2018-06-09 14:00:00 +00:00
|
|
|
image: python:3.6
|
|
|
|
stage: lint
|
2018-06-09 15:03:06 +00:00
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: fetch
|
2018-06-09 14:00:00 +00:00
|
|
|
before_script:
|
2022-01-09 11:40:49 +00:00
|
|
|
- pip install black
|
2018-06-09 14:00:00 +00:00
|
|
|
script:
|
2022-01-09 11:40:49 +00:00
|
|
|
- black --check --diff .
|
2019-03-26 09:45:52 +00:00
|
|
|
|
2018-06-09 15:12:58 +00:00
|
|
|
flake8:
|
2019-09-23 09:15:32 +00:00
|
|
|
interruptible: true
|
2018-06-09 15:12:58 +00:00
|
|
|
image: python:3.6
|
|
|
|
stage: lint
|
|
|
|
variables:
|
|
|
|
GIT_STRATEGY: fetch
|
|
|
|
before_script:
|
2020-05-15 12:42:48 +00:00
|
|
|
- pip install 'flake8<3.7'
|
2018-06-09 15:12:58 +00:00
|
|
|
script:
|
2018-06-10 10:10:15 +00:00
|
|
|
- flake8 -v api
|
2018-06-09 15:03:06 +00:00
|
|
|
cache:
|
2018-06-09 15:12:58 +00:00
|
|
|
key: "$CI_PROJECT_ID__flake8_pip_cache"
|
2018-06-09 15:03:06 +00:00
|
|
|
paths:
|
|
|
|
- "$PIP_CACHE_DIR"
|
2018-06-09 14:00:00 +00:00
|
|
|
|
2021-07-16 18:34:46 +00:00
|
|
|
eslint:
|
|
|
|
interruptible: true
|
2022-02-03 08:32:59 +00:00
|
|
|
image: node:16-buster
|
2021-07-16 18:34:46 +00:00
|
|
|
stage: lint
|
|
|
|
before_script:
|
|
|
|
- cd front
|
|
|
|
- yarn install
|
|
|
|
script:
|
2021-12-08 18:48:06 +00:00
|
|
|
- yarn lint --max-warnings 0
|
2021-07-16 18:34:46 +00:00
|
|
|
cache:
|
|
|
|
key: "$CI_PROJECT_ID__eslint_npm_cache"
|
|
|
|
paths:
|
|
|
|
- front/node_modules
|
|
|
|
|
2022-02-05 17:26:10 +00:00
|
|
|
test_api:
|
2019-09-23 09:15:32 +00:00
|
|
|
interruptible: true
|
2017-12-28 21:59:43 +00:00
|
|
|
services:
|
2022-02-03 19:33:13 +00:00
|
|
|
- postgres:14
|
2022-02-03 19:22:22 +00:00
|
|
|
- redis:6
|
2017-06-25 17:13:46 +00:00
|
|
|
stage: test
|
2022-02-18 13:41:10 +00:00
|
|
|
retry: 1
|
2018-01-09 19:47:03 +00:00
|
|
|
cache:
|
2018-03-20 13:41:36 +00:00
|
|
|
key: "$CI_PROJECT_ID__pip_cache"
|
2018-01-09 19:47:03 +00:00
|
|
|
paths:
|
|
|
|
- "$PIP_CACHE_DIR"
|
2017-12-16 15:10:48 +00:00
|
|
|
variables:
|
2017-12-28 21:59:43 +00:00
|
|
|
DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
2018-02-25 13:43:23 +00:00
|
|
|
FUNKWHALE_URL: "https://funkwhale.ci"
|
2018-04-02 17:16:34 +00:00
|
|
|
DJANGO_SETTINGS_MODULE: config.settings.local
|
2020-02-15 11:01:19 +00:00
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
2021-08-14 18:42:16 +00:00
|
|
|
CACHE_URL: "redis://redis:6379/0"
|
2018-07-01 14:21:08 +00:00
|
|
|
only:
|
2021-11-02 08:10:06 +00:00
|
|
|
refs:
|
|
|
|
- branches
|
2017-06-25 17:13:46 +00:00
|
|
|
before_script:
|
2017-06-26 15:20:46 +00:00
|
|
|
- cd api
|
2022-04-01 08:11:30 +00:00
|
|
|
- poetry run pip install setuptools==59.1.1 # Hotfix for failing pipelines #1745
|
2022-01-09 18:46:33 +00:00
|
|
|
- poetry install --no-root
|
2017-06-25 17:13:46 +00:00
|
|
|
script:
|
2022-01-09 19:44:46 +00:00
|
|
|
- poetry run pytest --cov-report xml --cov-report term-missing:skip-covered --cov=funkwhale_api --junitxml=report.xml tests/
|
2018-01-09 19:47:03 +00:00
|
|
|
tags:
|
|
|
|
- docker
|
2021-04-22 13:57:15 +00:00
|
|
|
artifacts:
|
|
|
|
when: always
|
|
|
|
reports:
|
2021-04-22 15:04:16 +00:00
|
|
|
junit: api/report.xml
|
2022-06-08 12:12:55 +00:00
|
|
|
coverage_report:
|
|
|
|
coverage_format: cobertura
|
|
|
|
path: api/coverage.xml
|
2022-02-05 17:26:10 +00:00
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- PY_VER: ["3.7", "3.8", "3.9", "3.10"]
|
|
|
|
image: $CI_REGISTRY/funkwhale/backend-test-docker:$PY_VER
|
2022-01-13 10:48:47 +00:00
|
|
|
|
2018-01-09 19:47:03 +00:00
|
|
|
test_front:
|
2019-09-23 09:15:32 +00:00
|
|
|
interruptible: true
|
2018-01-09 19:47:03 +00:00
|
|
|
stage: test
|
2022-02-03 08:32:59 +00:00
|
|
|
image: node:16-buster
|
2018-01-09 19:47:03 +00:00
|
|
|
before_script:
|
|
|
|
- cd front
|
2018-07-01 14:21:08 +00:00
|
|
|
only:
|
2021-11-02 08:10:06 +00:00
|
|
|
refs:
|
|
|
|
- branches
|
2018-01-09 19:47:03 +00:00
|
|
|
script:
|
2019-01-15 11:10:40 +00:00
|
|
|
- yarn install --check-files
|
2018-08-11 15:58:51 +00:00
|
|
|
- yarn test:unit
|
2017-12-16 15:10:48 +00:00
|
|
|
cache:
|
2018-07-04 16:31:29 +00:00
|
|
|
key: "funkwhale__front_dependencies"
|
2017-12-16 15:10:48 +00:00
|
|
|
paths:
|
2018-01-09 19:47:03 +00:00
|
|
|
- front/node_modules
|
|
|
|
- front/yarn.lock
|
|
|
|
artifacts:
|
|
|
|
name: "front_${CI_COMMIT_REF_NAME}"
|
|
|
|
paths:
|
|
|
|
- front/dist/
|
2021-04-22 13:57:15 +00:00
|
|
|
reports:
|
|
|
|
junit: front/test-results.xml
|
2017-06-25 17:13:46 +00:00
|
|
|
tags:
|
2017-06-26 15:20:46 +00:00
|
|
|
- docker
|
2017-06-25 17:13:46 +00:00
|
|
|
|
2022-01-28 12:33:39 +00:00
|
|
|
build_docs:
|
|
|
|
stage: build
|
2022-04-01 07:00:49 +00:00
|
|
|
image: $CI_REGISTRY/funkwhale/backend-test-docker:3.10
|
2022-01-28 12:33:39 +00:00
|
|
|
services:
|
2022-02-03 19:33:13 +00:00
|
|
|
- postgres:14
|
2022-02-03 19:22:22 +00:00
|
|
|
- redis:6
|
2022-01-28 12:33:39 +00:00
|
|
|
cache:
|
|
|
|
key: "$CI_PROJECT_ID__pip_cache"
|
|
|
|
paths:
|
|
|
|
- "$PIP_CACHE_DIR"
|
|
|
|
variables:
|
|
|
|
DATABASE_URL: "postgresql://postgres@postgres/postgres"
|
|
|
|
FUNKWHALE_URL: "https://funkwhale.ci"
|
|
|
|
DJANGO_SETTINGS_MODULE: config.settings.local
|
|
|
|
POSTGRES_HOST_AUTH_METHOD: trust
|
|
|
|
CACHE_URL: "redis://redis:6379/0"
|
|
|
|
before_script:
|
|
|
|
- cd api
|
|
|
|
- pip3 install poetry
|
2022-04-01 07:20:49 +00:00
|
|
|
- poetry run pip install setuptools==59.1.1 # Hotfix for failing pipelines #1745
|
2022-01-28 12:33:39 +00:00
|
|
|
- poetry install
|
|
|
|
- poetry run python manage.py migrate
|
|
|
|
script:
|
|
|
|
- poetry run python manage.py spectacular --file ../docs/schema.yml
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- docs/schema.yml
|
|
|
|
|
2017-06-25 17:13:46 +00:00
|
|
|
build_front:
|
|
|
|
stage: build
|
2022-02-03 08:32:59 +00:00
|
|
|
image: node:16-buster
|
2017-06-25 17:13:46 +00:00
|
|
|
before_script:
|
2018-07-01 15:07:21 +00:00
|
|
|
- curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64
|
|
|
|
- chmod +x /usr/local/bin/jq
|
2017-06-25 17:13:46 +00:00
|
|
|
- cd front
|
|
|
|
script:
|
2018-01-09 19:47:03 +00:00
|
|
|
- yarn install
|
2018-04-16 20:54:36 +00:00
|
|
|
- yarn run i18n-compile
|
2018-04-20 17:25:29 +00:00
|
|
|
# this is to ensure we don't have any errors in the output,
|
2018-12-10 15:00:33 +00:00
|
|
|
# cf https://dev.funkwhale.audio/funkwhale/funkwhale/issues/169
|
2022-02-27 22:20:03 +00:00
|
|
|
- yarn run build:deployment | tee /dev/stderr | (! grep -i 'ERROR in')
|
2018-08-19 15:30:18 +00:00
|
|
|
- chmod -R 755 dist
|
2017-06-25 17:13:46 +00:00
|
|
|
artifacts:
|
|
|
|
name: "front_${CI_COMMIT_REF_NAME}"
|
|
|
|
paths:
|
|
|
|
- front/dist/
|
|
|
|
only:
|
2018-04-22 12:06:13 +00:00
|
|
|
- tags@funkwhale/funkwhale
|
|
|
|
- master@funkwhale/funkwhale
|
2021-09-21 11:36:16 +00:00
|
|
|
- stable@funkwhale/funkwhale
|
2018-04-22 12:06:13 +00:00
|
|
|
- develop@funkwhale/funkwhale
|
2017-06-25 17:13:46 +00:00
|
|
|
tags:
|
|
|
|
- docker
|
2017-06-25 14:45:33 +00:00
|
|
|
|
2022-03-30 10:08:43 +00:00
|
|
|
build_documentation:
|
|
|
|
stage: build
|
2022-03-02 14:50:59 +00:00
|
|
|
image: python:3.10
|
2018-04-26 16:12:08 +00:00
|
|
|
variables:
|
|
|
|
BUILD_PATH: "../public"
|
2017-06-25 17:05:31 +00:00
|
|
|
before_script:
|
|
|
|
- cd docs
|
2018-06-24 21:42:38 +00:00
|
|
|
- apt-get update
|
2022-03-02 14:50:59 +00:00
|
|
|
- apt-get install -y graphviz git
|
|
|
|
- pip install poetry
|
|
|
|
- poetry install
|
2022-03-21 11:12:36 +00:00
|
|
|
- git switch develop && git pull
|
|
|
|
- git switch stable && git pull
|
|
|
|
- git switch $CI_COMMIT_BRANCH && git pull
|
2018-06-24 21:42:38 +00:00
|
|
|
script:
|
2018-04-26 16:12:08 +00:00
|
|
|
- ./build_docs.sh
|
2018-06-24 10:37:01 +00:00
|
|
|
cache:
|
|
|
|
key: "$CI_PROJECT_ID__sphinx"
|
|
|
|
paths:
|
|
|
|
- "$PIP_CACHE_DIR"
|
2017-06-25 17:05:31 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- public
|
|
|
|
only:
|
2021-09-21 11:36:16 +00:00
|
|
|
- stable@funkwhale/funkwhale
|
2017-06-25 17:07:49 +00:00
|
|
|
tags:
|
|
|
|
- docker
|
2017-06-26 17:48:09 +00:00
|
|
|
|
2022-03-30 10:08:43 +00:00
|
|
|
deploy_documentation:
|
|
|
|
stage: deploy
|
|
|
|
image: alpine
|
|
|
|
dependencies:
|
|
|
|
- build_documentation
|
|
|
|
before_script:
|
|
|
|
- apk add openssh-client rsync
|
|
|
|
- mkdir -p ~/.ssh
|
|
|
|
- echo "$SSH_KNOWN_HOSTS" >> ~/.ssh/known_hosts
|
|
|
|
- chmod 644 ~/.ssh/known_hosts
|
|
|
|
- eval `ssh-agent -s`
|
|
|
|
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
|
|
|
|
script:
|
|
|
|
- rsync -r -e "ssh -p 2282" $CI_PROJECT_DIR/public/ docs@docs.funkwhale.audio:/htdocs/
|
|
|
|
only:
|
|
|
|
- stable
|
|
|
|
|
|
|
|
|
2021-11-06 21:55:25 +00:00
|
|
|
.docker_publish:
|
2017-06-26 18:07:19 +00:00
|
|
|
stage: deploy
|
2021-09-09 15:32:41 +00:00
|
|
|
image: egon0/docker-with-buildx-and-git:bash
|
2021-11-06 21:55:25 +00:00
|
|
|
tags:
|
|
|
|
- multiarch
|
2021-09-09 15:11:59 +00:00
|
|
|
services:
|
|
|
|
- docker:20-dind
|
2017-06-26 17:48:09 +00:00
|
|
|
before_script:
|
2017-06-26 17:51:25 +00:00
|
|
|
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
2017-06-26 17:48:09 +00:00
|
|
|
script:
|
2021-11-06 21:55:25 +00:00
|
|
|
|
|
|
|
docker_publish_stable_release:
|
|
|
|
# Publish a docker image for releases
|
|
|
|
extends: .docker_publish
|
2022-06-28 13:55:54 +00:00
|
|
|
variables:
|
|
|
|
IMAGE_NAME: funkwhale/$COMPONENT
|
2021-11-06 21:55:25 +00:00
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG && $CI_COMMIT_REF_NAME =~ /^[0-9]+(.[0-9]+){1,2}$/
|
|
|
|
script:
|
|
|
|
# Check if this is the latest release
|
|
|
|
- ./docs/get-releases-json.py | scripts/is-docker-latest.py $CI_COMMIT_TAG - && export DOCKER_LATEST_TAG="-t $IMAGE_LATEST" || export DOCKER_LATEST_TAG=;
|
2022-02-03 08:32:59 +00:00
|
|
|
- export major="$(echo $CI_COMMIT_REF_NAME | cut -d '.' -f 1)"
|
2021-12-29 19:20:29 +00:00
|
|
|
- export minor="$(echo $CI_COMMIT_REF_NAME | cut -d '.' -f 1,2)"
|
2022-06-28 13:55:54 +00:00
|
|
|
- cd $COMPONENT
|
2021-11-06 21:55:25 +00:00
|
|
|
- docker buildx create --use --name A$CI_COMMIT_SHORT_SHA
|
2021-12-29 19:20:29 +00:00
|
|
|
- docker buildx build --platform $BUILD_PLATFORMS --push -t $IMAGE $DOCKER_LATEST_TAG -t $IMAGE_NAME:$major -t $IMAGE_NAME:$minor .
|
2022-06-28 13:55:54 +00:00
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- COMPONENT: ["api", "front"]
|
2021-11-06 21:55:25 +00:00
|
|
|
|
|
|
|
docker_publish_unstable_release:
|
|
|
|
# Publish a docker image for releases
|
|
|
|
extends: .docker_publish
|
2022-06-28 13:55:54 +00:00
|
|
|
variables:
|
|
|
|
IMAGE_NAME: funkwhale/$COMPONENT
|
2021-11-06 21:55:25 +00:00
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG && $CI_COMMIT_REF_NAME !~ /^[0-9]+(.[0-9]+){1,2}$/
|
|
|
|
script:
|
|
|
|
# Check if this is the latest release
|
2022-06-28 13:55:54 +00:00
|
|
|
- cd $COMPONENT
|
2021-11-06 21:55:25 +00:00
|
|
|
- docker buildx create --use --name A$CI_COMMIT_SHORT_SHA
|
|
|
|
- docker buildx build --platform $BUILD_PLATFORMS --push -t $IMAGE .
|
2022-06-28 13:55:54 +00:00
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- COMPONENT: ["api", "front"]
|
2021-11-06 21:55:25 +00:00
|
|
|
|
2022-06-28 13:55:54 +00:00
|
|
|
docker_publish_non-release:
|
2021-11-06 21:55:25 +00:00
|
|
|
# Publish a docker image for each commit on develop
|
|
|
|
extends: .docker_publish
|
2022-06-28 13:55:54 +00:00
|
|
|
variables:
|
|
|
|
IMAGE_NAME: funkwhale/$COMPONENT
|
2017-06-26 17:48:09 +00:00
|
|
|
only:
|
2018-04-22 12:06:13 +00:00
|
|
|
- develop@funkwhale/funkwhale
|
2021-09-21 11:36:16 +00:00
|
|
|
- stable@funkwhale/funkwhale
|
2021-11-06 21:55:25 +00:00
|
|
|
script:
|
|
|
|
- ./scripts/set-api-build-metadata.sh $CI_COMMIT_SHORT_SHA
|
2022-06-28 13:55:54 +00:00
|
|
|
- cd $COMPONENT
|
2021-11-06 21:55:25 +00:00
|
|
|
- docker buildx create --use --name A$CI_COMMIT_SHORT_SHA
|
|
|
|
- docker buildx build --platform $BUILD_PLATFORMS --push -t $IMAGE .
|
2022-06-28 13:55:54 +00:00
|
|
|
parallel:
|
|
|
|
matrix:
|
|
|
|
- COMPONENT: ["api", "front"]
|
2017-06-26 20:04:55 +00:00
|
|
|
|
2021-08-15 20:17:22 +00:00
|
|
|
docker_all_in_one_release:
|
|
|
|
stage: deploy
|
2021-09-09 15:32:41 +00:00
|
|
|
image: egon0/docker-with-buildx-and-git:bash
|
2022-01-23 09:22:23 +00:00
|
|
|
allow_failure: true
|
2021-09-09 15:32:41 +00:00
|
|
|
services:
|
|
|
|
- docker:20-dind
|
2021-08-15 20:17:22 +00:00
|
|
|
variables:
|
|
|
|
ALL_IN_ONE_REF: main
|
2021-08-17 08:28:53 +00:00
|
|
|
ALL_IN_ONE_ARTIFACT_URL: https://dev.funkwhale.audio/funkwhale/funkwhale-docker-all-in-one/-/archive/$ALL_IN_ONE_REF/funkwhale-docker-all-in-one-$ALL_IN_ONE_REF.zip
|
2021-08-15 20:17:22 +00:00
|
|
|
BUILD_PATH: all_in_one
|
|
|
|
before_script:
|
|
|
|
- docker login -u $DOCKER_LOGIN -p $DOCKER_PASSWORD
|
2021-09-21 11:36:16 +00:00
|
|
|
- (if [ "$CI_COMMIT_REF_NAME" == "develop" ] || [ "$CI_COMMIT_REF_NAME" == "master" ] || [ "$CI_COMMIT_REF_NAME" == "stable" ]; then ./scripts/set-api-build-metadata.sh $(echo $CI_COMMIT_SHA | cut -c 1-8); fi);
|
2021-08-15 20:17:22 +00:00
|
|
|
script:
|
|
|
|
- if [[ ! -z "$CI_COMMIT_TAG" ]]; then (./docs/get-releases-json.py | scripts/is-docker-latest.py $CI_COMMIT_TAG -) && export DOCKER_LATEST_TAG="-t $ALL_IN_ONE_IMAGE_LATEST" || export DOCKER_LATEST_TAG=; fi
|
|
|
|
- wget $ALL_IN_ONE_ARTIFACT_URL -O all_in_one.zip
|
|
|
|
- unzip -o all_in_one.zip -d tmpdir
|
2021-08-17 08:45:27 +00:00
|
|
|
- mv tmpdir/funkwhale-docker-all-in-one-$ALL_IN_ONE_REF $BUILD_PATH && rmdir tmpdir
|
2021-08-15 20:17:22 +00:00
|
|
|
- cp -r api $BUILD_PATH/src/api
|
|
|
|
- cp -r front $BUILD_PATH/src/front
|
|
|
|
- cd $BUILD_PATH
|
|
|
|
- ./scripts/download-nginx-template.sh src/ $CI_COMMIT_REF_NAME
|
|
|
|
- docker build -t $ALL_IN_ONE_IMAGE $DOCKER_LATEST_TAG .
|
|
|
|
- docker push $ALL_IN_ONE_IMAGE
|
|
|
|
- if [[ ! -z "$DOCKER_LATEST_TAG" ]]; then docker push $ALL_IN_ONE_IMAGE_LATEST; fi
|
|
|
|
only:
|
|
|
|
- develop@funkwhale/funkwhale
|
|
|
|
- master@funkwhale/funkwhale
|
2021-09-21 11:36:16 +00:00
|
|
|
- stable@funkwhale/funkwhale
|
2021-08-15 20:17:22 +00:00
|
|
|
- tags@funkwhale/funkwhale
|
2019-01-16 10:56:58 +00:00
|
|
|
|
2017-07-17 20:01:02 +00:00
|
|
|
build_api:
|
|
|
|
# Simply publish a zip containing api/ directory
|
|
|
|
stage: deploy
|
2019-01-11 09:01:06 +00:00
|
|
|
image: bash
|
2017-07-17 20:01:02 +00:00
|
|
|
artifacts:
|
|
|
|
name: "api_${CI_COMMIT_REF_NAME}"
|
|
|
|
paths:
|
|
|
|
- api
|
2018-06-28 14:51:29 +00:00
|
|
|
script:
|
2019-05-13 13:30:58 +00:00
|
|
|
- rm -rf api/tests
|
2021-09-21 11:36:16 +00:00
|
|
|
- (if [ "$CI_COMMIT_REF_NAME" == "develop" ] || [ "$CI_COMMIT_REF_NAME" == "stable" ] || [ "$CI_COMMIT_REF_NAME" == "master" ]; then ./scripts/set-api-build-metadata.sh $(echo $CI_COMMIT_SHA | cut -c 1-8); fi);
|
2018-06-28 14:51:29 +00:00
|
|
|
- chmod -R 750 api
|
|
|
|
- echo Done!
|
2017-07-17 20:01:02 +00:00
|
|
|
only:
|
2018-04-22 12:06:13 +00:00
|
|
|
- tags@funkwhale/funkwhale
|
|
|
|
- master@funkwhale/funkwhale
|
2021-09-21 11:36:16 +00:00
|
|
|
- stable@funkwhale/funkwhale
|
2018-04-22 12:06:13 +00:00
|
|
|
- develop@funkwhale/funkwhale
|