mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
REPO-4735 add release stage (#636)
Added the a Engineering Release stage and Company Release stage to travis.yml and added any required credentials to Travis. Each release stage is triggered by a specific commit message, as listed in the "stages" section of travis.yml. Provided a commit message to skip test stages if required, to speed up release process. Global variables have been added to set the release version, development version and the community release version for the release stages.
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -35,4 +35,7 @@ alf_data/
|
||||
|
||||
helm/alfresco-content-services-community/charts/*
|
||||
helm/alfresco-content-services-community/requirements.lock
|
||||
helm/alfresco-content-services-community*.tgz
|
||||
helm/alfresco-content-services-community*.tgz
|
||||
|
||||
# Travis deployment folder
|
||||
deploy_dir
|
49
.travis.settings.xml
Normal file
49
.travis.settings.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<settings>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>alfresco-internal</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>alfresco-internal</id>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<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/public</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
<servers>
|
||||
<server>
|
||||
<id>alfresco-internal</id>
|
||||
<username>${env.MAVEN_USERNAME}</username>
|
||||
<password>${env.MAVEN_PASSWORD}</password>
|
||||
</server>
|
||||
<server>
|
||||
<id>quay.io</id>
|
||||
<username>${env.QUAY_USERNAME}</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>
|
64
.travis.yml
64
.travis.yml
@@ -1,5 +1,5 @@
|
||||
dist: xenial
|
||||
sudo: required
|
||||
os: linux
|
||||
language: java
|
||||
jdk:
|
||||
- openjdk11
|
||||
@@ -10,19 +10,33 @@ services:
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.m2
|
||||
|
||||
# the cache can grow constantly
|
||||
before_cache:
|
||||
- rm -rf $HOME/.m2/repository/org/alfresco/acs-community-packaging
|
||||
env:
|
||||
global:
|
||||
- VERSION_EDITION=Community
|
||||
|
||||
# Must be in the format <alfresco-version>-<additional_versioning> ie. 6.3.0-repo-xxxx-x or 6.3.0-A-x
|
||||
- RELEASE_VERSION=
|
||||
- DEVELOPMENT_VERSION=
|
||||
- COMM_RELEASE_VERSION=
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
|
||||
matrix:
|
||||
stages:
|
||||
- name: test
|
||||
if: commit_message !~ /\[skip tests\]/
|
||||
- release
|
||||
- publish
|
||||
|
||||
before_install: "cp .travis.settings.xml $HOME/.m2/settings.xml"
|
||||
|
||||
jobs:
|
||||
include:
|
||||
- name: "WhiteSource scan"
|
||||
- stage: test
|
||||
name: "WhiteSource scan"
|
||||
# only on develop and if it is not a PR
|
||||
if: fork = false AND branch = develop AND type != pull_request
|
||||
install:
|
||||
@@ -90,3 +104,43 @@ matrix:
|
||||
- ./tests/scripts/wait-for-alfresco-start.sh "http://localhost:8082/alfresco"
|
||||
script:
|
||||
- travis_wait 30 mvn install -q -f tests/tas-integration/pom.xml -Pall-tas-tests -Denvironment=default -DrunBugs=false
|
||||
- stage: Release
|
||||
name: "Maven release"
|
||||
if: commit_message ~= /\[release\]/ AND fork = false AND branch =~ ^(master|develop)$ AND type != pull_request
|
||||
install: travis_retry travis_wait 40 mvn clean install -DskipTests=true "-Dversion.edition=${VERSION_EDITION}" -Dmaven.javadoc.skip=true -B -V
|
||||
# Fail the job if there is a docker image tag that matches the RELEASE_VERSION (or project version in the POM if not set)
|
||||
before_script: ./scripts/travis/verify_release_tag.sh
|
||||
script: travis_wait 40 ./scripts/travis/maven_release.sh ${RELEASE_VERSION} ${DEVELOPMENT_VERSION}
|
||||
# Copy alfresco.war and the distribution zip to deploy_dir
|
||||
before_deploy:
|
||||
# Move the final artifacts to a single folder (deploy_dir) to be copied to S3
|
||||
- mkdir -p deploy_dir
|
||||
- cp war/target/alfresco.war deploy_dir
|
||||
- cp distribution/target/*-distribution*.zip deploy_dir
|
||||
deploy:
|
||||
- provider: s3
|
||||
access_key_id: ${AWS_STAGING_ACCESS_KEY}
|
||||
secret_access_key: ${AWS_STAGING_SECRET_KEY}
|
||||
bucket: "alfresco-artefacts-staging"
|
||||
region: "eu-west-1"
|
||||
skip_cleanup: true
|
||||
acl: private
|
||||
local_dir: deploy_dir
|
||||
upload_dir: "alfresco-content-services-community/release/${TRAVIS_BRANCH}/${TRAVIS_BUILD_NUMBER}"
|
||||
on:
|
||||
all_branches: true
|
||||
condition: $TRAVIS_BRANCH =~ ^(master|develop)$
|
||||
- stage: "Publish"
|
||||
name: "Copy to S3 Release"
|
||||
if: commit_message ~= /\[publish\]/ AND fork = false AND branch = master AND type != pull_request
|
||||
# Nothing to build/install as we are just copying from S3 buckets
|
||||
install: skip
|
||||
script: skip
|
||||
before_deploy: pip install awscli
|
||||
delpoy:
|
||||
- provider: script
|
||||
script: ./scripts/travis/copy_to_release_bucket.sh ${TRAVIS_BUILD_NUMBER} ${TRAVIS_BRANCH}
|
||||
on:
|
||||
branch: master
|
||||
|
||||
|
||||
|
@@ -340,6 +340,7 @@
|
||||
<configuration>
|
||||
<images>
|
||||
<image>
|
||||
<alias>quay.io</alias>
|
||||
<name>${image.name}:${project.version}</name>
|
||||
<registry>${image.registry}</registry>
|
||||
<build>
|
||||
@@ -347,6 +348,7 @@
|
||||
</build>
|
||||
</image>
|
||||
<image>
|
||||
<alias>dockerhub</alias>
|
||||
<name>${image.name}:${project.version}</name>
|
||||
<build>
|
||||
<dockerFileDir>${project.basedir}/</dockerFileDir>
|
||||
@@ -369,6 +371,4 @@
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
6
pom.xml
6
pom.xml
@@ -46,8 +46,8 @@
|
||||
</profiles>
|
||||
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:Alfresco/acs-community-packaging.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:Alfresco/acs-community-packaging.git</developerConnection>
|
||||
<connection>scm:git:https://github.com/Alfresco/acs-community-packaging.git</connection>
|
||||
<developerConnection>scm:git:https://github.com/Alfresco/acs-community-packaging.git</developerConnection>
|
||||
<url>https://github.com/Alfresco/acs-community-packaging</url>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
@@ -116,6 +116,8 @@
|
||||
<dependency.tas-webdav.version>1.6</dependency.tas-webdav.version>
|
||||
<dependency.tas-ftp.version>1.5</dependency.tas-ftp.version>
|
||||
<dependency.tas-dataprep.version>2.3</dependency.tas-dataprep.version>
|
||||
|
||||
<maven.build.sourceVersion>11</maven.build.sourceVersion>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
|
17
scripts/travis/copy_to_release_bucket.sh
Executable file
17
scripts/travis/copy_to_release_bucket.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ev
|
||||
|
||||
if [ -z ${COMM_RELEASE_VERSION} ] || [ -z ${RELEASE_VERSION} ];
|
||||
then
|
||||
echo "Please provide a COMM_RELEASE_VERSION and RELEASE_VERSION in the format <acs-version>-<additional-info> (6.3.0-EA or 6.3.0-SNAPSHOT)"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
build_number=$1
|
||||
branch_name=$2
|
||||
build_stage=release
|
||||
SOURCE=s3://alfresco-artefacts-staging/alfresco-content-services-community/$build_stage/$branch_name/$build_number
|
||||
DESTINATION=s3://eu.dl.alfresco.com/release/community/$COMM_RELEASE_VERSION-build-$build_number
|
||||
|
||||
aws s3 cp --acl private $SOURCE/alfresco.war $DESTINATION/alfresco.war
|
||||
aws s3 cp --acl private $SOURCE/alfresco-content-services-community-distribution-$RELEASE_VERSION.zip $DESTINATION/alfresco-content-services-community-distribution-$RELEASE_VERSION.zip
|
30
scripts/travis/maven_release.sh
Executable file
30
scripts/travis/maven_release.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
releaseVersion=$1
|
||||
developmentVersion=$2
|
||||
scm_path=$(mvn help:evaluate -Dexpression=project.scm.url -q -DforceStdout)
|
||||
|
||||
# Use full history for release
|
||||
git checkout -B "${TRAVIS_BRANCH}"
|
||||
# Add email to link commits to user
|
||||
git config user.email "${GIT_EMAIL}"
|
||||
|
||||
if [ -z ${releaseVersion} ] || [ -z ${developmentVersion} ];
|
||||
then echo "Please provide a Release and Development verison in the format <acs-version>-<additional-info> (6.3.0-EA or 6.3.0-SNAPSHOT)"
|
||||
exit -1
|
||||
else
|
||||
mvn --batch-mode \
|
||||
-Dusername="${GIT_USERNAME}" \
|
||||
-Dpassword="${GIT_PASSWORD}" \
|
||||
-DreleaseVersion=${releaseVersion} \
|
||||
-DdevelopmentVersion=${developmentVersion} \
|
||||
-Dbuild-number=${TRAVIS_BUILD_NUMBER} \
|
||||
-Dbuild-name="${TRAVIS_BUILD_STAGE_NAME}" \
|
||||
-Dscm-path=${scm_path} \
|
||||
-DscmCommentPrefix="[maven-release-plugin][skip ci]" \
|
||||
-DskipTests \
|
||||
"-Darguments=-DskipTests -Dbuild-number=${TRAVIS_BUILD_NUMBER} '-Dbuild-name=${TRAVIS_BUILD_STAGE_NAME}' -Dscm-path=${scm_path} " \
|
||||
release:clean release:prepare release:perform \
|
||||
-Prelease
|
||||
fi
|
31
scripts/travis/verify_release_tag.sh
Executable file
31
scripts/travis/verify_release_tag.sh
Executable file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
if [ -v ${RELEASE_VERSION} ]||[ -z ${RELEASE_VERSION} ]; then
|
||||
echo "Please provide a RELEASE_VERSION in the format <acs-version>-<additional-info> (6.3.0-EA or 6.3.0-SNAPSHOT)"
|
||||
exit -1
|
||||
fi
|
||||
# get the image name from the pom file
|
||||
alfresco_docker_image=$(mvn help:evaluate -f ./docker-alfresco/pom.xml -Dexpression=image.name -q -DforceStdout)
|
||||
docker_image_full_name="$alfresco_docker_image:$RELEASE_VERSION"
|
||||
|
||||
function docker_image_exists() {
|
||||
local image_full_name="$1"; shift
|
||||
local wait_time="${1:-5}"
|
||||
local search_term='Pulling|is up to date|not found'
|
||||
echo "Looking to see if $image_full_name already exists..."
|
||||
local result="$((timeout --preserve-status "$wait_time" docker 2>&1 pull "$image_full_name" &) | grep -v 'Pulling repository' | egrep -o "$search_term")"
|
||||
test "$result" || { echo "Timed out too soon. Try using a wait_time greater than $wait_time..."; return 1 ;}
|
||||
if echo $result | grep -vq 'not found'; then
|
||||
true
|
||||
else
|
||||
false
|
||||
fi
|
||||
}
|
||||
|
||||
if docker_image_exists $docker_image_full_name; then
|
||||
echo "Tag $RELEASE_VERSION already pushed, release process will interrupt."
|
||||
exit -1
|
||||
else
|
||||
echo "The $RELEASE_VERSION tag was not found"
|
||||
fi
|
14
war/pom.xml
14
war/pom.xml
@@ -265,6 +265,20 @@
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<!-- Specify the source version to get around a "feature" in JDK 11.0.2 currently used by travis-->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<source>${maven.build.sourceVersion}</source>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- Ensure consistent maven-release-plugin version-->
|
||||
<plugin>
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.5.3</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
|
Reference in New Issue
Block a user