2021-03-23 04:43:13 +00:00
---
# NOTE: This file is generated from `bitbucket-pipelines.yml.j2` via `pipelines-generator.py`:
#
# python3 pipelines-generator.py > bitbucket-pipelines.yml
2022-03-14 05:01:39 +00:00
image: docker-public.packages.atlassian.com/atlassian/docker-release-maker:latest
2021-03-23 04:43:13 +00:00
definitions:
services:
docker:
2024-07-03 08:10:13 +00:00
memory: 3072
2021-03-23 04:43:13 +00:00
options:
2024-07-03 08:10:13 +00:00
size: 1x
2021-03-23 04:43:13 +00:00
pipelines:
branches:
######################################################################
# Master branch: Do full release for each image flavour
######################################################################
master:
- step:
name: Check if pipelines config is up-to-date...
script:
- python3 pipelines-generator.py > bitbucket-piplines.yml.expected && diff bitbucket-pipelines.yml bitbucket-piplines.yml.expected
- parallel:
{% for (name, pdata) in images.items() %}
{% for (jdkver, appdata) in pdata.items() %}
{% for offset in range(0, batches) %}
- step:
2021-07-14 01:23:53 +00:00
name: JDK {{ jdkver }} - Batch {{ offset + 1 }}
2021-03-23 04:43:13 +00:00
services:
- docker
script:
- git submodule update --init --recursive
2024-07-03 08:21:15 +00:00
- for i in {1..3}; do echo ${DOCKER_BOT_PASSWORD} | docker login ${DOCKER_REGISTRY} --username ${DOCKER_BOT_USERNAME} --password-stdin && break || sleep 5; done; if [ $? -ne 0 ]; then echo "Failed to login to container registry after 3 attempts" && exit 1; fi
2024-06-12 04:59:51 +00:00
- docker buildx create --name container --driver docker-container --use
- docker buildx ls
2021-03-23 04:43:13 +00:00
- >
2021-03-29 03:25:28 +00:00
python /usr/src/app/make-releases.py \
--update \
--start-version='{{ appdata.start_version }}' \
2022-07-05 06:21:09 +00:00
{% if appdata.end_version|length %}
--end-version='{{ appdata.end_version }}' \
{% endif %}
2021-03-23 04:43:13 +00:00
{% if appdata.default_release %}
2021-03-29 03:25:28 +00:00
--default-release \
2021-03-23 04:43:13 +00:00
{% endif %}
2024-05-21 00:34:40 +00:00
{% if appdata.default_eap %}
2023-08-03 05:20:17 +00:00
--default-eap \
2024-05-21 00:34:40 +00:00
{% endif %}
2021-03-29 04:29:57 +00:00
--dockerfile='{{ appdata.dockerfile }}' \
2021-03-29 03:25:28 +00:00
--dockerfile-buildargs='BASE_IMAGE={{ appdata.base_image }}' \
--dockerfile-version-arg='CONFLUENCE_VERSION' \
--mac-product-key='confluence' \
2021-03-29 06:21:24 +00:00
--tag-suffixes='{{ appdata.tag_suffixes|join(',') }}' \
2021-03-29 03:25:28 +00:00
--concurrent-builds='1' \
--job-offset='{{ offset }}' \
--jobs-total='{{ batches }}' \
--docker-repos='{{ appdata.docker_repos|join(',') }}' \
2024-06-12 04:59:51 +00:00
--push \
2024-07-22 22:03:01 +00:00
--platforms=linux/amd64,linux/arm64 \
--skip-versions=9.0.0
2023-02-01 02:57:06 +00:00
2021-03-23 04:43:13 +00:00
{% endfor %}
{% endfor %}
{% endfor %}
2021-07-15 00:00:29 +00:00
######################################################################
# All other branches & PRs; run unit tests & functional tests
# against latest app version
######################################################################
'**':
- step:
2021-07-15 00:04:10 +00:00
name: Check if pipelines config is up-to-date...
2021-07-15 00:00:29 +00:00
script:
2021-07-15 00:04:10 +00:00
- python3 pipelines-generator.py > bitbucket-piplines.yml.expected && diff bitbucket-pipelines.yml bitbucket-piplines.yml.expected
- parallel:
- step:
name: Run unit tests
image: python:3.7-alpine3.9
services:
- docker
script:
- apk add --no-cache git
- git submodule update --init --recursive
- pip install -q -r shared-components/tests/requirements.txt
- export PYTHONPATH=./shared-components/tests:$PYTHONPATH
- export DOCKERFILE='Dockerfile'
- export DOCKERFILE_VERSION_ARG='CONFLUENCE_VERSION'
- export MAC_PRODUCT_KEY='confluence'
2024-07-22 22:03:01 +00:00
- export APP_TEST_VERSION='8.9.4' # remove it after 9.0.0 is out
2021-07-15 00:04:10 +00:00
- py.test -v tests/
- py.test -v shared-components/tests/
2024-03-13 04:08:20 +00:00
- step:
name: Run unit tests - UBI
image: python:3.7-alpine3.9
services:
- docker
script:
- apk add --no-cache git
- git submodule update --init --recursive
- pip install -q -r shared-components/tests/requirements.txt
- export PYTHONPATH=./shared-components/tests:$PYTHONPATH
- export DOCKERFILE='Dockerfile.ubi'
- export DOCKERFILE_VERSION_ARG='CONFLUENCE_VERSION'
- export MAC_PRODUCT_KEY='confluence'
2024-07-22 22:03:01 +00:00
- export APP_TEST_VERSION='8.9.4' # remove it after 9.0.0 is out
2024-03-13 04:08:20 +00:00
- py.test -v tests/
2021-07-15 00:04:10 +00:00
- step:
name: Run integration tests
services:
- docker
script:
- apk add --no-cache git docker-compose jq curl
- git submodule update --init --recursive
2022-04-12 02:45:23 +00:00
- export CONFLUENCE_VERSION=`curl -s https://marketplace.atlassian.com/rest/2/products/key/confluence/versions | jq -r '._embedded.versions | .[0].name'`
2024-07-22 22:03:01 +00:00
- export CONFLUENCE_VERSION="8.9.4" # remove it after 9.0.0 is out
2021-07-15 00:04:10 +00:00
- docker build --build-arg CONFLUENCE_VERSION=${CONFLUENCE_VERSION} -t test-image .
- export IS_RELEASE=false
- /usr/src/app/post_build.sh test-image $IS_RELEASE
2021-07-15 00:00:29 +00:00
2024-03-13 04:08:20 +00:00
- step:
name: Run integration tests - UBI
services:
- docker
script:
- apk add --no-cache git docker-compose jq curl
- git submodule update --init --recursive
- export CONFLUENCE_VERSION=`curl -s https://marketplace.atlassian.com/rest/2/products/key/confluence/versions | jq -r '._embedded.versions | .[0].name'`
2024-07-22 22:03:01 +00:00
- export CONFLUENCE_VERSION="8.9.4" # remove it after 9.0.0 is out
2024-03-13 04:08:20 +00:00
- docker build --build-arg CONFLUENCE_VERSION=${CONFLUENCE_VERSION} -t test-image-ubi . -f Dockerfile.ubi
- export IS_RELEASE=false
- /usr/src/app/post_build.sh test-image-ubi $IS_RELEASE
2021-03-23 04:43:13 +00:00
custom:
######################################################################
2024-07-15 05:49:35 +00:00
# Custom: Find and build new releases
2021-03-23 04:43:13 +00:00
######################################################################
new-releases:
- parallel:
{% for (name, pdata) in images.items() %}
{% for (jdkver, appdata) in pdata.items() %}
2024-06-25 03:52:01 +00:00
{% for offset in range(0, 1) %}
2021-03-23 04:43:13 +00:00
- step:
2021-07-14 01:23:53 +00:00
name: JDK {{ jdkver }} - Batch {{ offset + 1 }}
2021-03-23 04:43:13 +00:00
services:
- docker
script:
- git submodule update --init --recursive
2024-07-03 08:21:15 +00:00
- for i in {1..3}; do echo ${DOCKER_BOT_PASSWORD} | docker login ${DOCKER_REGISTRY} --username ${DOCKER_BOT_USERNAME} --password-stdin && break || sleep 5; done; if [ $? -ne 0 ]; then echo "Failed to login to container registry after 3 attempts" && exit 1; fi
2024-06-12 04:59:51 +00:00
- docker buildx create --name container --driver docker-container --use
- docker buildx ls
2021-03-23 04:43:13 +00:00
- >
2021-03-29 03:25:28 +00:00
python /usr/src/app/make-releases.py \
--create \
2021-04-20 02:46:35 +00:00
--create-eap \
2021-03-29 03:25:28 +00:00
--start-version='{{ appdata.start_version }}' \
2022-07-05 06:21:09 +00:00
{% if appdata.end_version|length %}
--end-version='{{ appdata.end_version }}' \
{% endif %}
2021-03-23 04:43:13 +00:00
{% if appdata.default_release %}
2021-03-29 03:25:28 +00:00
--default-release \
2021-03-23 04:43:13 +00:00
{% endif %}
2024-05-21 00:34:40 +00:00
{% if appdata.default_eap %}
2023-08-03 05:20:17 +00:00
--default-eap \
2024-05-21 00:34:40 +00:00
{% endif %}
2021-03-29 04:29:57 +00:00
--dockerfile='{{ appdata.dockerfile }}' \
2021-03-29 03:25:28 +00:00
--dockerfile-buildargs='BASE_IMAGE={{ appdata.base_image }}' \
--dockerfile-version-arg='CONFLUENCE_VERSION' \
--mac-product-key='confluence' \
2021-03-29 06:21:24 +00:00
--tag-suffixes='{{ appdata.tag_suffixes|join(',') }}' \
2021-03-29 03:25:28 +00:00
--concurrent-builds='1' \
--job-offset='{{ offset }}' \
2024-07-15 05:49:35 +00:00
--jobs-total='1' \
2021-03-29 03:25:28 +00:00
--docker-repos='{{ appdata.docker_repos|join(',') }}' \
2024-06-12 04:59:51 +00:00
--push \
2024-07-22 22:03:01 +00:00
--platforms=linux/amd64,linux/arm64 \
--skip-versions=9.0.0
2023-02-01 02:57:06 +00:00
2021-03-23 04:43:13 +00:00
{% endfor %}
{% endfor %}
{% endfor %}
custom-release:
- variables:
- name: CONFLUENCE_VERSION
- name: DOCKER_TAG
- step:
services:
- docker
script:
- git submodule update --init --recursive
2024-07-03 08:21:15 +00:00
- for i in {1..3}; do echo ${DOCKER_BOT_PASSWORD} | docker login ${DOCKER_REGISTRY} --username ${DOCKER_BOT_USERNAME} --password-stdin && break || sleep 5; done; if [ $? -ne 0 ]; then echo "Failed to login to container registry after 3 attempts" && exit 1; fi
2021-03-23 04:43:13 +00:00
- >
2022-03-16 02:55:28 +00:00
docker build -t ${DOCKER_REGISTRY}/atlassian/confluence:${DOCKER_TAG}
2021-03-23 04:43:13 +00:00
--build-arg CONFLUENCE_VERSION=${CONFLUENCE_VERSION} .
2021-09-02 09:58:54 +00:00
- snyk auth $SNYK_TOKEN
2022-03-16 02:55:28 +00:00
- snyk container test ${DOCKER_REGISTRY}/atlassian/confluence:${DOCKER_TAG} --severity-threshold=high
- docker push ${DOCKER_REGISTRY}/atlassian/confluence:${DOCKER_TAG}