Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.0.x] NO-ISSUE: Fixes for the release Jenkins and Github workflow jobs #2092

Merged
merged 8 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 8 additions & 17 deletions .ci/jenkins/Jenkinsfile.deploy
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ pipeline {
def mavenCommand = getMavenCommand().withProperty('maven.test.failure.ignore', true)
.withOptions(env.BUILD_MVN_OPTS_CURRENT ? [ env.BUILD_MVN_OPTS_CURRENT ] : [])
.withOptions(env.KOGITO_APPS_BUILD_MVN_OPTS ? [ env.KOGITO_APPS_BUILD_MVN_OPTS ] : [])
.skipTests(skipTests)

if (params.SKIP_TESTS) {
mavenCommand.skipTests()
}

if (isRelease()) {
releaseUtils.gpgImportKeyFromStringWithoutPassword(getReleaseGpgSignKeyCredsId())
Expand Down Expand Up @@ -180,22 +183,6 @@ pipeline {
}
}
}

stage('Trigger JIT Executor Native - Release Candidate - GH workflow') {
steps {
script {
dir(getRepoName()) {
withCredentials([usernamePassword(credentialsId: "${getGitAuthorPushCredsId()}", usernameVariable: 'GITHUB_USER', passwordVariable: 'GITHUB_TOKEN')]) {
sh """
git config user.email ${GITHUB_USER}@jenkins.kie.apache.org
git config user.name ${GITHUB_USER}
gh workflow run "publish-jitexecutor-native-rc.yml" --ref "${getBuildBranch()}" -f release_candidate_version="${getProjectVersion()}" --repo="https://github.com/${getGitAuthor()}/${getRepoName()}"
"""
}
}
}
}
}
}
post {
always {
Expand Down Expand Up @@ -272,6 +259,10 @@ String getGitAuthorCredsId() {
return env.GIT_AUTHOR_CREDS_ID
}

String getGitAuthorPushCredsId() {
return env.GIT_AUTHOR_PUSH_CREDS_ID
}

String getBuildBranch() {
return params.BUILD_BRANCH_NAME
}
Expand Down
228 changes: 211 additions & 17 deletions .github/workflows/publish-jitexecutor-native-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ on:
release_candidate_version:
description: "Release candidate version"
required: true
drools_repository:
description: "Drools repository"
required: true
kogito_runtimes_repository:
description: "Kogito runtimes repository"
required: true

jobs:
build_jitexecutor_native:
Expand All @@ -28,10 +34,9 @@ jobs:
echo "REF=${{github.event.pull_request.head.ref}}" >> "$GITHUB_OUTPUT"
echo "PROJECT_VERSION=999-SNAPSHOT" >> "$GITHUB_OUTPUT"
else
VERSION="${{ github.event.inputs.release_candidate_version }}"
echo "REPOSITORY=apache/incubator-kie-kogito-apps" >> "$GITHUB_OUTPUT"
echo "REF=${VERSION//-SNAPSHOT/}" >> "$GITHUB_OUTPUT"
echo "PROJECT_VERSION=$VERSION" >> "$GITHUB_OUTPUT"
echo "REF=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
echo "PROJECT_VERSION=${{ github.event.inputs.release_candidate_version }}" >> "$GITHUB_OUTPUT"
fi
shell: bash

Expand All @@ -51,21 +56,200 @@ jobs:
maven-version: 3.9.6

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
if: github.event_name != 'pull_request'
uses: crazy-max/ghaction-import-gpg@111c56156bcc6918c056dbef52164cfa583dc549
with:
gpg_private_key: ${{ secrets.GPG_KEY }}

- name: Setup maven settings (Linux and MacOS)
if: (runner.os == 'Linux' || runner.os == 'macOS')
env:
WORKDIR_PATH: ${{ github.workspace }}
DROOLS_REPO: ${{ github.event.inputs.drools_repository }}
KOGITO_RUNTIMES_REPO: ${{ github.event.inputs.kogito_runtimes_repository }}
run: |
mkdir -p ${WORKDIR_PATH}/.m2
echo "<settings>
<servers>
<server>
<id>apache.releases.https</id>
<username>${{ secrets.NEXUS_STAGE_DEPLOYER_USER }}</username>
<password>${{ secrets.NEXUS_STAGE_DEPLOYER_PW }}</password>
</server>
<server>
<id>apache.snapshots.https</id>
<username>${{ secrets.NEXUS_USER }}</username>
<password>${{ secrets.NEXUS_PW }}</password>
</server>
</servers>
<profiles>
<profile>
<id>additional_repos</id>
<repositories>
<repository>
<id>apache-kie-drools-staging-repository</id>
<name>Apache KIE Drools Staging Repository</name>
<url>${DROOLS_REPO}</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<id>apache-kie-kogito-runtimes-staging-repository</id>
<name>Apache KIE Kogito Runtimes Staging Repository</name>
<url>${KOGITO_RUNTIMES_REPO}</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>apache-kie-kogito-runtimes-staging-repository</id>
<name>Apache KIE Kogito Runtimes Staging Repository</name>
<url>${KOGITO_RUNTIMES_REPO}</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>apache-kie-drools-staging-repository</id>
<name>Apache KIE Drools Staging Repository</name>
<url>${DROOLS_REPO}</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>additional_repos</activeProfile>
</activeProfiles>
</settings>" > ${WORKDIR_PATH}/.m2/settings.xml

- name: Setup maven settings (Windows)
if: runner.os == 'Windows'
env:
WORKDIR_PATH: ${{ github.workspace }}
DROOLS_REPO: ${{ github.event.inputs.drools_repository }}
KOGITO_RUNTIMES_REPO: ${{ github.event.inputs.kogito_runtimes_repository }}
shell: pwsh
run: |
New-Item -Name ".m2" -Path "$env:WORKDIR_PATH" -ItemType Directory
$contentToAdd = @"
<settings>
<servers>
<server>
<id>apache.releases.https</id>
<username>${{ secrets.NEXUS_STAGE_DEPLOYER_USER }}</username>
<password>${{ secrets.NEXUS_STAGE_DEPLOYER_PW }}</password>
</server>
<server>
<id>apache.snapshots.https</id>
<username>${{ secrets.NEXUS_USER }}</username>
<password>${{ secrets.NEXUS_PW }}</password>
</server>
</servers>
<profiles>
<profile>
<id>additional_repos</id>
<repositories>
<repository>
<id>apache-kie-kogito-runtimes-staging-repository</id>
<name>Apache KIE Kogito Runtimes Staging Repository</name>
<url>$env:KOGITO_RUNTIMES_REPO</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<id>apache-kie-drools-staging-repository</id>
<name>Apache KIE Drools Staging Repository</name>
<url>$env:DROOLS_REPO</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>apache-kie-kogito-runtimes-staging-repository</id>
<name>Apache KIE Kogito Runtimes Staging Repository</name>
<url>$env:KOGITO_RUNTIMES_REPO</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>apache-kie-drools-staging-repository</id>
<name>Apache KIE Drools Staging Repository</name>
<url>$env:DROOLS_REPO</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>additional_repos</activeProfile>
</activeProfiles>
</settings>
"@
Add-Content "$env:WORKDIR_PATH\.m2\settings.xml" $contentToAdd

- name: "Set up JDK 17"
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
server-id: apache.releases.https
server-username: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }}
server-password: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }}
gpg-private-key: ${{ secrets.GPG_KEY }}
gpg-passphrase: ""

