mirror of
https://github.com/Alfresco/alfresco-transform-core.git
synced 2025-08-14 17:58:27 +00:00
ATS-628: Update build config on support branches
This commit is contained in:
82
.travis.yml
Normal file
82
.travis.yml
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
---
|
||||||
|
language: java
|
||||||
|
jdk: openjdk11
|
||||||
|
dist: xenial
|
||||||
|
|
||||||
|
git:
|
||||||
|
depth: false
|
||||||
|
quiet: true
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
cache:
|
||||||
|
directories:
|
||||||
|
- ${HOME}/.m2/repository
|
||||||
|
- ${HOME}/artifacts
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- /^SP\/.+$/
|
||||||
|
- /^HF\/.+$/
|
||||||
|
- company_release
|
||||||
|
- /^ATS-.*$/
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
- release
|
||||||
|
- company_release
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
include:
|
||||||
|
- name: "Build + Tests"
|
||||||
|
stage: build
|
||||||
|
if: branch NOT IN (company_release)
|
||||||
|
before_install: bash _ci/init.sh
|
||||||
|
before_script: travis_wait bash _ci/cache_artifacts.sh
|
||||||
|
script: bash _ci/build.sh
|
||||||
|
|
||||||
|
- name: "WhiteSource"
|
||||||
|
stage: build
|
||||||
|
if: branch NOT IN (company_release)
|
||||||
|
before_install: bash _ci/init.sh
|
||||||
|
script: bash _ci/whitesource.sh
|
||||||
|
|
||||||
|
- name: "Release"
|
||||||
|
stage: release
|
||||||
|
if: commit_message ~= /\[trigger release\]/ AND branch ~= /^(master|SP\/.+|HF\/.+)$/
|
||||||
|
before_install: bash _ci/init.sh
|
||||||
|
before_script: travis_wait bash _ci/cache_artifacts.sh
|
||||||
|
script: travis_wait 30 bash _ci/release.sh
|
||||||
|
before_deploy: source _ci/prepare_staging_deploy.sh
|
||||||
|
deploy:
|
||||||
|
provider: s3
|
||||||
|
access_key_id: "${STAGING_AWS_ACCESS_KEY}"
|
||||||
|
secret_access_key: "${STAGING_AWS_SECRET_KEY}"
|
||||||
|
bucket: "alfresco-artefacts-staging"
|
||||||
|
skip_cleanup: true
|
||||||
|
region: "eu-west-1"
|
||||||
|
local_dir: "deploy_dir"
|
||||||
|
upload-dir: "enterprise/AlfrescoTransformServices/TransformEngines/${VERSION}"
|
||||||
|
on:
|
||||||
|
all_branches: true
|
||||||
|
|
||||||
|
- name: "Company Release"
|
||||||
|
stage: company_release
|
||||||
|
if: branch = company_release
|
||||||
|
before_install: bash _ci/init.sh
|
||||||
|
install: echo "NoOp"
|
||||||
|
script: echo "NoOp"
|
||||||
|
before_deploy: source _ci/prepare_release_deploy.sh
|
||||||
|
deploy:
|
||||||
|
provider: s3
|
||||||
|
access_key_id: "${RELEASE_AWS_ACCESS_KEY}"
|
||||||
|
secret_access_key: "${RELEASE_AWS_SECRET_KEY}"
|
||||||
|
bucket: "eu.dl.alfresco.com"
|
||||||
|
skip_cleanup: true
|
||||||
|
region: "eu-west-1"
|
||||||
|
local_dir: "deploy_dir"
|
||||||
|
upload-dir: "release/enterprise/AlfrescoTransformServices/TransformEngines/${VERSION}"
|
||||||
|
on:
|
||||||
|
branch: company_release
|
24
_ci/build.sh
Normal file
24
_ci/build.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "=========================== Starting Build&Test Script ==========================="
|
||||||
|
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||||
|
set -vex
|
||||||
|
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
|
||||||
|
|
||||||
|
# Always build the image, but only publish from the "master" branch
|
||||||
|
[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && PROFILE="internal" || PROFILE="local"
|
||||||
|
|
||||||
|
# If the branch is "master" and the commit is not a Pull Request then deploy the JAR SNAPSHOT artifacts
|
||||||
|
[ "${TRAVIS_PULL_REQUEST}" = "false" ] && [ "${TRAVIS_BRANCH}" = "master" ] && DEPLOY="deploy" || DEPLOY="install"
|
||||||
|
|
||||||
|
mvn -B -U \
|
||||||
|
clean ${DEPLOY} \
|
||||||
|
-DadditionalOption=-Xdoclint:none -Dmaven.javadoc.skip=true \
|
||||||
|
"-P${PROFILE},docker-it-setup"
|
||||||
|
|
||||||
|
docker ps -a -q | xargs -r -l docker stop ; docker ps -a -q | xargs -r -l docker rm
|
||||||
|
|
||||||
|
popd
|
||||||
|
set +vex
|
||||||
|
echo "=========================== Finishing Build&Test Script =========================="
|
||||||
|
|
24
_ci/cache_artifacts.sh
Normal file
24
_ci/cache_artifacts.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "=========================== Starting Cache Artifacts Script ==========================="
|
||||||
|
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||||
|
set -vex
|
||||||
|
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
|
||||||
|
|
||||||
|
LIBREOFFICE_VERSION=5.4.6
|
||||||
|
|
||||||
|
# Cache the LibreOffice distribution, as it is takes a long time to download and it can cause the
|
||||||
|
# build to fail (no output for more than 10 minutes)
|
||||||
|
LIBREOFFICE_RPM_URL="https://nexus.alfresco.com/nexus/service/local/repositories/thirdparty/content/org/libreoffice/libreoffice-dist/${LIBREOFFICE_VERSION}/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz"
|
||||||
|
if [ -f "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz" ]; then
|
||||||
|
echo "Using cached LibreOffice distribution..."
|
||||||
|
else
|
||||||
|
echo "Downloading LibreOffice distribution..."
|
||||||
|
curl -s -S ${LIBREOFFICE_RPM_URL} -o "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz"
|
||||||
|
fi
|
||||||
|
cp "${HOME}/artifacts/libreoffice-dist-${LIBREOFFICE_VERSION}-linux.gz" alfresco-docker-libreoffice/
|
||||||
|
|
||||||
|
|
||||||
|
popd
|
||||||
|
set +vex
|
||||||
|
echo "=========================== Finishing Cache Artifacts Script =========================="
|
20
_ci/init.sh
Normal file
20
_ci/init.sh
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "=========================== Starting Init Script ==========================="
|
||||||
|
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||||
|
set -vex
|
||||||
|
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
|
||||||
|
|
||||||
|
mkdir -p ${HOME}/.m2 && cp -rf _ci/settings.xml ${HOME}/.m2/
|
||||||
|
echo "${QUAY_PASSWORD}" | docker login -u="alfresco+bamboo" --password-stdin quay.io
|
||||||
|
echo "${DOCKERHUB_PASSWORD}" | docker login -u=${DOCKERHUB_USERNAME} --password-stdin docker.io
|
||||||
|
find "${HOME}/.m2/repository/" -type d -name "*-SNAPSHOT*" | xargs -r -l rm -rf
|
||||||
|
|
||||||
|
# Enable experimental docker features (e.g. squash options)
|
||||||
|
echo '{"experimental":true}' | sudo tee /etc/docker/daemon.json
|
||||||
|
sudo service docker restart
|
||||||
|
|
||||||
|
popd
|
||||||
|
set +vex
|
||||||
|
echo "=========================== Finishing Init Script =========================="
|
||||||
|
|
24
_ci/prepare_release_deploy.sh
Normal file
24
_ci/prepare_release_deploy.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "========================== Starting Prepare Release Deploy Script ==========================="
|
||||||
|
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||||
|
set -vex
|
||||||
|
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
|
||||||
|
|
||||||
|
# Identify latest annotated tag (latest version)
|
||||||
|
export VERSION=$(git describe --abbrev=0 --tags)
|
||||||
|
|
||||||
|
mkdir -p deploy_dir
|
||||||
|
|
||||||
|
# Download the WhiteSource report
|
||||||
|
mvn org.alfresco:whitesource-downloader-plugin:inventoryReport \
|
||||||
|
-N \
|
||||||
|
"-Dorg.whitesource.product=Transform Service" \
|
||||||
|
-DsaveReportAs=deploy_dir/3rd-party.xlsx
|
||||||
|
|
||||||
|
echo "Local deploy directory content:"
|
||||||
|
ls -lA deploy_dir
|
||||||
|
|
||||||
|
popd
|
||||||
|
set +vex
|
||||||
|
echo "========================== Finishing Prepare Release Deploy Script =========================="
|
24
_ci/prepare_staging_deploy.sh
Normal file
24
_ci/prepare_staging_deploy.sh
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "========================== Starting Prepare Staging Deploy Script ==========================="
|
||||||
|
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||||
|
set -vex
|
||||||
|
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
|
||||||
|
|
||||||
|
# Identify latest annotated tag (latest version)
|
||||||
|
export VERSION=$(git describe --abbrev=0 --tags)
|
||||||
|
|
||||||
|
mkdir -p deploy_dir
|
||||||
|
|
||||||
|
# Download the WhiteSource report
|
||||||
|
mvn org.alfresco:whitesource-downloader-plugin:inventoryReport \
|
||||||
|
-N \
|
||||||
|
"-Dorg.whitesource.product=Transform Service" \
|
||||||
|
-DsaveReportAs=deploy_dir/3rd-party.xlsx
|
||||||
|
|
||||||
|
echo "Local deploy directory content:"
|
||||||
|
ls -lA deploy_dir
|
||||||
|
|
||||||
|
popd
|
||||||
|
set +vex
|
||||||
|
echo "========================== Finishing Prepare Staging Deploy Script =========================="
|
28
_ci/release.sh
Normal file
28
_ci/release.sh
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "=========================== Starting Release Script ==========================="
|
||||||
|
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||||
|
set -vex
|
||||||
|
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
|
||||||
|
|
||||||
|
# For PR builds only execute a Dry Run of the release
|
||||||
|
[ "${TRAVIS_PULL_REQUEST}" = "false" ] && DRY_RUN="" || DRY_RUN="-DdryRun"
|
||||||
|
|
||||||
|
# Travis CI runner work on DETACHED HEAD, so we need to checkout the release branch
|
||||||
|
git checkout -B "${TRAVIS_BRANCH}"
|
||||||
|
|
||||||
|
git config user.email "build@alfresco.com"
|
||||||
|
|
||||||
|
# Run the release plugin - with "[skip ci]" in the release commit message
|
||||||
|
mvn -B \
|
||||||
|
${DRY_RUN} \
|
||||||
|
-Prelease \
|
||||||
|
"-Darguments=-Prelease -DskipTests -Dmaven.javadoc.skip -Dadditionalparam=-Xdoclint:none" \
|
||||||
|
release:clean release:prepare release:perform \
|
||||||
|
-DscmCommentPrefix="[maven-release-plugin][skip ci] " \
|
||||||
|
-Dusername=alfresco-build \
|
||||||
|
-Dpassword=${GIT_PASSWORD}
|
||||||
|
|
||||||
|
popd
|
||||||
|
set +vex
|
||||||
|
echo "=========================== Finishing Release Script =========================="
|
85
_ci/settings.xml
Normal file
85
_ci/settings.xml
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<settings>
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>alfresco-internal</id>
|
||||||
|
<activation>
|
||||||
|
<activeByDefault>true</activeByDefault>
|
||||||
|
</activation>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>alfresco-internal</id>
|
||||||
|
<name>Alfresco Internal Repository</name>
|
||||||
|
<url>https://artifacts.alfresco.com/nexus/content/groups/internal</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>alfresco-internal</id>
|
||||||
|
<name>Alfresco Internal Repository</name>
|
||||||
|
<url>https://artifacts.alfresco.com/nexus/content/groups/internal</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
<properties>
|
||||||
|
<!-- WhiteSource token -->
|
||||||
|
<org.whitesource.orgToken>${env.WHITESOURCE_TOKEN}</org.whitesource.orgToken>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<servers>
|
||||||
|
<!-- Credential for private Nexus repository groups -->
|
||||||
|
<server>
|
||||||
|
<id>alfresco-internal</id>
|
||||||
|
<username>bamboo</username>
|
||||||
|
<password>${env.NEXUS_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<!-- Credential for private Nexus repositories -->
|
||||||
|
<server>
|
||||||
|
<id>alfresco-internal-snapshots</id>
|
||||||
|
<username>bamboo</username>
|
||||||
|
<password>${env.NEXUS_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>alfresco-internal-releases</id>
|
||||||
|
<username>bamboo</username>
|
||||||
|
<password>${env.NEXUS_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>alfresco-enterprise-snapshots</id>
|
||||||
|
<username>bamboo</username>
|
||||||
|
<password>${env.NEXUS_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>alfresco-enterprise-releases</id>
|
||||||
|
<username>bamboo</username>
|
||||||
|
<password>${env.NEXUS_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>alfresco-public-snapshots</id>
|
||||||
|
<username>bamboo</username>
|
||||||
|
<password>${env.NEXUS_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>alfresco-public</id>
|
||||||
|
<username>bamboo</username>
|
||||||
|
<password>${env.NEXUS_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>alfresco-thirdparty</id>
|
||||||
|
<username>bamboo</username>
|
||||||
|
<password>${env.NEXUS_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
|
||||||
|
<!-- private docker registry-->
|
||||||
|
<server>
|
||||||
|
<id>quay.io</id>
|
||||||
|
<username>alfresco+bamboo</username>
|
||||||
|
<password>${env.QUAY_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
<server>
|
||||||
|
<id>docker.io</id>
|
||||||
|
<username>${env.DOCKERHUB_USERNAME}</username>
|
||||||
|
<password>${env.DOCKERHUB_PASSWORD}</password>
|
||||||
|
</server>
|
||||||
|
</servers>
|
||||||
|
</settings>
|
22
_ci/whitesource.sh
Normal file
22
_ci/whitesource.sh
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
echo "=========================== Starting WhiteSource Script ==========================="
|
||||||
|
PS4="\[\e[35m\]+ \[\e[m\]"
|
||||||
|
set -vex
|
||||||
|
pushd "$(dirname "${BASH_SOURCE[0]}")/../"
|
||||||
|
|
||||||
|
|
||||||
|
mvn clean install \
|
||||||
|
-DskipTests org.whitesource:whitesource-maven-plugin:update \
|
||||||
|
-Dorg.whitesource.failOnError=true \
|
||||||
|
-Dorg.whitesource.forceUpdate=true \
|
||||||
|
-Dorg.whitesource.checkPolicies=true \
|
||||||
|
-Dorg.whitesource.forceCheckAllDependencies=true \
|
||||||
|
-Dorg.whitesource.ignorePomModules=false \
|
||||||
|
"-Dorg.whitesource.product=Transform Service" \
|
||||||
|
-Dmaven.wagon.http.pool=false
|
||||||
|
|
||||||
|
popd
|
||||||
|
set +vex
|
||||||
|
echo "=========================== Finishing WhiteSource Script =========================="
|
||||||
|
|
77
docs/build-and-release.md
Normal file
77
docs/build-and-release.md
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# Build
|
||||||
|
The `alfresco-transform-core` project uses _Travis CI_. \
|
||||||
|
The `.travis.yml` config file can be found in the root of the repository.
|
||||||
|
|
||||||
|
|
||||||
|
## Stages and Jobs
|
||||||
|
1. **Build**: Java build with unit tests, integration tests and WhiteSource scan.
|
||||||
|
2. **Release**: Release with artifact deployment to Nexus and AWS Staging bucket.
|
||||||
|
3. **Company Release**: Artifact deployment to AWS Release bucket.
|
||||||
|
|
||||||
|
|
||||||
|
## Branches
|
||||||
|
Travis CI builds differ by branch:
|
||||||
|
* `master` / `SP/*` / `HF/*` branches:
|
||||||
|
- regular builds which include the _Build_ stage;
|
||||||
|
> On the `master` branch only the _Build_ stage updates the `latest` T-Engines images on
|
||||||
|
> both Quay and DockerHub:
|
||||||
|
> - alfresco/alfresco-pdf-renderer
|
||||||
|
> - alfresco/alfresco-imagemagick
|
||||||
|
> - alfresco/alfresco-tika
|
||||||
|
> - alfresco/alfresco-libreoffice
|
||||||
|
- if the commit message contains the `[trigger release]` tag, the builds will also
|
||||||
|
include the _Release_ stage;
|
||||||
|
- PR builds where the latest commit contains the `[trigger release]` tag will execute dry runs
|
||||||
|
of the release jobs (no artifacts will be published until the PR is actually merged).
|
||||||
|
* `ATS-*` branches:
|
||||||
|
- regular builds which include only the _Build_ and _Tests_ stages;
|
||||||
|
* `company_release` branch:
|
||||||
|
- builds that include the _Company Release_ stage only.
|
||||||
|
- the `company_release` branch should be used for one-off events; once used (a build
|
||||||
|
completes), the branch should be deleted.
|
||||||
|
|
||||||
|
All other branches are ignored.
|
||||||
|
|
||||||
|
|
||||||
|
## Release process steps & info
|
||||||
|
Prerequisites:
|
||||||
|
- the `master` / `SP/*` / `HF/*` branch is green and it contains all the changes that should be
|
||||||
|
included in the next release.
|
||||||
|
|
||||||
|
Steps:
|
||||||
|
1. Create a new branch with the name `ATS-###_release_version` from the `master` / `SP/*`/ `HF/*`
|
||||||
|
branch.
|
||||||
|
2. Update the project version if the current POM version is not the next desired release; use a
|
||||||
|
maven command, i.e.
|
||||||
|
```bash
|
||||||
|
mvn versions:set -DnewVersion=#.##.#-SNAPSHOT versions:commit
|
||||||
|
```
|
||||||
|
3. Update the project's dependencies (remove the `-SNAPSHOT` suffixes - only for dependencies, not
|
||||||
|
for the local project version).
|
||||||
|
4. Create a new commit with the `[trigger release]` tag in its message. If no local changes have
|
||||||
|
been generated by steps (2) and (3), then an empty commit should be created - e.g.
|
||||||
|
```bash
|
||||||
|
git commit --allow-empty -m "ATS-###: Release AIS #.##.# [trigger release]"
|
||||||
|
```
|
||||||
|
|
||||||
|
> The location of the `[trigger release]` tag in the commit message is irrelevant.
|
||||||
|
|
||||||
|
> If for any reason your PR contains multiple commits, the commit with the `[trigger release]`
|
||||||
|
tag should be the last (newest) one. This will trigger the Release dry runs.
|
||||||
|
5. Open a new Pull Request from the `ATS-###_release_version` branch into the original
|
||||||
|
`master` / `SP/*` / `HF/*` branch and wait for a green build; the **Release** stage on the PR build
|
||||||
|
will only execute a _Dry_Run_ of the release.
|
||||||
|
6. Once it is approved, merge the PR, preferably through the **Rebase and merge** option. If the
|
||||||
|
**Create a merge commit** (_Merge pull request_) or **Squash and merge** options are used, you
|
||||||
|
need to ensure that the _commit message_ contains the `[trigger release]` tag (sub-string).
|
||||||
|
|
||||||
|
## Company Release process steps & info
|
||||||
|
Prerequisites:
|
||||||
|
- The **Release** stage is complete - i.e. the release commit is tagged and the release
|
||||||
|
artifacts are deployed on Nexus.
|
||||||
|
|
||||||
|
Steps:
|
||||||
|
1. Create a new `company_release` branch from the `master` / `SP/*`/ `HF/*` branch. This job uses
|
||||||
|
the latest branch git tag to identify the version that must be uploaded to the S3 release bucket.
|
||||||
|
2. Wait for a green build on the branch.
|
||||||
|
3. Delete local and remote `company_release` branch.
|
Reference in New Issue
Block a user