Skip to content

Commit

Permalink
Merge branch '3.3.0.release'
Browse files Browse the repository at this point in the history
  • Loading branch information
vlo-rte committed Jan 10, 2022
2 parents 71b1564 + d1675fb commit 2ffae32
Show file tree
Hide file tree
Showing 130 changed files with 2,726 additions and 1,432 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/anchore-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# This workflow checks out code, builds an image, performs a container image
# vulnerability scan with Anchore's Grype tool, and integrates the results with GitHub Advanced Security
# code scanning feature. For more information on the Anchore scan action usage
# and parameters, see https://github.com/anchore/scan-action. For more
# information on Anchore's container image scanning tool Grype, see
# https://github.com/anchore/grype
name: Anchore Container Scan

on:
push:
branches: [ develop]
workflow_dispatch:

jobs:
Anchore-Build-Scan:
runs-on: ubuntu-latest
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Build the Docker image
run: docker pull lfeoperatorfabric/of-cards-consultation-business-service:3.2.0.RELEASE
- name: Run the Anchore scan action itself with GitHub Advanced Security code scanning integration enabled
uses: anchore/scan-action@v3
with:
image: "lfeoperatorfabric/of-cards-consultation-business-service:3.2.0.RELEASE"
acs-report-enable: true
fail-build: false
- name: Upload Anchore Scan Report
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: results.sarif
86 changes: 85 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.inputs.dockerPush != 'true' && github.event.inputs.dockerPushLatest != 'true' && github.event.inputs.doc != 'true' && github.event.inputs.docLatest != 'true' && github.event_name != 'schedule' && github.ref_name != 'master' }}
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -94,7 +95,6 @@ jobs:
if: ${{ github.event.inputs.build == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push'}}
run: |
export OF_VERSION=$(<VERSION)
echo ${{ secrets.DOCKER_TOKEN }} | docker login --username opfabtravis --password-stdin
docker-compose -f src/main/docker/test-environment/docker-compose.yml up -d
./gradlew --build-cache copyDependencies test jacocoTestReport sonarqube dockerTag${OF_VERSION}
docker-compose -f src/main/docker/test-environment/docker-compose.yml down
Expand Down Expand Up @@ -128,6 +128,90 @@ jobs:
cd config/docker
docker-compose down
publish:
runs-on: ubuntu-latest
environment: publishVersion
if: ${{ github.event.inputs.dockerPush == 'true' || github.event.inputs.dockerPushLatest == 'true' || github.event.inputs.doc == 'true' || github.event.inputs.docLatest == 'true' || github.event_name == 'schedule' || github.ref_name == 'master' }}
steps:
- uses: actions/checkout@v2

- name: Job status
run: |
export OF_VERSION=$(<VERSION)
echo "----------------------------"
echo "Trigger by : ${{ github.event_name }}"
echo "On branch : ${{ github.ref_name }} "
echo "PR source branch : ${{ github.head_ref }} "
echo "PR target branch : ${{ github.base_ref }} "
echo "Opfab Version : ${OF_VERSION}"
echo "---------------------------"
- name: Cache Gradle packages
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle.properties','**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle

# Install all required tools
- name: Install
run: |
curl -s "https://get.sdkman.io" | bash ;
echo sdkman_auto_answer=true > $HOME/.sdkman/etc/config ;
echo sdkman_auto_selfupdate=true >> $HOME/.sdkman/etc/config ;
source $HOME/.sdkman/bin/sdkman-init.sh;
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
source ./bin/load_environment_light.sh;
sudo apt-get install jq
echo "npm version $(npm -version)"
echo "node version $(node --version)"
sdk version
javac -version
git config --global user.email "[email protected]"
git config --global user.name "OpfabTech"
- name: Build
if: ${{ github.event.inputs.build == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push'}}
run: |
export OF_VERSION=$(<VERSION)
echo ${{ secrets.DOCKER_TOKEN }} | docker login --username opfabtravis --password-stdin
docker-compose -f src/main/docker/test-environment/docker-compose.yml up -d
./gradlew --build-cache copyDependencies test jacocoTestReport sonarqube dockerTag${OF_VERSION}
docker-compose -f src/main/docker/test-environment/docker-compose.yml down
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SonarCloud access token should be generated from https://sonarcloud.io/account/security/
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

- name: Karate tests
if: ${{ github.event.inputs.karate == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' }}
run: |
cd config/docker
./docker-compose.sh
cd ../../bin
./waitForOpfabToStart.sh
cd ../src/test/api/karate
./launchAll.sh
cd ../../../../config/docker
docker-compose down --remove-orphans
- name: Cypress tests
if: ${{ github.event.inputs.cypress == 'true' || github.event_name == 'schedule' || github.event_name == 'pull_request' || github.event_name == 'push' }}
run: |
cd config/docker
./docker-compose-cypress.sh
cd ../../bin
./waitForOpfabToStart.sh
cd ../
./gradlew runCypressTests
cd config/docker
docker-compose down
- name : Publish Documentation
if : ${{ github.event.inputs.doc == 'true' || github.event_name == 'schedule'}}
run: |
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0.RELEASE
3.3.0.RELEASE
17 changes: 16 additions & 1 deletion bin/run_all.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright (c) 2018-2020, RTE (http://www.rte-france.com)
# Copyright (c) 2018-2021, RTE (http://www.rte-france.com)
# See AUTHORS.txt
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
Expand All @@ -25,6 +25,7 @@ resetConfiguration=true
businessServices=( "users" "cards-consultation" "cards-publication" "businessconfig")
offline=false
waitForOpfabToStart=false
externalDevices=false

function join_by { local IFS="$1"; shift; echo "$*"; }

Expand All @@ -39,6 +40,7 @@ function display_usage() {
echo -e "\t-r, --reset\t: true or false. Resets service data. Defaults to $resetConfiguration."
echo -e "\t-o, --offline\t: true or false. When gradle is invoked, it will be invoked offline. Defaults to $offline.\n"
echo -e "\t-w, --waitForOpfabToStart\t: true or false , if true the script exits only when opfab is up. Defaults to false.\n"
echo -e "\t-e, --externalDevices\t: true or false , if true the external devices service is started as well. Defaults to $externalDevices.\n"
}

while [[ $# -gt 0 ]]
Expand All @@ -65,6 +67,10 @@ case $key in
waitForOpfabToStart=true
shift # past argument
;;
-e|--externalDevices)
externalDevices=true
shift # past argument
;;
-h|--help)
display_usage
exit 0
Expand Down Expand Up @@ -96,6 +102,15 @@ for bservice in "${businessServices[@]}"; do
i=$((i+$PRJ_STRC_FIELDS))
done

if [ "$externalDevices" = true ]; then
dependentProjects[$i]="external-devices-service"
dependentProjects[$i+1]="services/external-devices"
dependentProjects[$i+2]=0
dependentProjects[$i+3]=""
dependentProjects[$i+4]="external-devices"
i=$((i+$PRJ_STRC_FIELDS))
fi

debugPort=5005
version=$OF_VERSION

Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ plugins {
id "io.spring.dependency-management" version "1.0.11.RELEASE" apply false
id 'org.sonarqube' version '3.3'
id "com.github.davidmc24.gradle.plugin.avro" version "1.3.0" apply false
id "com.palantir.docker" version "0.31.0" apply false
id "org.hidetake.swagger.generator" version "2.18.2" apply false
id "com.palantir.docker" version "0.32.0" apply false
id "org.hidetake.swagger.generator" version "2.19.1" apply false
}

ext {
Expand Down
7 changes: 4 additions & 3 deletions config/dev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: '2.1'
services:
rabbitmq:
container_name: rabbit
image: rabbitmq:3-management
ports:
- "5672:5672"
Expand All @@ -26,8 +27,8 @@ services:
- "89:8080"
- "90:9990"
web-ui:
image: "lfeoperatorfabric/of-web-ui:3.2.0.RELEASE"
#user: ${USER_ID}:${USER_GID}
container_name: web-ui
image: "lfeoperatorfabric/of-web-ui:3.3.0.RELEASE"
ports:
- "2002:80"
volumes:
Expand All @@ -36,6 +37,6 @@ services:
- "./nginx.conf:/etc/nginx/conf.d/default.conf"
- "./loggingResults:/etc/nginx/html/logging"
ext-app:
image: "lfeoperatorfabric/of-external-app:3.2.0.RELEASE"
image: "lfeoperatorfabric/of-external-app:3.3.0.RELEASE"
ports:
- "8090:8090"
43 changes: 43 additions & 0 deletions config/dev/external-devices-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
server:
port: 2105
spring:
application:
name: external-devices
operatorfabric:
externaldevices:
watchdog:
enabled: true
default:
deviceConfigurations:
- id: CDS_1
host: localhost
port: 4030
signalMappingId: default_CDS_mapping
- id: CDS_2
host: localhost
port: 4030
signalMappingId: broken_CDS_mapping
signalMappings:
- id: default_CDS_mapping
supportedSignals:
ALARM: 1
ACTION: 2
COMPLIANT: 3
INFORMATION: 4
- id: broken_CDS_mapping
supportedSignals:
ALARM: 5
ACTION: 6
COMPLIANT: 7
INFORMATION: 8
userConfigurations:
- userLogin: operator1
externalDeviceId: CDS_1
- userLogin: operator2
externalDeviceId: CDS_2
- userLogin: operator3
externalDeviceId: CDS_3
logging.level.org.opfab: debug



3 changes: 3 additions & 0 deletions config/dev/stopOpfab.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker-compose down -v
34 changes: 24 additions & 10 deletions config/docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ services:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: password
rabbitmq:
container_name: rabbit
image: rabbitmq:3-management
# Port closed for security reasons , be careful if you open it
hostname: rabbit

# If you want to persist queue after rabbit docker container removal mount
# a volume to store persistance data
# WARNING : On Kubernetes , as pod are destroy , it is
# necessary to persist queue . Otherwise in case of restart of
# the rabbit pod, the connection with cards-consultation will be lost
#
# volumes:
# - "./rabbit-persistance:/var/lib/rabbitmq/mnesia/"


# Port closed for security reasons , be careful if you open it
# ports:
# - "5672:5672"
# - "15672:15672"
Expand All @@ -28,7 +41,7 @@ services:
# - "90:9990"
users:
container_name: users
image: "lfeoperatorfabric/of-users-business-service:3.2.0.RELEASE"
image: "lfeoperatorfabric/of-users-business-service:3.3.0.RELEASE"
depends_on:
- mongodb
- rabbitmq
Expand All @@ -46,7 +59,7 @@ services:
- ${CONFIG_PATH}:/external-config
businessconfig:
container_name: businessconfig
image: "lfeoperatorfabric/of-businessconfig-business-service:3.2.0.RELEASE"
image: "lfeoperatorfabric/of-businessconfig-business-service:3.3.0.RELEASE"
depends_on:
- mongodb
user: ${USER_ID}:${USER_GID}
Expand All @@ -64,7 +77,7 @@ services:
- ${CONFIG_PATH}:/external-config
cards-publication:
container_name: cards-publication
image: "lfeoperatorfabric/of-cards-publication-business-service:3.2.0.RELEASE"
image: "lfeoperatorfabric/of-cards-publication-business-service:3.3.0.RELEASE"
depends_on:
- mongodb
- rabbitmq
Expand All @@ -82,7 +95,7 @@ services:
- ${CONFIG_PATH}:/external-config
cards-consultation:
container_name: cards-consultation
image: "lfeoperatorfabric/of-cards-consultation-business-service:3.2.0.RELEASE"
image: "lfeoperatorfabric/of-cards-consultation-business-service:3.3.0.RELEASE"
depends_on:
- mongodb
- rabbitmq
Expand All @@ -99,7 +112,8 @@ services:
- "./cards-consultation-docker.yml:/config/application-docker.yml"
- ${CONFIG_PATH}:/external-config
web-ui:
image: "lfeoperatorfabric/of-web-ui:3.2.0.RELEASE"
container_name: web-ui
image: "lfeoperatorfabric/of-web-ui:3.3.0.RELEASE"
ports:
- "2002:80"
depends_on:
Expand All @@ -113,7 +127,7 @@ services:
# - "./custom-sounds:/usr/share/nginx/html/assets/sounds"
external-devices:
container_name: external-devices
image: "lfeoperatorfabric/of-external-devices-service:3.2.0.RELEASE"
image: "lfeoperatorfabric/of-external-devices-service:3.3.0.RELEASE"
depends_on:
- mongodb
- users
Expand All @@ -134,13 +148,13 @@ services:
# External application example
ext-app:

image: "lfeoperatorfabric/of-external-app:3.2.0.RELEASE"
image: "lfeoperatorfabric/of-external-app:3.3.0.RELEASE"
ports:
- "8090:8090"
# Dummy external devices using Modbus Protocol
dummy-modbus-device_1:
container_name: dummy-modbus-device_1
image: "lfeoperatorfabric/of-dummy-modbus-device:3.2.0.RELEASE"
image: "lfeoperatorfabric/of-dummy-modbus-device:3.3.0.RELEASE"
user: ${USER_ID}:${USER_GID}
ports:
- "4031:4030"
Expand All @@ -153,7 +167,7 @@ services:
- ${CONFIG_PATH}:/external-config
dummy-modbus-device_2:
container_name: dummy-modbus-device_2
image: "lfeoperatorfabric/of-dummy-modbus-device:3.2.0.RELEASE"
image: "lfeoperatorfabric/of-dummy-modbus-device:3.3.0.RELEASE"
user: ${USER_ID}:${USER_GID}
ports:
- "4032:4030"
Expand Down
3 changes: 3 additions & 0 deletions config/docker/stopOpfab.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

docker-compose down -v
Loading

0 comments on commit 2ffae32

Please sign in to comment.