overwrite-settings: false

- name: "Setup Linux"
if: runner.os == 'Linux'
run: |
Expand Down Expand Up @@ -115,16 +299,20 @@ jobs:
- name: "Update versions (Linux and macOS)"
if: (runner.os == 'Linux' || runner.os == 'macOS') && github.event_name != 'pull_request'
shell: bash
env:
SETTINGS_FILE_PATH: ${{ github.workspace }}/.m2/settings.xml
run: |
mvn -B -fae -ntp -N -e versions:update-parent -DparentVersion="[${{ steps.version.outputs.PROJECT_VERSION }}]" -DallowSnapshots=true -DgenerateBackupPoms=false
mvn -B -fae -ntp -N -e versions:update-child-modules -DallowSnapshots=true -DgenerateBackupPoms=false
mvn -B -fae -ntp -N -e versions:update-parent -DparentVersion="[${{ steps.version.outputs.PROJECT_VERSION }}]" -DallowSnapshots=true -DgenerateBackupPoms=false -s ${SETTINGS_FILE_PATH}
mvn -B -fae -ntp -N -e versions:update-child-modules -DallowSnapshots=true -DgenerateBackupPoms=false -s ${SETTINGS_FILE_PATH}

- name: "Update versions Windows"
if: runner.os == 'Windows' && github.event_name != 'pull_request'
shell: pwsh
env:
SETTINGS_FILE_PATH: ${{ github.workspace }}\.m2\settings.xml
run: |
mvn -B -fae -ntp -N -e versions:update-parent -DparentVersion="[${{ steps.version.outputs.PROJECT_VERSION }}]" -DallowSnapshots=true -DgenerateBackupPoms=false
mvn -B -fae -ntp -N -e versions:update-child-modules -DallowSnapshots=true -DgenerateBackupPoms=false
mvn -B -fae -ntp -N -e versions:update-parent -DparentVersion="[${{ steps.version.outputs.PROJECT_VERSION }}]" -DallowSnapshots=true -DgenerateBackupPoms=false -s $env:SETTINGS_FILE_PATH
mvn -B -fae -ntp -N -e versions:update-child-modules -DallowSnapshots=true -DgenerateBackupPoms=false -s $env:SETTINGS_FILE_PATH

