Skip to content

Commit

Permalink
Merge branch '1.4.0.release' ci_latest
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexGuironnetRTE committed Jun 22, 2020
2 parents 0c91117 + 1c87bf2 commit 7c3b8a4
Show file tree
Hide file tree
Showing 993 changed files with 22,540 additions and 28,224 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ gradle-app.setting
.sonar
.scannerwork

# ignoring .env file needed by docker-compose in deploy containers
**/deploy/.env
# ignoring .env file needed by docker-compose
config/**/.env

# Karate DSL results
src/test/api/karate/target/**/*
Expand All @@ -119,3 +119,4 @@ src/test/utils/karate/karate.jar
ui/main/node_modules
ui/main/reports
ui/main/report.html
ui/main/package-lock.json
119 changes: 63 additions & 56 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sudo: required
os: linux
dist: trusty
addons:
sonarcloud:
Expand All @@ -10,7 +10,12 @@ services:
env:
- NODE_VERSION="v10.16.3"
language: java
# To avoid duplicate builds generated by tags
if: tag IS blank
before_install:
- export OF_VERSION=$(<VERSION)
- export GRADLE_OPTS="-XX:MaxMetaspaceSize=512m -Xmx1024m"
- ./CICD/travis/check_version.sh --branch $TRAVIS_BRANCH --version $OF_VERSION
- nvm install $NODE_VERSION
install:
# first install needs to remove ~/.sdkman (empty in our case because created by cache step) otherwise SdkMan is not installed
Expand Down Expand Up @@ -49,69 +54,71 @@ install:
fi ;
fi
- sudo apt-get install realpath
# `<VERSION` is builtin way to load VERSION file content. No usage of cat needed
- export OF_VERSION=$(<VERSION)


