-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kie-issues#2659: [SonataFlow] Migrate DBMigration Image from SonataFl…
…ow operator repository to kie-tools (#2697)
- Loading branch information
Showing
29 changed files
with
1,472 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
210 changes: 210 additions & 0 deletions
210
.ci/jenkins/release-jobs/Jenkinsfile.kogito-db-migrator-tool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
pipeline { | ||
agent { | ||
docker { | ||
image 'docker.io/apache/incubator-kie-tools-ci-build:main' | ||
args '--shm-size=2g --privileged --group-add docker' | ||
} | ||
} | ||
|
||
options { | ||
timeout(time: 60, unit: 'MINUTES') | ||
} | ||
|
||
parameters { | ||
booleanParam(description: 'Dry run', name: 'DRY_RUN', defaultValue: true) | ||
string(description: 'Release Version', name: 'RELEASE_VERSION', defaultValue: '0.0.0') | ||
string(description: 'Base Ref', name: 'BASE_REF') | ||
string(description: 'Release Candidate Version', name: 'RELEASE_CANDIDATE_VERSION', defaultValue: '') | ||
} | ||
|
||
environment { | ||
KIE_TOOLS_BUILD__runLinters = 'false' | ||
KIE_TOOLS_BUILD__runTests = 'false' | ||
KIE_TOOLS_BUILD__runEndToEndTests = 'false' | ||
KIE_TOOLS_BUILD__buildContainerImages = 'true' | ||
|
||
|
||
KOGITO_DB_MIGRATOR_TOOL__registry = 'docker.io' | ||
KOGITO_DB_MIGRATOR_TOOL__account = 'apache' | ||
KOGITO_DB_MIGRATOR_TOOL__name = 'kogito-db-migrator-tool' | ||
KOGITO_DB_MIGRATOR_TOOL__buildTag = "${params.RELEASE_VERSION}" | ||
|
||
RELEASE_ARTIFACTS_DIR = "${WORKSPACE}/release-artifacts" | ||
|
||
DOCKER_CONFIG = "${WORKSPACE}/.docker" | ||
|
||
PNPM_FILTER_STRING = '-F @kie-tools/kogito-db-migrator-tool...' | ||
} | ||
|
||
stages { | ||
stage('Load local shared scripts') { | ||
steps { | ||
script { | ||
pipelineVars = load '.ci/jenkins/shared-scripts/pipelineVars.groovy' | ||
buildUtils = load '.ci/jenkins/shared-scripts/buildUtils.groovy' | ||
githubUtils = load '.ci/jenkins/shared-scripts/githubUtils.groovy' | ||
dockerUtils = load '.ci/jenkins/shared-scripts/dockerUtils.groovy' | ||
releaseUtils = load '.ci/jenkins/shared-scripts/releaseUtils.groovy' | ||
} | ||
} | ||
} | ||
|
||
stage('Start required services for build and tests (DinD, Xvfb, Fluxbox)') { | ||
steps { | ||
script { | ||
buildUtils.startRequiredServices() | ||
} | ||
} | ||
} | ||
|
||
stage('Clean workspace before build') { | ||
steps { | ||
cleanWs(deleteDirs: true, disableDeferredWipeout: true) | ||
} | ||
} | ||
|
||
stage('Load upstream images') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION != '' } | ||
} | ||
steps { | ||
script { | ||
upstreamReleaseArtifactsDir = "${WORKSPACE}/upstream-release-artifacts" | ||
releaseUtils.downloadReleaseArtifacts("${pipelineVars.asfReleaseStagingRepository}", "${upstreamReleaseArtifactsDir}", "${params.RELEASE_CANDIDATE_VERSION}") | ||
upstreamImagesArtifacts = releaseUtils.getUpstreamImagesArtifactsList("${upstreamReleaseArtifactsDir}", "${params.RELEASE_CANDIDATE_VERSION}") | ||
dockerUtils.loadImages(upstreamImagesArtifacts as String[]) | ||
} | ||
} | ||
} | ||
|
||
stage('Checkout kie-tools') { | ||
steps { | ||
dir('kie-tools') { | ||
script { | ||
githubUtils.checkoutRepo( | ||
"http://github.com/${pipelineVars.githubRepositorySlug}.git", | ||
"${params.BASE_REF}", | ||
"${pipelineVars.kieToolsBotGithubCredentialsId}" | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Setup PNPM') { | ||
steps { | ||
dir('kie-tools') { | ||
script { | ||
buildUtils.setupPnpm("${pipelineVars.mavenSettingsReleaseConfigFileId}") | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('PNPM Bootstrap') { | ||
steps { | ||
dir('kie-tools') { | ||
script { | ||
buildUtils.pnpmBootstrap("${env.PNPM_FILTER_STRING}") | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Build') { | ||
steps { | ||
dir('kie-tools') { | ||
script { | ||
buildUtils.pnpmBuild("${env.PNPM_FILTER_STRING}") | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Push kogito-db-migrator-tool to Docker Hub') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION == '' } | ||
} | ||
steps { | ||
script { | ||
dockerUtils.pushImageToRegistry( | ||
"${env.KOGITO_DB_MIGRATOR_TOOL__registry}", | ||
"${env.KOGITO_DB_MIGRATOR_TOOL__account}", | ||
"${env.KOGITO_DB_MIGRATOR_TOOL__name}", | ||
"${env.KOGITO_DB_MIGRATOR_TOOL_buildTag}", | ||
"${pipelineVars.dockerHubUserCredentialsId}", | ||
"${pipelineVars.dockerHubTokenCredentialsId}" | ||
) | ||
} | ||
} | ||
} | ||
|
||
stage('Setup release candidate artifacts') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION != '' } | ||
} | ||
steps { | ||
script { | ||
env.RELEASE_IMAGE_TAR_FILE = "incubator-kie-${params.RELEASE_CANDIDATE_VERSION}-kogito-db-migrator-tool-image.tar.gz" | ||
|
||
sh """#!/bin/bash -el | ||
mkdir ${env.RELEASE_ARTIFACTS_DIR} | ||
docker save "${env.KOGITO_DB_MIGRATOR_TOOL__registry}/${env.KOGITO_MANAGEMENT_CONSOLE__account}/${env.KOGITO_MANAGEMENT_CONSOLE__name}:${params.RELEASE_VERSION}" | gzip > "${env.RELEASE_ARTIFACTS_DIR}/${env.RELEASE_IMAGE_TAR_FILE}" | ||
""".trim() | ||
} | ||
} | ||
} | ||
|
||
stage('Sign artifact for Apache release') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION != '' } | ||
} | ||
steps { | ||
dir("${env.RELEASE_ARTIFACTS_DIR}") { | ||
script { | ||
releaseUtils.setupSigningKey("${pipelineVars.asfReleaseGPGKeyCredentialsId}") | ||
releaseUtils.signArtifact("${env.RELEASE_IMAGE_TAR_FILE}") | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Publish Release Candidate artifacts') { | ||
when { | ||
expression { !params.DRY_RUN && params.RELEASE_CANDIDATE_VERSION != '' } | ||
} | ||
steps { | ||
script { | ||
releaseUtils.publishArtifacts( | ||
"${env.RELEASE_ARTIFACTS_DIR}", | ||
"${pipelineVars.asfReleaseStagingRepository}", | ||
"${params.RELEASE_CANDIDATE_VERSION}", | ||
"${pipelineVars.asfReleaseSVNStagingCredentialsId}" | ||
) | ||
} | ||
} | ||
} | ||
} | ||
|
||
post { | ||
always { | ||
cleanWs(deleteDirs: true) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,6 +347,5 @@ turbo.json | |
packages/*/.idea | ||
examples/*/.idea | ||
|
||
|
||
# Apache RAT check excludes file | ||
!.rat-excludes | ||
!.rat-excludes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you 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. | ||
--> | ||
|
||
# Kogito DB Migrator Tool Image | ||
|
||
This package contains the `Containerfile/Dockerfile` and scripts to build a container image for Kogito DB Migrator Tool, which currently supports PostgreSQL database. Future versions are expected to support more database variants. Details about the Kogito DB Migrator Tool can be found [here](../kogito-db-migrator-tool/README.md) | ||
|
||
## Additional requirements | ||
|
||
- docker | ||
|
||
## Run | ||
|
||
- Start up a clean container with: | ||
|
||
```bash | ||
docker run docker.io/apache/incubator-kie-kogito-db-migrator-tool:main | ||
``` | ||
|
||
## Customization | ||
|
||
1. Run a container with custom environment variables: | ||
|
||
| NAME | DESCRIPTION | DEFAULT | | ||
| --------------------------------------- | -------------------------------------------------------------------------------- | ----------------------------------------- | | ||
| MIGRATE_DB_DATAINDEX | Set to true if you want to migrate data index database, set to false otherwise | false | | ||
| QUARKUS_DATASOURCE_DATAINDEX_JDBC_URL | Data index database url e.g. jdbc:postgresql://host.docker.internal:5432/di | jdbc:postgresql://localhost:5432/postgres | | ||
| QUARKUS_DATASOURCE_DATAINDEX_USERNAME | Data index database username | postgres | | ||
| QUARKUS_DATASOURCE_DATAINDEX_PASSWORD | Data index database password | postgres | | ||
| QUARKUS_FLYWAY_DATAINDEX_SCHEMAS | Data index database schema | data-index-service | | ||
| MIGRATE_DB_JOBSSERVICE | Set to true if you want to migrate jobs service database, set to false otherwise | false | | ||
| QUARKUS_DATASOURCE_JOBSSERVICE_JDBC_URL | Jobs service database url e.g. jdbc:postgresql://host.docker.internal:5432/js | jdbc:postgresql://localhost:5432/postgres | | ||
| QUARKUS_DATASOURCE_JOBSSERVICE_USERNAME | Jobs service database username | postgres | | ||
| QUARKUS_DATASOURCE_JOBSSERVICE_PASSWORD | Jobs service database password | postgres | | ||
| QUARKUS_FLYWAY_JOBSSERVICE_SCHEMAS | Jobs service database schema | jobs-service | | ||
|
||
### Example | ||
|
||
An example to use diverse environment variables | ||
|
||
```bash | ||
docker run \ | ||
--env MIGRATE_DB_DATAINDEX=true \ | ||
--env QUARKUS_DATASOURCE_DATAINDEX_JDBC_URL=<data-index-db-url e.g. jdbc:postgresql://host.docker.internal:5432/di> \ | ||
--env QUARKUS_DATASOURCE_DATAINDEX_USERNAME=<data-index-db-user> \ | ||
--env QUARKUS_DATASOURCE_DATAINDEX_PASSWORD=<data-index-db-password> \ | ||
--env QUARKUS_FLYWAY_DATAINDEX_SCHEMAS=data-index-service \ | ||
--env MIGRATE_DB_JOBSSERVICE=true \ | ||
--env QUARKUS_DATASOURCE_JOBSSERVICE_JDBC_URL=<jobs-service-db-url e.g. jdbc:postgresql://host.docker.internal:5432/js> \ | ||
--env QUARKUS_DATASOURCE_JOBSSERVICE_USERNAME=<jobs-service-db-user> \ | ||
--env QUARKUS_DATASOURCE_JOBSSERVICE_PASSWORD=<jobs-service-db-password> \ | ||
--env QUARKUS_FLYWAY_JOBSSERVICE_SCHEMAS=jobs-service \ | ||
docker.io/apache/incubator-kie-kogito-db-migrator-tool:main | ||
``` | ||
|
||
--- | ||
|
||
Apache KIE (incubating) is an effort undergoing incubation at The Apache Software | ||
Foundation (ASF), sponsored by the name of Apache Incubator. Incubation is | ||
required of all newly accepted projects until a further review indicates that | ||
the infrastructure, communications, and decision making process have stabilized | ||
in a manner consistent with other successful ASF projects. While incubation | ||
status is not necessarily a reflection of the completeness or stability of the | ||
code, it does indicate that the project has yet to be fully endorsed by the ASF. | ||
|
||
Some of the incubating project’s releases may not be fully compliant with ASF | ||
policy. For example, releases may have incomplete or un-reviewed licensing | ||
conditions. What follows is a list of known issues the project is currently | ||
aware of (note that this list, by definition, is likely to be incomplete): | ||
|
||
- Hibernate, an LGPL project, is being used. Hibernate is in the process of | ||
relicensing to ASL v2 | ||
- Some files, particularly test files, and those not supporting comments, may | ||
be missing the ASF Licensing Header | ||
|
||
If you are planning to incorporate this work into your product/project, please | ||
be aware that you will need to conduct a thorough licensing review to determine | ||
the overall implications of including this work. For the current status of this | ||
project through the Apache Incubator visit: | ||
https://incubator.apache.org/projects/kie.html |
Oops, something went wrong.