- name: "Build macOS"
if: runner.os == 'macOS' && github.event_name == 'pull_request'
Expand All @@ -135,8 +323,10 @@ jobs:
- name: "Build and publish macOS"
if: runner.os == 'macOS' && github.event_name != 'pull_request'
shell: bash
env:
SETTINGS_FILE_PATH: ${{ github.workspace }}/.m2/settings.xml
run: |
mvn clean deploy -B -ntp -DdeployAtEnd -DskipTests -pl jitexecutor-native/jitexecutor-native-darwin -am -Pjitexecutor-native -Prelease
mvn clean deploy -B -ntp -DdeployAtEnd -DskipTests -pl jitexecutor-native/jitexecutor-native-darwin -am -Pjitexecutor-native -Papache-release -s ${SETTINGS_FILE_PATH}

- name: "Build Linux"
if: runner.os == 'Linux' && github.event_name == 'pull_request'
Expand All @@ -147,8 +337,10 @@ jobs:
- name: "Build and Publish Linux"
if: runner.os == 'Linux' && github.event_name != 'pull_request'
shell: bash
env:
SETTINGS_FILE_PATH: ${{ github.workspace }}/.m2/settings.xml
run: |
mvn clean deploy -B -ntp -DdeployAtEnd -DskipTests -pl jitexecutor-native/jitexecutor-native-linux -am -Pjitexecutor-native -Prelease
mvn clean deploy -B -ntp -DdeployAtEnd -DskipTests -pl jitexecutor-native/jitexecutor-native-linux -am -Pjitexecutor-native -Papache-release -s ${SETTINGS_FILE_PATH}

- name: "Build Windows"
if: runner.os == 'Windows' && github.event_name == 'pull_request'
Expand All @@ -159,8 +351,10 @@ jobs:
- name: "Build and Publish Windows"
if: runner.os == 'Windows' && github.event_name != 'pull_request'
shell: pwsh
env:
SETTINGS_FILE_PATH: ${{ github.workspace }}\.m2\settings.xml
run: |
mvn clean deploy -B -ntp -DdeployAtEnd -DskipTests -pl jitexecutor-native/jitexecutor-native-win32 -am -Pjitexecutor-native -Prelease
mvn clean deploy -B -ntp -DdeployAtEnd -DskipTests -pl jitexecutor-native/jitexecutor-native-win32 -am -Pjitexecutor-native -Papache-release -s $env:SETTINGS_FILE_PATH

- name: "Upload JIT Executor binary"
uses: actions/upload-artifact@v4
Expand Down
Loading