# displays versions of useful tools for visual checks
- npm -version
- sdk version
- javac -version
jobs:
include:
- stage: test-assemble
script:
# displays versions of useful tools for visual checks
- npm -version
- sdk version
- javac -version
- docker-compose -f src/main/docker/test-environment/docker-compose.yml up -d
- export GRADLE_OPTS="-XX:MaxMetaspaceSize=512m -Xmx1024m"
# If SONAR_TOKEN is not available (for external PRs for example), skip sonar
- ./gradlew --build-cache copyDependencies test jacocoTestReport
# [OC-865] Dropping dependency messing with typescript version as a workaround until sonar bug is fixed
# See https://github.com/SonarSource/SonarJS/issues/1928 and https://community.sonarsource.com/t/error-about-unsupported-ts-version-while-project-is-using-supported-version/15776
- rm -r ui/main/node_modules/@compodoc/ngd-core
- rm -r ui/main/node_modules/ts-simple-ast
- if [ "${SONAR_TOKEN}" != "" ]; then
(sonar-scanner) && (echo sonar-scanner was run);
fi
- docker-compose -f src/main/docker/test-environment/docker-compose.yml down
- stage: docker-images
script:
- echo preparing image for version $OF_VERSION
- docker login --username ${DOCKER_CLOUD_USER} --password ${DOCKER_CLOUD_PWD}
- export GRADLE_OPTS="-XX:MaxMetaspaceSize=512m -Xmx1024m"
- "[[ $OF_VERSION =~ .+SNAPSHOT$ ]] && ./gradlew --build-cache copyWorkingDir dockerPushSnapshot -x test || echo not publishing docker snapshot tag"
- "[[ $OF_VERSION =~ .+RELEASE$ ]] && ./gradlew --build-cache copyWorkingDir dockerPushLatest -x test || echo not publishing docker latest tag"
- "[[ $OF_VERSION =~ .+RELEASE$ ]] && ./gradlew --build-cache copyWorkingDir dockerPush${OF_VERSION} -x test || echo not publishing docker ${OF_VERSION} tag"
- docker image ls -a|grep lfeoperatorfabric
- stage: doc
script:
- export GRADLE_OPTS="-XX:MaxMetaspaceSize=512m -Xmx1024m"
- ./gradlew --build-cache generateSwaggerUI asciidoctor
- ./CICD/travis/upload_doc.sh
- stage: test
script:
- docker-compose -f src/main/docker/test-environment/docker-compose.yml up -d
- ./gradlew --build-cache copyDependencies test
- docker-compose -f src/main/docker/test-environment/docker-compose.yml down
- stage: test-sonar
script:
- docker-compose -f src/main/docker/test-environment/docker-compose.yml up -d
- ./gradlew --build-cache copyDependencies test jacocoTestReport
# [OC-865] Dropping dependency messing with typescript version as a workaround until sonar bug is fixed
# See https://github.com/SonarSource/SonarJS/issues/1928 and https://community.sonarsource.com/t/error-about-unsupported-ts-version-while-project-is-using-supported-version/15776
- rm -r ui/main/node_modules/@compodoc/ngd-core
- rm -r ui/main/node_modules/ts-simple-ast
- sonar-scanner
- docker-compose -f src/main/docker/test-environment/docker-compose.yml down
- stage: doc
script:
- ./gradlew --build-cache generateSwaggerUI asciidoctor
- ./CICD/travis/upload_doc.sh
- stage: doc-dry-run
script:
- ./gradlew --build-cache generateSwaggerUI asciidoctor
- stage: docker-push-version
script:
- echo preparing images for version $OF_VERSION
- docker login --username ${DOCKER_CLOUD_USER} --password ${DOCKER_CLOUD_PWD}
- ./gradlew --build-cache copyWorkingDir dockerPush${OF_VERSION} -x test
- docker image ls -a|grep lfeoperatorfabric
- stage: docker-push-latest
script:
- echo preparing images for version $OF_VERSION
- docker login --username ${DOCKER_CLOUD_USER} --password ${DOCKER_CLOUD_PWD}
- ./gradlew --build-cache copyWorkingDir dockerPushLatest -x test
- docker image ls -a|grep lfeoperatorfabric
- stage: docker-tag-version
script:
- echo preparing images for version $OF_VERSION
- ./gradlew --build-cache copyWorkingDir dockerTag${OF_VERSION} -x test
- docker image ls -a|grep lfeoperatorfabric
stages:
- test-assemble
- name: docker-images
if: (type = cron OR commit_message =~ ci_docker) AND (NOT type IN (pull_request)) AND (branch = master)
# Note: The condition on type is necessary to exclude PRs because their base branch is usually develop
- name: test
if: type = pull_request AND head_repo != opfab/operatorfabric-core
- name: test-sonar
if: NOT (type = pull_request AND head_repo != opfab/operatorfabric-core)
- name: doc
if: (type = cron OR commit_message =~ ci_documentation) AND (NOT type IN (pull_request)) AND (branch = master)
# Note: The condition on type is necessary to exclude PRs because their base branch could be master
#script:
# - docker-compose -f src/main/docker/test-environment/docker-compose.yml up -d
# - ./gradlew copyDependencies build jacocoTestReport && sonar-scanner
#deploy:
#- provider: script
# skip_cleanup: true
# script: ./CICD/travis/upload_doc.sh
# on:
# all_branches: true
# # condition: $TRAVIS_EVENT_TYPE = cron # Commented out while in documentation phase to trigger doc upload for all builds
if: ((((type = cron OR commit_message =~ ci_documentation) AND branch = develop) OR branch = master) AND NOT type = pull_request)
- name: doc-dry-run
if: (branch =~ .+release$) OR (NOT (branch IN (master,develop)) AND commit_message =~ ci_documentation)
- name: docker-push-version
if: (((type = cron OR commit_message =~ ci_docker) AND branch = develop) OR branch = master) AND NOT type = pull_request
- name: docker-push-latest
if: branch = master AND commit_message =~ ci_latest AND NOT type = pull_request
- name: docker-tag-version
if: (branch =~ .+release$) OR (NOT (branch IN (master,develop)) AND commit_message =~ ci_docker)
before_cache:
# cleanup gradle caches
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
# - docker image prune -f -a --filter="label=project=org.lfenergy.operatorfabric"
# - >
# mkdir -p $HOME/docker && docker images -a --filter='dangling=false' --format '{{.Repository}}:{{.Tag}} {{.ID}}'
# | xargs -n 2 -t sh -c 'test -e $HOME/docker/$1.tar.gz || docker save $0 | gzip -2 > $HOME/docker/$1.tar.gz'
cache:
bundler: true
directories:
Expand Down
22 changes: 22 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Authors (GitHub usernames) in alphabetical order

