diff options
36 files changed, 1228 insertions, 264 deletions
diff --git a/compose/config/clamp/legacy/AcRuntimeParameters.yaml b/compose/config/clamp/legacy/AcRuntimeParameters.yaml new file mode 100644 index 00000000..656b3f9f --- /dev/null +++ b/compose/config/clamp/legacy/AcRuntimeParameters.yaml @@ -0,0 +1,74 @@ +spring: + security: + user: + name: runtimeUser + password: zb!XztG34 + mvc: + converters: + preferred-json-mapper: gson + datasource: + url: jdbc:mariadb://${mariadb.host:mariadb}:${mariadb.port:3306}/clampacm + driverClassName: org.mariadb.jdbc.Driver + username: policy_user + password: policy_user + hikari: + connectionTimeout: 30000 + idleTimeout: 600000 + maxLifetime: 1800000 + maximumPoolSize: 10 + jpa: + hibernate: + ddl-auto: none + naming: + physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl + implicit-strategy: org.onap.policy.common.spring.utils.CustomImplicitNamingStrategy + properties: + hibernate: + format_sql: true + +security: + enable-csrf: false + +server: + servlet: + context-path: /onap/policy/clamp/acm + port: 6969 + ssl: + enabled: false + error: + path: /error + +runtime: + participantParameters: + heartBeatMs: 20000 + maxStatusWaitMs: 200000 + topicParameterGroup: + topicSources: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + acmParameters: + toscaElementName: org.onap.policy.clamp.acm.AutomationCompositionElement + toscaCompositionName: org.onap.policy.clamp.acm.AutomationComposition + +management: + endpoints: + web: + base-path: / + exposure: + include: health, metrics, prometheus + +metrics: + security: + disabled: false diff --git a/compose/config/clamp/legacy/HttpParticipantParameters.yaml b/compose/config/clamp/legacy/HttpParticipantParameters.yaml new file mode 100644 index 00000000..a26a81d0 --- /dev/null +++ b/compose/config/clamp/legacy/HttpParticipantParameters.yaml @@ -0,0 +1,45 @@ +spring: + security: + user: + name: participantUser + password: zb!XztG34 + autoconfigure: + exclude: > + org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, + org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, + org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration +security: + enable-csrf: false +participant: + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01 + clampAutomationCompositionTopics: + topicSources: + - topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + participantSupportedElementTypes: + - typeName: org.onap.policy.clamp.acm.HttpAutomationCompositionElement + typeVersion: 1.0.0 +management: + endpoints: + web: + exposure: + include: health, metrics, prometheus +server: + port: 6969 + ssl: + enabled: false + servlet: + context-path: /onap/policy/clamp/acm/httpparticipant diff --git a/compose/config/clamp/legacy/KubernetesParticipantParameters.yaml b/compose/config/clamp/legacy/KubernetesParticipantParameters.yaml new file mode 100644 index 00000000..449e9617 --- /dev/null +++ b/compose/config/clamp/legacy/KubernetesParticipantParameters.yaml @@ -0,0 +1,66 @@ +spring: + security: + user: + name: participantUser + password: zb!XztG34 + autoconfigure: + exclude: > + org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, + org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, + org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration +security: + enable-csrf: false + +participant: + localChartDirectory: /home/policy/local-charts + infoFileName: CHART_INFO.json + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: 101c62b3-8918-41b9-a747-d21eb79c6c02 + clampAutomationCompositionTopics: + topicSources: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + participantSupportedElementTypes: + - typeName: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement + typeVersion: 1.0.0 + +management: + endpoints: + web: + exposure: + include: health, metrics, prometheus +server: + port: 6969 + ssl: + enabled: false + servlet: + context-path: /onap/policy/clamp/acm/k8sparticipant + +logging: + # Configuration of logging + level: + ROOT: ERROR + org.springframework: ERROR + org.springframework.data: ERROR + org.springframework.web.reactive.function.client.ExchangeFunctions: ERROR + org.onap.policy.clamp.acm.participant.kubernetes: INFO + file: + name: /var/log/onap/policy/clamp/application.log + +chart: + api: + enabled: false diff --git a/compose/config/clamp/legacy/PolicyParticipantParameters.yaml b/compose/config/clamp/legacy/PolicyParticipantParameters.yaml new file mode 100644 index 00000000..307e0b60 --- /dev/null +++ b/compose/config/clamp/legacy/PolicyParticipantParameters.yaml @@ -0,0 +1,63 @@ +spring: + security: + user: + name: participantUser + password: zb!XztG34 + autoconfigure: + exclude: > + org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration, + org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration, + org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration +participant: + pdpGroup: defaultGroup + pdpType: apex + policyApiParameters: + clientName: api + hostname: policy-api + port: 6969 + userName: policyadmin + password: zb!XztG34 + useHttps: false + allowSelfSignedCerts: true + policyPapParameters: + clientName: pap + hostname: policy-pap + port: 6969 + userName: policyadmin + password: zb!XztG34 + useHttps: false + allowSelfSignedCerts: true + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: 101c62b3-8918-41b9-a747-d21eb79c6c03 + clampAutomationCompositionTopics: + topicSources: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + participantSupportedElementTypes: + - typeName: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement + typeVersion: 1.0.0 +management: + endpoints: + web: + exposure: + include: health, metrics, prometheus +server: + port: 6969 + ssl: + enabled: false + servlet: + context-path: /onap/policy/clamp/acm/policyparticipant diff --git a/compose/config/clamp/legacy/SimulatorParticipantParameters.yaml b/compose/config/clamp/legacy/SimulatorParticipantParameters.yaml new file mode 100644 index 00000000..acc1db66 --- /dev/null +++ b/compose/config/clamp/legacy/SimulatorParticipantParameters.yaml @@ -0,0 +1,50 @@ +spring: + security: + user: + name: participantUser + password: zb!XztG34 + autoconfigure: + exclude: + - org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration + - org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration + - org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration + - org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration + +security: + enable-csrf: false +participant: + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: ${participantId:101c62b3-8918-41b9-a747-d21eb79c6c90} + clampAutomationCompositionTopics: + topicSources: + - topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + useHttps: false + topicSinks: + - topic: policy-acruntime-participant + servers: + - ${topicServer:kafka:9092} + topicCommInfrastructure: kafka + useHttps: false + participantSupportedElementTypes: + - + typeName: ${supportedElementTypeName:org.onap.policy.clamp.acm.SimAutomationCompositionElement} + typeVersion: ${supportedElementTypeVersion:1.0.0} + +management: + endpoints: + web: + base-path: / + exposure: + include: health, metrics, prometheus +server: + port: 6969 + ssl: + enabled: false + servlet: + context-path: /onap/policy/simparticipant diff --git a/compose/docker-compose.gui.yml b/compose/docker-compose.gui.yml deleted file mode 100644 index e2e98b54..00000000 --- a/compose/docker-compose.gui.yml +++ /dev/null @@ -1,63 +0,0 @@ -# -# ===========LICENSE_START==================================================== -# Copyright 2023-2024 Nordix Foundation. -# ============================================================================ -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ============LICENSE_END===================================================== -# - -services: - policy-gui: - image: ${CONTAINER_LOCATION}onap/policy-gui:latest - container_name: policy-gui - depends_on: - - policy-clamp-backend - hostname: policy-gui - environment: - CLAMP_URL: http://policy-clamp-backend:8445 - CLAMP_DISABLE_SSL_VALIDATION: "true" - ports: - - "2445:2445" - volumes: - - ./config/policy-gui/application.yaml:/opt/app/policy/gui/etc/application.yml - - ./config/policy-gui/logback.xml:/opt/app/policy/gui/etc/logback.xml:ro - - ./wait_for_port.sh:/opt/app/policy/gui/bin/wait_for_port.sh:ro - entrypoint: ./policy-gui.sh - working_dir: /opt/app/policy/gui/bin - command: ./policy-gui.sh - policy-clamp-backend: - image: ${CONTAINER_LOCATION}onap/policy-clamp-backend:latest - container_name: policy-clamp-backend - depends_on: - - policy-clamp-runtime-acm - - distribution - hostname: policy-clamp-backend - environment: - POLICY_API_HOST: api - POLICY_PAP_HOST: pap - MARIADB_HOST: mariadb - RUNTIME_HOST: policy-clamp-runtime-acm - ports: - - "8445:8445" - volumes: - - ./config/clamp/ClampBackend.properties:/opt/policy/clamp/config/ClampBackend.properties:ro - - ./config/clamp/logback-backend.xml:/opt/policy/clamp/config/logback.xml:ro - working_dir: /opt/policy/clamp - command: java - -Djava.security.egd=file:/dev/./urandom - -XX:MinRAMPercentage=50 - -XX:MaxRAMPercentage=75 - -jar ./policy-clamp-backend.jar - --spring.config.name=ClampBackend - --spring.config.location=/opt/policy/clamp/config/ClampBackend.properties -
\ No newline at end of file diff --git a/compose/docker-compose.postgres.yml b/compose/docker-compose.postgres.yml index fee55d97..ca96f562 100644 --- a/compose/docker-compose.postgres.yml +++ b/compose/docker-compose.postgres.yml @@ -104,7 +104,7 @@ services: - ${PAP_PORT}:6969 volumes: - ./config/pap/papParametersPostgres.yaml:/opt/app/policy/pap/etc/papParameters.yaml:ro - - ./config/${PROJECT}/groups.json:/opt/app/policy/pap/etc/mounted/groups.json:ro + - ./config/${component}/groups.json:/opt/app/policy/pap/etc/mounted/groups.json:ro - ./config/pap/logback.xml:/opt/app/policy/pap/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/pap/bin/wait_for_port.sh:ro entrypoint: ./wait_for_port.sh @@ -137,6 +137,28 @@ services: 'kafka', '9092', 'pap', '6969' ] + xacml-pdp: + image: ${CONTAINER_LOCATION}onap/policy-xacml-pdp:${POLICY_XACML_PDP_VERSION} + container_name: policy-xacml-pdp + hostname: policy-xacml-pdp + depends_on: + - postgres + - kafka + - pap + ports: + - ${XACML_PORT}:6969 + - "30999:3904" + volumes: + - ./config/xacml-pdp/defaultConfig.json:/opt/app/policy/pdpx/etc/defaultConfig.json:ro + - ./config/xacml-pdp/logback.xml:/opt/app/policy/pdpx/etc/logback.xml:ro + - ./wait_for_port.sh:/opt/app/policy/pdpx/bin/wait_for_port.sh:ro + entrypoint: ./wait_for_port.sh + command: [ + '-c', './policy-pdpx-pg.sh', + 'postgres', '5432', + 'kafka', '9092', + 'pap', '6969' + ] prometheus: image: nexus3.onap.org:10001/prom/prometheus:latest container_name: prometheus @@ -148,6 +170,7 @@ services: zookeeper: image: confluentinc/cp-zookeeper:latest + container_name: zookeeper environment: ZOOKEEPER_CLIENT_PORT: 2181 ZOOKEEPER_TICK_TIME: 2000 diff --git a/compose/docker-compose.yml b/compose/docker-compose.yml index 49c63779..b44da88f 100644 --- a/compose/docker-compose.yml +++ b/compose/docker-compose.yml @@ -282,7 +282,7 @@ services: #OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: grpc #OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4317 volumes: - - ./config/clamp/AcRuntimeParameters.yaml:/opt/app/policy/clamp/etc/AcRuntimeParameters.yaml + - ./${CLAMP_CONFIG_PATH:-config/clamp}/AcRuntimeParameters.yaml:/opt/app/policy/clamp/etc/AcRuntimeParameters.yaml - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./config/clamp/acm-runtime.sh:/opt/app/policy/clamp/bin/acm-runtime.sh:rw - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -312,7 +312,7 @@ services: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 volumes: - - ./config/clamp/HttpParticipantParameters.yaml:/opt/app/policy/clamp/etc/HttpParticipantParameters.yaml + - ./${PPNT_CONFIG_PATH:-config/clamp}/HttpParticipantParameters.yaml:/opt/app/policy/clamp/etc/HttpParticipantParameters.yaml - ./config/clamp/http-participant.sh:/opt/app/policy/clamp/bin/http-participant.sh:rw - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -336,7 +336,7 @@ services: ports: - "30295:6969" volumes: - - ./config/clamp/KubernetesParticipantParameters.yaml:/opt/app/policy/clamp/etc/KubernetesParticipantParameters.yaml + - ./${PPNT_CONFIG_PATH:-config/clamp}/KubernetesParticipantParameters.yaml:/opt/app/policy/clamp/etc/KubernetesParticipantParameters.yaml - ./config/clamp/kubernetes-participant.sh:/opt/app/policy/clamp/bin/kubernetes-participant.sh:rw - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -361,7 +361,7 @@ services: OTEL_EXPORTER_OTLP_TRACES_PROTOCOL: http/protobuf OTEL_EXPORTER_OTLP_ENDPOINT: http://jaeger:4318 volumes: - - ./config/clamp/PolicyParticipantParameters.yaml:/opt/app/policy/clamp/etc/PolicyParticipantParameters.yaml:ro + - ./${PPNT_CONFIG_PATH:-config/clamp}/PolicyParticipantParameters.yaml:/opt/app/policy/clamp/etc/PolicyParticipantParameters.yaml:ro - ./config/clamp/policy-participant.sh:/opt/app/policy/clamp/bin/policy-participant.sh:rw - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -420,7 +420,7 @@ services: 'kafka', '9092' ] policy-clamp-ac-sim-ppnt: - image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-sim-ppnt:${POLICY_CLAMP_VERSION} + image: ${CONTAINER_LOCATION}onap/policy-clamp-ac-sim-ppnt:${POLICY_CLAMP_PPNT_VERSION} container_name: policy-clamp-ac-sim-ppnt hostname: policy-clamp-ac-sim-ppnt depends_on: @@ -434,7 +434,7 @@ services: ports: - ${SIM_PARTICIPANT_PORT}:6969 volumes: - - ./config/clamp/SimulatorParticipantParameters.yaml:/opt/app/policy/clamp/etc/SimulatorParticipantParameters.yaml:ro + - ./${PPNT_CONFIG_PATH:-config/clamp}/SimulatorParticipantParameters.yaml:/opt/app/policy/clamp/etc/SimulatorParticipantParameters.yaml:ro - ./config/clamp/sim-participant.sh:/opt/app/policy/clamp/bin/sim-participant.sh:rw - ./config/clamp/logback.xml:/opt/app/policy/clamp/etc/logback.xml:ro - ./wait_for_port.sh:/opt/app/policy/bin/wait_for_port.sh:ro @@ -509,3 +509,4 @@ services: - 16686:16686 environment: - COLLECTOR_OTLP_ENABLED=true + diff --git a/compose/export-ports.sh b/compose/export-ports.sh index a3422daa..aa97f493 100755 --- a/compose/export-ports.sh +++ b/compose/export-ports.sh @@ -25,6 +25,7 @@ then head -1 | sed 's/onap\/policy-api.*$//' ) + export LOCAL_IMAGES="true" else export CONTAINER_LOCATION="nexus3.onap.org:10001/" fi diff --git a/compose/get-versions.sh b/compose/get-versions.sh index 13dc3653..a51ccef9 100755 --- a/compose/get-versions.sh +++ b/compose/get-versions.sh @@ -25,115 +25,129 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE fi -GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ - "${WORKSPACE}"/.gitreview) - -echo GERRIT_BRANCH="${GERRIT_BRANCH}" - +#default values export POLICY_MARIADB_VER=10.10.2 echo POLICY_MARIADB_VER=${POLICY_MARIADB_VER} export POLICY_POSTGRES_VER=11.1 echo POLICY_POSTGRES_VER=${POLICY_POSTGRES_VER} -function getDockerVersion -{ - REPO=${1} - DEFAULT_DOCKER_IMAGE_NAME=${2:-} - DEFAULT_DOCKER_IMAGE_VERSION=${3:-} - - REPO_RELEASE_DATA=$( - curl -qL --silent \ - "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" | - grep "^policy/$REPO" - ) - - # shellcheck disable=SC2034 - read -r repo \ - latest_released_tag \ - latest_snapshot_tag \ - changed_files \ - docker_images \ - <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )" - - if [[ -z "$docker_images" ]] - then - if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]] +if [ -n "$LOCAL_IMAGES" ] && [ "$LOCAL_IMAGES" = "true" ]; then + echo "Running with local images." + export POLICY_DOCKER_VERSION="latest" + export POLICY_MODELS_VERSION="latest" + export POLICY_API_VERSION="latest" + export POLICY_PAP_VERSION="latest" + export POLICY_APEX_PDP_VERSION="latest" + export POLICY_DROOLS_PDP_VERSION="latest" + export POLICY_XACML_PDP_VERSION="latest" + export POLICY_DISTRIBUTION_VERSION="latest" + export POLICY_CLAMP_VERSION="latest" + export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION + export POLICY_DROOLS_APPS_VERSION="latest" + +else + GERRIT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ + "${WORKSPACE}"/.gitreview) + + echo GERRIT_BRANCH="${GERRIT_BRANCH}" + + function getDockerVersion + { + REPO=${1} + DEFAULT_DOCKER_IMAGE_NAME=${2:-} + DEFAULT_DOCKER_IMAGE_VERSION=${3:-} + + REPO_RELEASE_DATA=$( + curl -qL --silent \ + "https://github.com/onap/policy-parent/raw/$GERRIT_BRANCH/integration/src/main/resources/release/pf_release_data.csv" | + grep "^policy/$REPO" + ) + + # shellcheck disable=SC2034 + read -r repo \ + latest_released_tag \ + latest_snapshot_tag \ + changed_files \ + docker_images \ + <<< "$(echo "$REPO_RELEASE_DATA" | tr ',' ' ' )" + + if [[ -z "$docker_images" ]] then - echo "repo $REPO does not produce a docker image, execution terminated" - exit 1 + if [[ -z "$DEFAULT_DOCKER_IMAGE_NAME" ]] + then + echo "repo $REPO does not produce a docker image, execution terminated" + exit 1 + else + docker_images="$DEFAULT_DOCKER_IMAGE_NAME" + fi + fi + + # docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}') + docker_image_version=$latest_snapshot_tag + docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//") + + if \ + curl -qL --silent \ + "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" | + grep -q "$docker_image_version" + then + echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" + return + fi + + docker_image_version="$latest_released_tag" + if \ + curl -qL --silent \ + "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | + grep -q "$docker_image_version" + then + echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" + return + fi + + docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION" + if \ + curl -qL --silent \ + "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | + grep -q "$docker_image_version" + then + echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" + return else - docker_images="$DEFAULT_DOCKER_IMAGE_NAME" + echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\"" + exit 1 fi - fi - - # docker_image_version=$(echo "$latest_snapshot_tag" | awk -F \. '{print $1"."$2"-SNAPSHOT-latest"}') - docker_image_version=$latest_snapshot_tag - docker_image_name=$(echo "$docker_images" | sed -e "s/^.*://" -e "s/^.//" -e "s/.$//") - - if \ - curl -qL --silent \ - "https://nexus3.onap.org/service/rest/repository/browse/docker.snapshot/v2/onap/$docker_image_name/tags/" | - grep -q "$docker_image_version" - then - echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" - return - fi - - docker_image_version="$latest_released_tag" - if \ - curl -qL --silent \ - "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | - grep -q "$docker_image_version" - then - echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" - return - fi - - docker_image_version="$DEFAULT_DOCKER_IMAGE_VERSION" - if \ - curl -qL --silent \ - "https://nexus3.onap.org/service/rest/repository/browse/docker.release/v2/onap/$docker_image_name/tags/" | - grep -q "$docker_image_version" - then - echo "using \"$docker_image_name:$docker_image_version\" docker image for repo \"$repo\"" - return - else - echo "docker image \"$docker_image_name:$docker_image_version\" not found for repo \"$repo\"" - exit 1 - fi -} - -getDockerVersion docker -export POLICY_DOCKER_VERSION="$docker_image_version" - -getDockerVersion models "'policy-models-simulator'" 3.0.1 -export POLICY_MODELS_VERSION="$docker_image_version" - -getDockerVersion api -export POLICY_API_VERSION="$docker_image_version" - -getDockerVersion pap -export POLICY_PAP_VERSION="$docker_image_version" - -getDockerVersion apex-pdp -export POLICY_APEX_PDP_VERSION="$docker_image_version" - -getDockerVersion drools-pdp -export POLICY_DROOLS_PDP_VERSION="$docker_image_version" - -getDockerVersion xacml-pdp -export POLICY_XACML_PDP_VERSION="$docker_image_version" - -getDockerVersion distribution -export POLICY_DISTRIBUTION_VERSION="$docker_image_version" - -getDockerVersion clamp -export POLICY_CLAMP_VERSION="$docker_image_version" -export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION - -getDockerVersion gui -export POLICY_GUI_VERSION="$docker_image_version" - -getDockerVersion drools-applications -export POLICY_DROOLS_APPS_VERSION="$docker_image_version" + } + + getDockerVersion docker + export POLICY_DOCKER_VERSION="$docker_image_version" + + getDockerVersion models "'policy-models-simulator'" 3.0.1 + export POLICY_MODELS_VERSION="$docker_image_version" + + getDockerVersion api + export POLICY_API_VERSION="$docker_image_version" + + getDockerVersion pap + export POLICY_PAP_VERSION="$docker_image_version" + + getDockerVersion apex-pdp + export POLICY_APEX_PDP_VERSION="$docker_image_version" + + getDockerVersion drools-pdp + export POLICY_DROOLS_PDP_VERSION="$docker_image_version" + + getDockerVersion xacml-pdp + export POLICY_XACML_PDP_VERSION="$docker_image_version" + + getDockerVersion distribution + export POLICY_DISTRIBUTION_VERSION="$docker_image_version" + + getDockerVersion clamp + export POLICY_CLAMP_VERSION="$docker_image_version" + export POLICY_CLAMP_PPNT_VERSION=$POLICY_CLAMP_VERSION + + getDockerVersion drools-applications + export POLICY_DROOLS_APPS_VERSION="$docker_image_version" +fi
\ No newline at end of file diff --git a/compose/start-compose.sh b/compose/start-compose.sh index a6ada298..671927ba 100755 --- a/compose/start-compose.sh +++ b/compose/start-compose.sh @@ -32,7 +32,6 @@ COMPOSE_FOLDER="${WORKSPACE}"/compose # Set default values for the options grafana=false -gui=false # Parse the command-line arguments while [[ $# -gt 0 ]] @@ -44,11 +43,6 @@ do grafana=true shift ;; - --gui) - gui=true - shift 2 - break; - ;; *) component="$1" shift @@ -84,24 +78,14 @@ if [ -n "$component" ]; then docker compose up -d "${component}" grafana echo "Prometheus server: http://localhost:${PROMETHEUS_PORT}" echo "Grafana server: http://localhost:${GRAFANA_PORT}" - elif [ "$gui" = true ]; then - echo "Starting application with gui..." - docker compose -f docker-compose.yml -f docker-compose.gui.yml up -d "${component}" policy-gui - echo "Clamp GUI: https://localhost:2445/clamp" else echo "Starting ${component} application" docker compose up -d "${component}" fi else export PROJECT=api # api has groups.json complete with all 3 pdps - if [ "$gui" = true ]; then - echo "Starting application with gui..." - docker compose -f docker-compose.yml -f docker-compose.gui.yml up -d - echo "Clamp GUI: https://localhost:2445/clamp" - else - echo "Starting all components..." - docker compose up -d - fi + echo "Starting all components..." + docker compose up -d fi cd ${WORKSPACE} diff --git a/compose/start-postgres-tests.sh b/compose/start-postgres-tests.sh index 1c08600a..2d695911 100644 --- a/compose/start-postgres-tests.sh +++ b/compose/start-postgres-tests.sh @@ -1,7 +1,7 @@ #!/bin/bash # # ============LICENSE_START==================================================== -# Copyright (C) 2023 Nordix Foundation. +# Copyright (C) 2023-2024 Nordix Foundation. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -30,7 +30,8 @@ echo "Configuring docker compose..." source export-ports.sh > /dev/null 2>&1 source get-versions.sh > /dev/null 2>&1 -export REPLICAS=${1} -docker-compose -f docker-compose.postgres.yml up -d apex-pdp prometheus +export component=${1} +export REPLICAS=${2} +docker-compose -f docker-compose.postgres.yml up -d ${component} prometheus cd ${WORKSPACE}
\ No newline at end of file diff --git a/csit/run-acm-regression.sh b/csit/run-acm-regression.sh index 5f77d214..677c2630 100755 --- a/csit/run-acm-regression.sh +++ b/csit/run-acm-regression.sh @@ -16,23 +16,50 @@ # # Script to run the ACM regression test suite in cucumber. -# Deploys ACM-R and participants in two different release versions for testing backward compatibility. - -if [ $# -eq 0 ] -then - echo "No release versions provided. Testing ACM-R and participants with the default version" - echo "Usage: $0 <acm_release> <compatibility_test_release>" - ACM_RELEASE=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ - "${WORKSPACE}"/.gitreview) - PPNT_RELEASE=$ACM_RELEASE -fi - -if [ $1 ]; then - ACM_RELEASE=$1 -fi - -if [ $2 ]; then - PPNT_RELEASE=$2 +# Deploys ACM-R and participants in two different release branch/versions for testing backward compatibility. + +function usage() { + echo "Usage: $0 --release <acmr-release_branch> <ppnt-release_branch> | --version <acmr-version> <ppnt-version>" + exit 1 +} + +# Legacy config files for releases up to 'newdelhi' +function release_config_path() { + if [ $1 == 'master' ] || [[ "$(echo "$1" | cut -c1 )" > 'n' ]]; then + echo "config/clamp" + else + echo "config/clamp/legacy" + fi +} + +# Legacy config files for versions before 8.0.0 +function version_config_path() { + if [[ "$(printf '%s\n' "$1" "8.0.0" | sort -V | head -n 1)" == "8.0.0" ]]; then + echo "config/clamp" + else + echo "config/clamp/legacy" + fi +} + +function validate_version() { + local version=$1 + if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Invalid version format: $version. Expected format: x.y.z where x, y, and z are numbers." + usage + fi +} + +function validate_release() { + local release=$1 + if [[ ! $release =~ ^[a-zA-Z._-]+$ ]]; then + echo "Invalid release format: $release. Expected a string release name" + usage + fi +} + +# Invalid input +if [ "$#" -ne 0 ] && [ "$#" -ne 3 ]; then + usage fi if [ -z "${WORKSPACE}" ]; then @@ -40,24 +67,68 @@ if [ -z "${WORKSPACE}" ]; then export WORKSPACE fi +if [ -z "$ROBOT_LOG_DIR" ]; then + export ROBOT_LOG_DIR=/tmp/ +fi export SCRIPTS="${WORKSPACE}/csit/resources/scripts" - COMPOSE_FOLDER="${WORKSPACE}"/compose REGRESSION_FOLDER="${WORKSPACE}"/policy-regression-tests/policy-clamp-regression/ export PROJECT='clamp' +DEFAULT_BRANCH=$(awk -F= '$1 == "defaultbranch" { print $2 }' \ + "${WORKSPACE}"/.gitreview) -# Sign in to nexus3 docker repo -docker login -u docker -p docker nexus3.onap.org:10001 +# Run from default branch +if [ $# -eq 0 ] +then + echo "Usage: $0 --release <acmr-release_branch> <ppnt-release_branch> | --version <acmr-version> <ppnt-version>" + echo "*** No release_branch/versions provided. Default branch will be used." + echo "Fetching image versions for all components..." + source ${COMPOSE_FOLDER}/get-versions-regression.sh $DEFAULT_BRANCH $DEFAULT_BRANCH > /dev/null 2>&1 + echo "Starting Regression with ACM-R and PPNT from the default release branch $DEFAULT_BRANCH ***" + export CLAMP_CONFIG_PATH=$(release_config_path "$DEFAULT_BRANCH") + export PPNT_CONFIG_PATH="$CLAMP_CONFIG_PATH" + echo "Using configuration file located at $CLAMP_CONFIG_PATH for ACM-R and $PPNT_CONFIG_PATH for PPNTS." + +# Run with specific release/version +elif [ "$#" -gt 0 ] +then + case $1 in + --release) + validate_release $2 + validate_release $3 + echo "Fetching image versions for all components..." + source ${COMPOSE_FOLDER}/get-versions-regression.sh $2 $3 > /dev/null 2>&1 + echo "*** Starting Regression with ACM-R from branch $2 and PPNT from branch $3 ***" + export CLAMP_CONFIG_PATH=$(release_config_path $2) + export PPNT_CONFIG_PATH=$(release_config_path $3) + echo "Using configuration file located at $CLAMP_CONFIG_PATH for ACM-R and $PPNT_CONFIG_PATH for PPNTS." + ;; + --version) + validate_version $2 + validate_version $3 + echo "Fetching image versions for all components..." + source ${COMPOSE_FOLDER}/get-versions-regression.sh $DEFAULT_BRANCH $DEFAULT_BRANCH > /dev/null 2>&1 + export POLICY_CLAMP_VERSION=$2 + export POLICY_CLAMP_PPNT_VERSION=$3 + echo "*** Starting Regression with ACM-R version $2 and PPNT version $3 ***" + export CLAMP_CONFIG_PATH=$(version_config_path "$2") + export PPNT_CONFIG_PATH=$(version_config_path "$3") + echo "Using configuration file located at $CLAMP_CONFIG_PATH for ACM-R and $PPNT_CONFIG_PATH for PPNTS." + ;; + *) + echo "Unknown parameter: $1" + usage + ;; + esac +fi +echo "*** Configure docker compose and trigger deployment***" cd ${COMPOSE_FOLDER} - -echo "Configuring docker compose..." - +docker login -u docker -p docker nexus3.onap.org:10001 > /dev/null 2>&1 source export-ports.sh > /dev/null 2>&1 -source get-versions-regression.sh $ACM_RELEASE $PPNT_RELEASE > /dev/null 2>&1 -docker-compose -f docker-compose.yml up -d "policy-clamp-runtime-acm" +docker compose -f docker-compose.yml up -d "policy-clamp-runtime-acm" # wait for the app to start up "${SCRIPTS}"/wait_for_rest.sh localhost "${ACM_PORT}" @@ -65,4 +136,5 @@ docker-compose -f docker-compose.yml up -d "policy-clamp-runtime-acm" cd ${REGRESSION_FOLDER} # Invoke the regression test cases -mvn clean test -Dtests.skip=false
\ No newline at end of file +mvn clean test -Dtests.skip=false + diff --git a/csit/run-k8s-csit.sh b/csit/run-k8s-csit.sh index 4e25356c..6502c348 100755 --- a/csit/run-k8s-csit.sh +++ b/csit/run-k8s-csit.sh @@ -69,7 +69,7 @@ function spin_microk8s_cluster() { if [ "$exitcode" -ne 0 ]; then echo "Microk8s cluster not available, Spinning up the cluster.." - sudo snap install microk8s --classic --channel=1.26/stable + sudo snap install microk8s --classic --channel=1.30/stable if [ "${?}" -ne 0 ]; then echo "Failed to install kubernetes cluster. Aborting.." @@ -77,8 +77,8 @@ function spin_microk8s_cluster() { fi echo "Microk8s cluster installed successfully" sudo usermod -a -G microk8s $USER - echo "Enabling DNS and helm3 plugins" - sudo microk8s.enable dns helm3 hostpath-storage + echo "Enabling DNS and Storage plugins" + sudo microk8s.enable dns hostpath-storage echo "Creating configuration file for Microk8s" sudo mkdir -p $HOME/.kube sudo chown -R $USER:$USER $HOME/.kube @@ -96,8 +96,8 @@ function spin_microk8s_cluster() { exitcode="${?}" if [ "$exitcode" -ne 0 ]; then - echo "Kubectl not available, Spinning up the cluster.." - sudo snap install kubectl --classic --channel=1.26/stable + echo "Kubectl not available, Installing.." + sudo snap install kubectl --classic --channel=1.30/stable if [ "${?}" -ne 0 ]; then echo "Failed to install Kubectl. Aborting.." @@ -110,6 +110,26 @@ function spin_microk8s_cluster() { echo "----------------------------------------" return 0 fi + + echo "Verify if helm is running.." + helm version + exitcode="${?}" + + if [ "$exitcode" -ne 0 ]; then + echo "Helm not available, Installing.." + sudo snap install helm --classic --channel=3.7 + + if [ "${?}" -ne 0 ]; then + echo "Failed to install Helm client. Aborting.." + return 1 + fi + echo "Helm installation completed" + echo "----------------------------------------" + else + echo "Helm is already running" + echo "----------------------------------------" + return 0 + fi } function install_kafka() { @@ -121,17 +141,17 @@ function install_kafka() { function uninstall_policy() { echo "Removing the policy helm deployment" - sudo microk8s helm uninstall csit-policy - sudo microk8s helm uninstall prometheus - sudo microk8s helm uninstall csit-robot + sudo helm uninstall csit-policy + sudo helm uninstall prometheus + sudo helm uninstall csit-robot sudo kubectl delete deploy $ZK_CONTAINER $KAFKA_CONTAINER rm -rf ${WORKSPACE}/helm/policy/Chart.lock if [ "$PROJECT" == "clamp" ] || [ "$PROJECT" == "policy-clamp" ]; then - sudo microk8s helm uninstall policy-chartmuseum - sudo microk8s helm repo remove chartmuseum-git policy-chartmuseum + sudo helm uninstall policy-chartmuseum + sudo helm repo remove chartmuseum-git policy-chartmuseum fi sudo rm -rf /dockerdata-nfs/mariadb-galera/ - sudo microk8s kubectl delete pvc --all + sudo kubectl delete pvc --all echo "Policy deployment deleted" echo "Clean up docker" docker image prune -f @@ -140,6 +160,8 @@ function uninstall_policy() { function teardown_cluster() { echo "Removing k8s cluster and k8s configuration file" sudo snap remove microk8s;rm -rf $HOME/.kube/config + sudo snap remove helm; + sudo snap remove kubectl; echo "MicroK8s Cluster removed" } @@ -173,14 +195,14 @@ function start_csit() { while [[ ${POD_READY_STATUS} != "1/1" ]]; do echo "Waiting for chartmuseum pod to come up..." sleep 5 - POD_READY_STATUS=$(sudo microk8s kubectl get pods | grep -e "policy-chartmuseum" | awk '{print $2}') + POD_READY_STATUS=$(sudo kubectl get pods | grep -e "policy-chartmuseum" | awk '{print $2}') done push_acelement_chart fi echo "Installing Robot framework pod for running CSIT" cd ${WORKSPACE}/helm mkdir -p ${ROBOT_LOG_DIR} - sudo microk8s helm install csit-robot robot --set robot="$ROBOT_FILE" --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR + sudo helm install csit-robot robot --set robot="$ROBOT_FILE" --set "readiness={${READINESS_CONTAINERS[*]}}" --set robotLogDir=$ROBOT_LOG_DIR print_robot_log fi } @@ -190,17 +212,17 @@ function print_robot_log() { while [[ ${count_pods} -eq 0 ]]; do echo "Waiting for pods to come up..." sleep 5 - count_pods=$(sudo microk8s kubectl get pods --output name | wc -l) + count_pods=$(sudo kubectl get pods --output name | wc -l) done - robotpod=$(sudo microk8s kubectl get po | grep policy-csit) + robotpod=$(sudo kubectl get po | grep policy-csit) podName=$(echo "$robotpod" | awk '{print $1}') echo "The robot tests will begin once the policy components {${READINESS_CONTAINERS[*]}} are up and running..." - sudo microk8s kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=18m pod/"$podName" + sudo kubectl wait --for=jsonpath='{.status.phase}'=Running --timeout=18m pod/"$podName" echo "Policy deployment status:" - sudo microk8s kubectl get po - sudo microk8s kubectl get all -A + sudo kubectl get po + sudo kubectl get all -A echo "Robot Test logs:" - sudo microk8s kubectl logs -f "$podName" + sudo kubectl logs -f "$podName" } function clone_models() { @@ -296,29 +318,30 @@ function set_project_config() { } function install_chartmuseum () { + echo "---------------------------------------------" echo "Installing Chartmuseum helm repository..." - sudo microk8s helm repo add chartmuseum-git https://chartmuseum.github.io/charts - sudo microk8s helm repo update - sudo microk8s helm install policy-chartmuseum chartmuseum-git/chartmuseum --set env.open.DISABLE_API=false --set service.type=NodePort --set service.nodePort=30208 - sudo microk8s helm plugin install https://github.com/chartmuseum/helm-push + sudo helm repo add chartmuseum-git https://chartmuseum.github.io/charts + sudo helm repo update + sudo helm install policy-chartmuseum chartmuseum-git/chartmuseum --set env.open.DISABLE_API=false --set service.type=NodePort --set service.nodePort=30208 + sudo helm plugin install https://github.com/chartmuseum/helm-push echo "---------------------------------------------" } function push_acelement_chart() { echo "Pushing acelement chart to the chartmuseum repo..." - sudo microk8s helm repo add policy-chartmuseum http://localhost:30208 + sudo helm repo add policy-chartmuseum http://localhost:30208 # download clamp repo git clone -b "${GERRIT_BRANCH}" --single-branch https://github.com/onap/policy-clamp.git "${WORKSPACE}"/csit/resources/tests/clamp ACELEMENT_CHART=${WORKSPACE}/csit/resources/tests/clamp/examples/src/main/resources/clamp/acm/acelement-helm/acelement - sudo microk8s helm cm-push $ACELEMENT_CHART policy-chartmuseum - sudo microk8s helm repo update + sudo helm cm-push $ACELEMENT_CHART policy-chartmuseum + sudo helm repo update rm -rf ${WORKSPACE}/csit/resources/tests/clamp/ echo "-------------------------------------------" } function get_pod_name() { - pods=$(microk8s kubectl get pods --no-headers -o custom-columns=':metadata.name' | grep $1) + pods=$(kubectl get pods --no-headers -o custom-columns=':metadata.name' | grep $1) read -rd '' -a pod_array <<< "$pods" echo "${pod_array[@]}" } @@ -405,10 +428,10 @@ if [ $OPERATION == "install" ]; then ${WORKSPACE}/compose/loaddockerimage.sh fi cd ${WORKSPACE}/helm || exit - sudo microk8s helm dependency build policy - sudo microk8s helm install csit-policy policy ${SET_VALUES} - sudo microk8s helm install prometheus prometheus - wait_for_pods_running default 480 ${READINESS_CONTAINERS[@]} + sudo helm dependency build policy + sudo helm install csit-policy policy ${SET_VALUES} + sudo helm install prometheus prometheus + wait_for_pods_running default 900 ${READINESS_CONTAINERS[@]} echo "Policy chart installation completed" echo "-------------------------------------------" fi diff --git a/csit/run-project-csit.sh b/csit/run-project-csit.sh index aa19b257..36bad1ff 100755 --- a/csit/run-project-csit.sh +++ b/csit/run-project-csit.sh @@ -80,7 +80,7 @@ function setup_apex() { function setup_apex_postgres() { export ROBOT_FILES="apex-pdp-test.robot" - source "${WORKSPACE}"/compose/start-postgres-tests.sh 1 + source "${WORKSPACE}"/compose/start-postgres-tests.sh apex-pdp 1 sleep 10 bash "${SCRIPTS}"/wait_for_rest.sh localhost ${PAP_PORT} bash "${SCRIPTS}"/wait_for_rest.sh localhost ${APEX_PORT} @@ -141,6 +141,13 @@ function setup_xacml_pdp() { bash "${SCRIPTS}"/wait_for_rest.sh localhost "${XACML_PORT}" } +function setup_xacml_pdp_postgres() { + export ROBOT_FILES="xacml-pdp-test.robot" + source "${WORKSPACE}"/compose/start-postgres-tests.sh xacml-pdp 1 + sleep 10 + bash "${SCRIPTS}"/wait_for_rest.sh localhost "${XACML_PORT}" +} + function setup_drools_pdp() { export ROBOT_FILES="drools-pdp-test.robot" source "${WORKSPACE}"/compose/start-compose.sh drools-pdp @@ -197,7 +204,7 @@ function set_project_config() { ;; apex-pdp-postgres | policy-apex-pdp-postgres) - setup_apex + setup_apex_postgres ;; apex-pdp-medium | policy-apex-pdp-medium) @@ -212,6 +219,10 @@ function set_project_config() { setup_xacml_pdp ;; + xacml-pdp-postgres | policy-xacml-pdp-postgres) + setup_xacml_pdp_postgres + ;; + drools-pdp | policy-drools-pdp) setup_drools_pdp ;; @@ -253,6 +264,8 @@ export PROJECT="${1}" export ROBOT_LOG_DIR=${WORKSPACE}/csit/archives/${PROJECT} export SCRIPTS="${WORKSPACE}/csit/resources/scripts" export ROBOT_FILES="" +# always 'docker' if running docker compose +export TEST_ENV="docker" cd "${WORKSPACE}" diff --git a/policy-db-migrator/pom.xml b/policy-db-migrator/pom.xml index c068eb33..776a1c71 100644 --- a/policy-db-migrator/pom.xml +++ b/policy-db-migrator/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <artifactId>policy-db-migrator</artifactId> diff --git a/policy-db-migrator/smoke-test/mariadb-clamp-tests.sh b/policy-db-migrator/smoke-test/mariadb-clamp-tests.sh new file mode 100644 index 00000000..052128d0 --- /dev/null +++ b/policy-db-migrator/smoke-test/mariadb-clamp-tests.sh @@ -0,0 +1,219 @@ +#!/bin/sh +# ============LICENSE_START==================================================== +# Copyright (C) 2024 Nordix Foundation. +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== +# shellcheck disable=SC2039 +# shellcheck disable=SC2086 +# shellcheck disable=SC2012 +echo "Start of test $(date +%F-%T)" + +export POLICY_HOME=/opt/app/policy +export SQL_USER=${MYSQL_USER} +export SQL_PASSWORD=${MYSQL_PASSWORD} +export SCRIPT_DIRECTORY=sql +export SCHEMA=clampacm + +# Test variables +TOTAL_COUNT=0 +A_UPGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1400/upgrade/*.sql | wc -l) +A_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1400/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$A_UPGRADE_COUNT +TOTAL_SQLS_DOWNGRADE=$A_DOWNGRADE_COUNT + +B_UPGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1500/upgrade/*.sql | wc -l) +B_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1500/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$(($TOTAL_SQLS_UPGRADE+$B_UPGRADE_COUNT)) +TOTAL_SQLS_DOWNGRADE=$(($TOTAL_SQLS_DOWNGRADE+$B_DOWNGRADE_COUNT)) + +C_UPGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1600/upgrade/*.sql | wc -l) +C_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/sql/1600/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$(($TOTAL_SQLS_UPGRADE+$C_UPGRADE_COUNT)) +TOTAL_SQLS_DOWNGRADE=$(($TOTAL_SQLS_DOWNGRADE+$C_DOWNGRADE_COUNT)) + +NEW_SQL_EXECUTIONS=0 +START_VERSION="" +PREVIOUS_SQL_EXECUTIONS=0 +END_VERSION="" +RECENT_SQL_EXECUTIONS=0 +END_STATUS=0 +TEST_STATUS="FAIL" +TEST_MSG="" +TESTS=0 +PASSED=0 +FAILED=0 + +run_sql() { + local user="${1}" password="${2}" schema="${3}" sql="${4}" + MYSQL="mysql -u${user} -p${password} -h ${SQL_HOST} ${schema}" + ${MYSQL} --execute "${sql}" + return $? +} + +start_test() { + echo "" + echo "############################################################################################################" + echo "" + let TESTS=$TESTS+1 + reportStatus=$(/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report | tail -2) + echo "Starting test $TESTS" + echo "$reportStatus" + START_VERSION=$(echo $reportStatus | cut -f13 -d' ') + PREVIOUS_SQL_EXECUTIONS=$(echo $reportStatus | cut -f1 -d' ') + + if [ "${START_VERSION}" == "" ]; then + START_VERSION="0" + PREVIOUS_SQL_EXECUTIONS=0 + fi +} + +end_test() { + reportStatus=$(/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report | tail -2) + echo "Ending test $TESTS" + echo "$reportStatus" + END_VERSION=$(echo $reportStatus | cut -f13 -d' ') + RECENT_SQL_EXECUTIONS=$(echo $reportStatus | cut -f1 -d' ') + END_STATUS=$(echo $reportStatus | cut -f7 -d' ') +} + +check_results() { + local status="${1}" operation="${2}" startVer="${3}" endVer="${4}" newRecords="${5}" filesRan="${6}" + + echo "" + echo "Test summary: status:$status, operation:$operation, from:$startVer, to:$endVer, new executions:$newRecords, sqlFiles:$filesRan" + # Convert to number + startVer=$(echo ${startVer} | awk '{$0=int($0)}1') + endVer=$(echo ${endVer} | awk '{$0=int($0)}1') + + if [ ${startVer} -eq ${endVer} ] && [ $newRecords -eq $filesRan ] && [ $newRecords -eq 0 ]; then + TEST_MSG="No ${operation} required" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + elif [ $status -eq 1 ] && [ "${operation}" == "upgrade" ] && [ ${startVer} -le ${endVer} ] && [ $newRecords -eq $filesRan ]; then + TEST_MSG="Successful ${operation}" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + elif [ $status -eq 1 ] && [ "${operation}" == "downgrade" ] && [ ${startVer} -ge ${endVer} ] && [ $newRecords -eq $filesRan ]; then + TEST_MSG="Successful ${operation}" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + else + TEST_MSG="Errors occurred during ${operation}" + TEST_STATUS="FAIL" + let FAILED=$FAILED+1 + fi + echo "" + echo "*** Test $TESTS: $TEST_STATUS , $TEST_MSG, current version: $END_VERSION ***" + echo "" +} + +# Test 1 - Upgrade to 1600 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade -t 1600 +end_test +let TOTAL_COUNT=$A_UPGRADE_COUNT+$B_UPGRADE_COUNT+$C_UPGRADE_COUNT +check_results $END_STATUS 'upgrade' "${START_VERSION}" "${END_VERSION}" $RECENT_SQL_EXECUTIONS $TOTAL_COUNT + +sleep 5 + +# Test 2 - downgrade to 1500 +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o downgrade -f 1600 -t 1500 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'downgrade' "${START_VERSION}" "${END_VERSION}" $NEW_SQL_EXECUTIONS $C_DOWNGRADE_COUNT + +sleep 5 + +# Test 3 - downgrade to 1400 +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o downgrade -f 1500 -t 1400 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'downgrade' "${START_VERSION}" "${END_VERSION}" $NEW_SQL_EXECUTIONS $B_DOWNGRADE_COUNT + +sleep 5 + +# Test 4 - upgrade to 1500 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade -f 1400 -t 1500 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'upgrade' "${START_VERSION}" "${END_VERSION}" $NEW_SQL_EXECUTIONS $B_UPGRADE_COUNT + +sleep 5 + +# Test 5 - upgrade to 1600 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade -f 1500 -t 1600 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'upgrade' "${START_VERSION}" "${END_VERSION}" $NEW_SQL_EXECUTIONS $C_UPGRADE_COUNT + +sleep 5 + +# Test 6 - run upgrade on db where tables already exist and migration schema is empty +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o downgrade -f 1600 -t 1400 +run_sql "root" "${MYSQL_ROOT_PASSWORD}" "${SCHEMA}" "DROP DATABASE IF EXISTS migration;" +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade -t 1600 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +let TOTAL_COUNT=$C_DOWNGRADE_COUNT+$C_UPGRADE_COUNT+$B_DOWNGRADE_COUNT+$B_UPGRADE_COUNT +check_results $END_STATUS 'upgrade' "1400" "${END_VERSION}" $NEW_SQL_EXECUTIONS $TOTAL_COUNT + +sleep 5 + +# Test 7 - Full downgrade +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o downgrade -f 1600 -t 0 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'downgrade' "${START_VERSION}" "0" $NEW_SQL_EXECUTIONS $TOTAL_SQLS_DOWNGRADE + +sleep 5 + +# Test 8 - Full upgrade +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results $END_STATUS 'upgrade' "0" "${END_VERSION}" $NEW_SQL_EXECUTIONS $TOTAL_SQLS_UPGRADE + +# Install database +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o upgrade +/opt/app/policy/bin/db-migrator -s ${SQL_DB} -o report + +echo +echo "-----------------------------------------------------------------------" +echo "Number of Tests: $TESTS, Tests Passed: $PASSED, Tests Failed: $FAILED" +echo "-----------------------------------------------------------------------" + +echo "End of test $(date +%F-%T)" + +nc -lk -p 6824 + +exit 0 diff --git a/policy-db-migrator/smoke-test/postgres-clamp-tests.sh b/policy-db-migrator/smoke-test/postgres-clamp-tests.sh new file mode 100644 index 00000000..98832520 --- /dev/null +++ b/policy-db-migrator/smoke-test/postgres-clamp-tests.sh @@ -0,0 +1,206 @@ +#!/bin/sh +# ============LICENSE_START==================================================== +# Copyright (C) 2024 Nordix Foundation. +# ============================================================================= +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END====================================================== +# shellcheck disable=SC2039 +# shellcheck disable=SC2086 +# shellcheck disable=SC2012 +echo "Start of test $(date +%F-%T)" + +export POLICY_HOME=/opt/app/policy +export SQL_USER=${MYSQL_USER} +export SQL_PASSWORD=${MYSQL_PASSWORD} +export SCRIPT_DIRECTORY=postgres +export SCHEMA=clampacm + +# Test variables +TOTAL_COUNT=0 +A_UPGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1400/upgrade/*.sql | wc -l) +A_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1400/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$A_UPGRADE_COUNT +TOTAL_SQLS_DOWNGRADE=$A_DOWNGRADE_COUNT + +B_UPGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1500/upgrade/*.sql | wc -l) +B_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1500/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$(($TOTAL_SQLS_UPGRADE+$B_UPGRADE_COUNT)) +TOTAL_SQLS_DOWNGRADE=$(($TOTAL_SQLS_DOWNGRADE+$B_DOWNGRADE_COUNT)) + +C_UPGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1600/upgrade/*.sql | wc -l) +C_DOWNGRADE_COUNT=$(ls /home/${SQL_DB}/postgres/1600/downgrade/*.sql | wc -l) +TOTAL_SQLS_UPGRADE=$(($TOTAL_SQLS_UPGRADE+$C_UPGRADE_COUNT)) +TOTAL_SQLS_DOWNGRADE=$(($TOTAL_SQLS_DOWNGRADE+$C_DOWNGRADE_COUNT)) + +NEW_SQL_EXECUTIONS=0 +PREVIOUS_SQL_EXECUTIONS=0 +RECENT_SQL_EXECUTIONS=0 +TEST_STATUS="FAIL" +TEST_MSG="" +TESTS=0 +PASSED=0 +FAILED=0 + +run_sql() { + local user="${1}" schema="${2}" sql="${3}" + PGSQL="psql -U ${user} -d ${schema} -h ${SQL_HOST}" + ${PGSQL} --command "${sql}" + return $? +} + +start_test() { + echo "" + echo "############################################################################################################" + echo "" + let TESTS=$TESTS+1 + echo "Starting test $TESTS" + PREVIOUS_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS +} + +end_test() { + echo "Ending test $TESTS" + reportStatus=$(/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o report | tail -3) + echo "Status: $reportStatus" + RECENT_SQL_EXECUTIONS=$(echo $reportStatus | cut -f1 -d' ' | sed 's/(//') +} + +check_results() { + local operation="${1}" startVer="${2}" endVer="${3}" newRecords="${4}" filesRan="${5}" + + echo "" + echo "Test summary: operation:$operation, from:$startVer, to:$endVer, new executions:$newRecords, sqlFiles:$filesRan" + # Convert to number + startVer=$(echo ${startVer} | awk '{$0=int($0)}1') + endVer=$(echo ${endVer} | awk '{$0=int($0)}1') + + if [ ${startVer} -eq ${endVer} ] && [ $newRecords -eq $filesRan ] && [ $newRecords -eq 0 ]; then + TEST_MSG="No ${operation} required" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + elif [ "${operation}" == "upgrade" ] && [ ${startVer} -le ${endVer} ] && [ $newRecords -eq $filesRan ]; then + TEST_MSG="Successful ${operation}" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + elif [ "${operation}" == "downgrade" ] && [ ${startVer} -ge ${endVer} ] && [ $newRecords -eq $filesRan ]; then + TEST_MSG="Successful ${operation}" + TEST_STATUS="PASS" + let PASSED=$PASSED+1 + else + TEST_MSG="Errors occurred during ${operation}" + TEST_STATUS="FAIL" + let FAILED=$FAILED+1 + fi + echo "" + echo "*** Test $TESTS: $TEST_STATUS , $TEST_MSG, current version: $END_VERSION ***" + echo "" +} + +# Test 1 - Upgrade to 1600 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade -t 1600 +end_test +let TOTAL_COUNT=$A_UPGRADE_COUNT+$B_UPGRADE_COUNT+$C_UPGRADE_COUNT +check_results 'upgrade' "0" "1600" $RECENT_SQL_EXECUTIONS $TOTAL_COUNT + +sleep 5 + +# Test 2 - downgrade to 1500 +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o downgrade -f 1600 -t 1500 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'downgrade' "1600" "1500" $NEW_SQL_EXECUTIONS $C_DOWNGRADE_COUNT + +sleep 5 + +# Test 3 - downgrade to 1400 +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o downgrade -f 1500 -t 1400 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'downgrade' "1500" "1400" $NEW_SQL_EXECUTIONS $B_DOWNGRADE_COUNT + +sleep 5 + +# Test 4 - upgrade to 1500 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade -f 1400 -t 1500 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'upgrade' "1400" "1500" $NEW_SQL_EXECUTIONS $B_UPGRADE_COUNT + +sleep 5 + +# Test 5 - upgrade to 1600 +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade -f 1500 -t 1600 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'upgrade' "1500" "1600" $NEW_SQL_EXECUTIONS $C_UPGRADE_COUNT + +sleep 5 + +# Test 6 - run upgrade on db where tables already exist and migration schema is empty +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o downgrade -f 1600 -t 1400 +run_sql $SQL_USER "migration" "DROP TABLE IF EXISTS migration;" +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade -t 1600 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +let TOTAL_COUNT=$B_UPGRADE_COUNT+$B_DOWNGRADE_COUNT+$C_UPGRADE_COUNT+$C_DOWNGRADE_COUNT +check_results 'upgrade' "1600" "1600" $NEW_SQL_EXECUTIONS $TOTAL_COUNT + +#sleep 5 + +# Test 7 - Full downgrade +start_test +/opt/app/policy/bin/prepare_downgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o downgrade -f 1600 -t 0 +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'downgrade' "1600" "0" $NEW_SQL_EXECUTIONS $TOTAL_SQLS_DOWNGRADE + +sleep 5 + +# Test 6 - Full upgrade +start_test +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade +end_test +let NEW_SQL_EXECUTIONS=$RECENT_SQL_EXECUTIONS-$PREVIOUS_SQL_EXECUTIONS +check_results 'upgrade' "0" "1600" $NEW_SQL_EXECUTIONS $TOTAL_SQLS_UPGRADE + +# Install database +/opt/app/policy/bin/prepare_upgrade.sh ${SQL_DB} +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o upgrade +/opt/app/policy/bin/db-migrator-pg -s ${SQL_DB} -o report + +echo +echo "-----------------------------------------------------------------------" +echo "Number of Tests: $TESTS, Tests Passed: $PASSED, Tests Failed: $FAILED" +echo "-----------------------------------------------------------------------" + +echo "End of test $(date +%F-%T)" + +nc -lk -p 6824 + +exit 0 diff --git a/policy-db-migrator/src/main/docker/Dockerfile b/policy-db-migrator/src/main/docker/Dockerfile index 06b7beae..8f632c87 100644 --- a/policy-db-migrator/src/main/docker/Dockerfile +++ b/policy-db-migrator/src/main/docker/Dockerfile @@ -19,7 +19,7 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= #------------------------------------------------------------------------------- -FROM onap/policy-jre-alpine:3.1.4-SNAPSHOT +FROM onap/policy-jre-alpine:4.0.1-SNAPSHOT LABEL maintainer="Policy Team" LABEL org.opencontainers.image.title="Policy db-migrator" diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0100-automationcomposition.sql new file mode 100644 index 00000000..f0897cfe --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0100-automationcomposition.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +ALTER TABLE automationcomposition DROP subState; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0200-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0200-automationcompositionelement.sql new file mode 100644 index 00000000..ef6f3c79 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/downgrade/0200-automationcompositionelement.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +ALTER TABLE automationcompositionelement DROP subState, DROP stage; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0100-automationcomposition.sql new file mode 100644 index 00000000..b3ec5f96 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0100-automationcomposition.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +ALTER TABLE automationcomposition ADD subState SMALLINT DEFAULT NULL; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0200-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0200-automationcompositionelement.sql new file mode 100644 index 00000000..3e91bbf7 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/postgres/1600/upgrade/0200-automationcompositionelement.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +ALTER TABLE automationcompositionelement ADD subState SMALLINT DEFAULT NULL, ADD stage SMALLINT DEFAULT NULL; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql index cadcea93..a699e565 100644 --- a/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1400/downgrade/0700-ac_compositionId_index.sql @@ -17,4 +17,4 @@ * ============LICENSE_END========================================================= */ -DROP INDEX ac_element_fk ON clampacm.automationcompositionelement;
\ No newline at end of file +DROP INDEX ac_compositionId ON clampacm.automationcomposition; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0100-automationcomposition.sql new file mode 100644 index 00000000..f0897cfe --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0100-automationcomposition.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +ALTER TABLE automationcomposition DROP subState; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0200-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0200-automationcompositionelement.sql new file mode 100644 index 00000000..ef6f3c79 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/downgrade/0200-automationcompositionelement.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +ALTER TABLE automationcompositionelement DROP subState, DROP stage; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0100-automationcomposition.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0100-automationcomposition.sql new file mode 100644 index 00000000..7e0fd078 --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0100-automationcomposition.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +ALTER TABLE automationcomposition ADD subState TINYINT DEFAULT NULL NULL; diff --git a/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0200-automationcompositionelement.sql b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0200-automationcompositionelement.sql new file mode 100644 index 00000000..06ce9a9d --- /dev/null +++ b/policy-db-migrator/src/main/docker/config/clampacm/sql/1600/upgrade/0200-automationcompositionelement.sql @@ -0,0 +1,20 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +ALTER TABLE automationcompositionelement ADD subState TINYINT DEFAULT NULL NULL, ADD stage TINYINT DEFAULT NULL NULL; diff --git a/policy-jdk/alpine/pom.xml b/policy-jdk/alpine/pom.xml index ca310255..a6e47af0 100644 --- a/policy-jdk/alpine/pom.xml +++ b/policy-jdk/alpine/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>policy-jdk</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <packaging>pom</packaging> diff --git a/policy-jdk/pom.xml b/policy-jdk/pom.xml index 410ec374..dced9b41 100644 --- a/policy-jdk/pom.xml +++ b/policy-jdk/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <artifactId>policy-jdk</artifactId> diff --git a/policy-jre/alpine/pom.xml b/policy-jre/alpine/pom.xml index 9d60d4b0..a1fb46d7 100644 --- a/policy-jre/alpine/pom.xml +++ b/policy-jre/alpine/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>policy-jre</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <packaging>pom</packaging> diff --git a/policy-jre/pom.xml b/policy-jre/pom.xml index eeaff490..57f39c29 100644 --- a/policy-jre/pom.xml +++ b/policy-jre/pom.xml @@ -24,7 +24,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <artifactId>policy-jre</artifactId> diff --git a/policy-regression-tests/pom.xml b/policy-regression-tests/pom.xml index d0dcdade..ffc5176b 100644 --- a/policy-regression-tests/pom.xml +++ b/policy-regression-tests/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> </parent> <groupId>org.onap.policy.regression</groupId> @@ -25,13 +25,13 @@ <parent> <groupId>org.onap.policy.parent</groupId> <artifactId>integration</artifactId> - <version>5.0.0-SNAPSHOT</version> + <version>5.0.1-SNAPSHOT</version> <relativePath /> </parent> <groupId>org.onap.policy.docker</groupId> <artifactId>docker</artifactId> - <version>4.0.0-SNAPSHOT</version> + <version>4.0.1-SNAPSHOT</version> <packaging>pom</packaging> <name>policy-docker</name> diff --git a/releases/4.0.0-container.yaml b/releases/4.0.0-container.yaml new file mode 100644 index 00000000..bab7d393 --- /dev/null +++ b/releases/4.0.0-container.yaml @@ -0,0 +1,12 @@ +distribution_type: 'container' +container_release_tag: '4.0.0' +project: 'policy-docker' +log_dir: 'policy-docker-maven-docker-stage-master/1047' +ref: 8e03046e2b07df88c2356c86116111d8fb22dc6a +containers: + - name: 'policy-jre-alpine' + version: '4.0.0-20240712T0754' + - name: 'policy-jdk-alpine' + version: '4.0.0-20240712T0754' + - name: 'policy-db-migrator' + version: '4.0.0-20240712T0754' diff --git a/version.properties b/version.properties index 19e0714b..bac52448 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=4 minor=0 -patch=0 +patch=1 base_version=${major}.${minor}.${patch} |