We decided against emails and first/last names in order not to make that information easily available to robots.

agigox
AlexGuironnetRTE
bendaoudmba
davidbinderRTE
freddidierRTE
HanaeSafiRTE
jeandemanded
JeroenGommans
JulienBapt
rlg-rte
rte-amal
samichehade
taoufikbermaki
vitorg
vlo-rte
youhou1515


80 changes: 0 additions & 80 deletions CICD/change_snapshot_version.sh

This file was deleted.

29 changes: 18 additions & 11 deletions CICD/prepare_release_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
display_usage() {
echo "This script makes the necessary changes to version controlled files to prepare for a RELEASE version."
echo -e "Usage:\n"
echo -e "\tprepare_release_version.sh\n"
echo -e "\tprepare_release_version.sh [OPTIONS] \n"
echo -e "options:\n"
echo -e "\t-v, --version : string. Version to be released (X.X.X.RELEASE)"
}

# Read parameters
Expand All @@ -12,6 +14,11 @@ do
key="$1"
# echo $key
case $key in
-v|--version)
newVersion="$2"
shift # past argument
shift # past value
;;
-h|--help)
shift # past argument
display_usage
Expand All @@ -24,21 +31,21 @@ display_usage
esac
done

# Get current (SNAPSHOT) version from VERSION file
# Get current version from VERSION file (can be SNAPSHOT or X.X.X.RELEASE in the case of a hotfix)
oldVersion=$(cat VERSION)
echo "Current version is $oldVersion (based on VERSION file)"

# Check that current version is a SNAPSHOT version as expected
if [[ $oldVersion != *.SNAPSHOT ]]; then
echo "Current version is not a SNAPSHOT version, this script shouldn't be used."

# Check that new version is a RELEASE version as expected
if [[ $newVersion != *.RELEASE ]]; then
echo "Specified version is not a RELEASE version, this script shouldn't be used."
exit 1;
fi

# Determine RELEASE version
newVersion=$(cat VERSION | sed 's/SNAPSHOT/RELEASE/' )
echo "Preparing $newVersion"

# Replace SNAPSHOT with RELEASE
# Replace old version with new version

echo "Updating version for pipeline in VERSION file"
sed -i "s/$oldVersion/$newVersion/g" VERSION;

Expand All @@ -49,10 +56,10 @@ find . -name swagger.yaml | xargs sed -i "s/\(version: *\)$oldVersion/\1$newVers
# The issue is that if the value has been mistakenly modified and is not $oldVersion, it won't be updated
# TODO Find a better solution or add a check

echo "Using $newVersion for lfeoperatorfabric images in deploy docker-compose file"
echo "Using $newVersion for lfeoperatorfabric images in dev and docker environment docker-compose files"
# String example for regexp: image: "lfeoperatorfabric/of-web-ui:0.13.1.RELEASE"
sed -i "s/\( *image *: *\"lfeoperatorfabric\/.*:\)\(.*\)\"/\1$newVersion\"/g" ./src/main/docker/deploy/docker-compose.yml;
sed -i "s/\( *image *: *\"lfeoperatorfabric\/.*:\)\(.*\)\"/\1$newVersion\"/g" ./config/docker/docker-compose.yml;
sed -i "s/\( *image *: *\"lfeoperatorfabric\/.*:\)\(.*\)\"/\1$newVersion\"/g" ./config/dev/docker-compose.yml;

echo "The following files have been updated: "
echo | git status --porcelain

Loading

0 comments on commit 7c3b8a4

Please sign in to comment.