Files
Chris Bono 6cc9cdde21 Update ivy version to 2.5.2 (#619)
- Updates `org.apache.ivy:ivy` to version 2.5.2 to fix
CVE-2022-46751

- Adds 2 CVEs to trivyignore due to `debezium-supplier`
transitive dependencies.
2025-01-24 10:09:49 -06:00

858 lines
38 KiB
YAML

name: 'Stream Applications - Common'
on:
workflow_call:
inputs:
branch:
type: string
required: false
default: 'main'
description: 'Version Tag'
verbose:
type: boolean
required: false
default: false
description: 'Verbose output'
mavenThreads:
type: string
required: false
default: '1'
description: 'Maven Thread Option. Examples 0.5C, 2'
enableSecurityScan:
type: boolean
required: false
default: true
description: 'Enable security scan with Trivy'
secrets:
DOCKERHUB_USERNAME:
DOCKERHUB_TOKEN:
TMC_API_TOKEN:
GCP_CRED_JSON:
ARTIFACTORY_USERNAME:
ARTIFACTORY_PASSWORD:
GH_ARC_APP_ID:
GH_ARC_INSTALLATION_ID:
GH_ARC_PRIVATE_KEY:
GH_ARC_PAT:
JF_ARTIFACTORY_SPRING:
env:
VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }}
BRANCH: ${{ inputs.branch }}
MAVEN_THREADS: ${{ inputs.mavenThreads }}
TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db,aquasec/trivy-db,ghcr.io/aquasecurity/trivy-db
TRIVY_JAVA_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-java-db,aquasec/trivy-java-db,ghcr.io/aquasecurity/trivy-java-db
jobs:
scan:
if: ${{ inputs.enableSecurityScan && github.repository == 'spring-cloud/stream-applications' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'fs'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
exit-code: 1
trivyignores: .trivyignore
- name: 'Scanned'
shell: bash
run: echo "::info ::Scanned"
parameters:
name: 'parameters - ${{ inputs.branch }}'
if: ${{ github.repository == 'spring-cloud/stream-applications' }}
runs-on: ubuntu-latest
steps:
- name: 'Configure: checkout stream-applications@${{ inputs.branch }}'
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: 'Configure: Ensure scripts are executable'
shell: bash
run: find . -type f -name "*.sh" -exec chmod a+x '{}' \;
- name: 'Configure: create streams applications matrix'
shell: bash
run: |
ROOT_DIR=$(realpath $PWD)
echo "::info ::getting build version params"
source $ROOT_DIR/get-build-version-params.sh
echo "BUILD_VERSION=$BUILD_VERSION" >> $GITHUB_ENV
echo "BUILD_VERSION_TYPE=$BUILD_VERSION_TYPE" >> $GITHUB_ENV
echo "CUR_VERSION=$CUR_VERSION" >> $GITHUB_ENV
echo "IS_VERSION_CHANGE=$IS_VERSION_CHANGE" >> $GITHUB_ENV
echo "NEXT_DEV_VERSION=$NEXT_DEV_VERSION" >> $GITHUB_ENV
echo "RELEASE_TRAIN_VERSION=$RELEASE_TRAIN_VERSION" >> $GITHUB_ENV
echo "RELEASE_TRAIN_NEXT_DEV_VERSION=$RELEASE_TRAIN_NEXT_DEV_VERSION" >> $GITHUB_ENV
echo "BUILD_NAME=cloud-stream-applications-$BRANCH" >> $GITHUB_ENV
echo "BUILD_NUMBER=$GITHUB_RUN_NUMBER" >> $GITHUB_ENV
echo "::info ::creating streams applications matrix"
$ROOT_DIR/create-matrices.sh
if [ ! -f matrix.json ]; then
echo "Expected to find matrix.json in:"
ls -al
exit 2
fi
COUNT=$(jq '.count' matrix.json)
MAX_PARALLEL=$((5 * COUNT / 4))
if ((MAX_PARALLEL == COUNT)); then
MAX_PARALLEL=$((COUNT + 1))
fi
MATRIX=$(jq -c . matrix.json)
PROCESSORS=$(jq -c '.processors' matrix.json)
SINKS=$(jq -c '.sinks' matrix.json)
SOURCES=$(jq -c '.sources' matrix.json)
echo "MAX_PARALLEL=$MAX_PARALLEL" >> $GITHUB_ENV
echo "MATRIX=$MATRIX" >> $GITHUB_ENV
echo "PROCESSORS=$PROCESSORS" >> $GITHUB_ENV
echo "SINKS=$SINKS" >> $GITHUB_ENV
echo "SOURCES=$SOURCES" >> $GITHUB_ENV
if [[ "${{ inputs.branch }}" == *"2021"* ]]; then
echo "JDK_BUILD=8" >> $GITHUB_ENV
echo "JRE_DEFAULT=11" >> $GITHUB_ENV
else
echo "JDK_BUILD=17" >> $GITHUB_ENV
echo "JRE_DEFAULT=17" >> $GITHUB_ENV
fi
if [ "${{ inputs.verbose }}" == "true" ]; then
echo "::debug ::MAX_PARALLEL=$MAX_PARALLEL"
echo "::debug ::MATRIX=$MATRIX"
echo "::debug ::PROCESSORS=$PROCESSORS"
echo "::debug ::SINKS=$SINKS"
echo "::debug ::SOURCES=$SOURCES"
echo "::debug ::BUILD_VERSION=$BUILD_VERSION"
echo "::debug ::RELEASE_TRAIN_VERSION=$RELEASE_TRAIN_VERSION"
echo "::debug ::BUILD_VERSION_TYPE=$BUILD_VERSION_TYPE"
echo "::debug ::CUR_VERSION=$CUR_VERSION"
echo "::debug ::IS_VERSION_CHANGE=$IS_VERSION_CHANGE"
echo "::debug ::NEXT_DEV_VERSION=$NEXT_DEV_VERSION"
echo "::debug ::RELEASE_TRAIN_NEXT_DEV_VERSION=$RELEASE_TRAIN_NEXT_DEV_VERSION"
echo "::debug ::JDK_BUILD=$JDK_BUILD"
echo "::debug ::JRE_DEFAULT=$JRE_DEFAULT"
fi
- name: Print Build Info
run: |
echo "::notice ::BUILD_NAME=$BUILD_NAME"
echo "::notice ::BUILD_NUMBER=$BUILD_NUMBER"
outputs:
max_parallel: ${{ env.MAX_PARALLEL }}
sources: ${{ env.SOURCES }}
sinks: ${{ env.SINKS }}
processors: ${{ env.PROCESSORS }}
matrix: ${{ env.matrix }}
build_version: ${{ env.BUILD_VERSION }}
release_train_version: ${{ env.RELEASE_TRAIN_VERSION }}
build_version_type: ${{ env.BUILD_VERSION_TYPE }}
is_version_change: ${{ env.IS_VERSION_CHANGE }}
next_dev_version: ${{ env.NEXT_DEV_VERSION }}
release_train_next_dev_version: ${{ env.RELEASE_TRAIN_NEXT_DEV_VERSION }}
jdk_build: ${{ env.JDK_BUILD }}
jre_version: ${{ env.JRE_DEFAULT }}
build_name: ${{ env.BUILD_NAME }}
build_number: ${{ env.BUILD_NUMBER }}
core:
name: 'core - ${{ inputs.branch }}'
if: ${{ github.repository == 'spring-cloud/stream-applications' }}
runs-on: ubuntu-latest
needs:
- parameters
steps:
- name: 'Configure: checkout stream-applications@main'
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: 'Configure: Ensure scripts are executable'
shell: bash
run: find . -type f -name "*.sh" -exec chmod a+x '{}' \;
- name: 'Configure: Install Java'
uses: actions/setup-java@v4
with:
java-version: ${{ needs.parameters.outputs.jdk_build }}
distribution: 'liberica'
- name: 'Configure: cache for maven dependencies'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: maven-repo-${{ hashFiles('**/pom.xml') }}-8-single-${{ inputs.branch }}
restore-keys: |
maven-repo-${{ hashFiles('**/pom.xml') }}-8-${{ inputs.branch }}
maven-repo-${{ hashFiles('**/pom.xml') }}-${{ inputs.branch }}
maven-repo-${{ inputs.branch }}
- name: 'Configure: Install xsltproc'
uses: ./.github/actions/install-xsltproc
- name: 'Configure: Install gh cli'
uses: ./.github/actions/install-gh
- uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: 'https://repo.spring.io'
JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
- name: Configure JFrog Cli
shell: bash
run: |
./configure-jfrog.sh ${{ needs.parameters.outputs.build_version_type }}
echo JFROG_CLI_BUILD_NAME=stream-apps-main-release >> $GITHUB_ENV
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
- name: 'Action: update version'
if: ${{ needs.parameters.outputs.is_version_change == 'true' }}
shell: bash
env:
VERBOSE: ${{ (github.debug || inputs.verbose) && '-X' || '' }}
run: |
ROOT_DIR=$(realpath $PWD)
echo "::notice ::updating versions to ${{ needs.parameters.outputs.build_version }} / ${{ needs.parameters.outputs.release_train_version }}"
$ROOT_DIR/update-project-version.sh "${{ needs.parameters.outputs.build_version }}" "${{ needs.parameters.outputs.release_train_version }}"
echo "::notice ::checking updated versions"
set +e
MESSAGE=$($ROOT_DIR/check-versions-for-release.sh ${{ needs.parameters.outputs.build_version_type }})
RC=$?
if ((RC!=0)); then
echo "::error ::$MESSAGE"
exit $RC
else
echo "::info ::$MESSAGE"
fi
- name: 'Action: build initial dependencies'
shell: bash
timeout-minutes: 60
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
BUILD_NAME: ${{ needs.parameters.outputs.build_name }}
BUILD_NUMBER: ${{ needs.parameters.outputs.build_number }}
VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }}
MAVEN_THREADS: ${{ inputs.mavenThreads }}
BUILD_VERSION_TYPE: ${{ needs.parameters.outputs.build_version_type }}
run: |
ROOT_DIR=$(realpath $PWD)
echo "::notice ::building - stream-applications-build,functions,applications/stream-applications-core"
set -e
$ROOT_DIR/build-core.sh "install -DskipTests"
export MAVEN_THREADS=false
$ROOT_DIR/build-core.sh "verify deploy"
set +e
echo "::notice ::core build completed"
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Unit Tests - Core
path: '**/surefire-reports/*.xml'
fail-on-empty: false
reporter: java-junit
- name: Integration Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Integration Tests - Core
path: '**/failsafe-reports/*.xml'
reporter: java-junit
fail-on-empty: false
- name: 'Upload: Test Reports'
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: 'core-surefire-reports'
path: 'stream-applications/**/target/surefire-reports'
retention-days: 7
if-no-files-found: ignore
processors:
if: ${{ github.repository == 'spring-cloud/stream-applications' && needs.parameters.outputs.processors != '' && needs.parameters.outputs.processors != null }}
needs:
- core
- parameters
strategy:
fail-fast: false
matrix:
app: ${{ fromJson(needs.parameters.outputs.processors) }}
runs-on: ubuntu-latest
steps:
- name: 'Configure: checkout stream-applications'
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Ensure scripts are executable
shell: bash
run: find . -type f -name "*.sh" -exec chmod a+x '{}' \;
- name: 'Configure: Install Java'
uses: actions/setup-java@v4
with:
java-version: ${{ needs.parameters.outputs.jdk_build }}
distribution: 'liberica'
- name: 'Configure: cache for maven dependencies'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: maven-repo-${{ hashFiles('**/pom.xml') }}-8-single-${{ inputs.branch }}
restore-keys: |
maven-repo-${{ hashFiles('**/pom.xml') }}-8-${{ inputs.branch }}
maven-repo-${{ hashFiles('**/pom.xml') }}-${{ inputs.branch }}
maven-repo-${{ inputs.branch }}
- name: 'Configure: Install xsltproc'
uses: ./.github/actions/install-xsltproc
- name: 'Configure: Install Pack'
uses: ./.github/actions/install-pack
- name: 'Configure: Check Docker Credentials'
shell: bash
run: |
if [ "${{ secrets.DOCKERHUB_USERNAME }}" = "" ]; then
echo "Expected DOCKERHUB_USERNAME"
exit 2
fi
if [ "${{ secrets.DOCKERHUB_TOKEN }}" = "" ]; then
echo "Expected DOCKERHUB_TOKEN"
exit 2
fi
- name: 'Action: update version'
if: ${{ needs.parameters.outputs.is_version_change == 'true' }}
shell: bash
env:
VERBOSE: ${{ (github.debug || inputs.verbose) && '-X' || '' }}
run: |
ROOT_DIR=$(realpath $PWD)
echo "::notice ::updating versions to ${{ needs.parameters.outputs.build_version }} / ${{ needs.parameters.outputs.release_train_version }}"
$ROOT_DIR/update-project-version.sh "${{ needs.parameters.outputs.build_version }}" "${{ needs.parameters.outputs.release_train_version }}"
echo "::notice ::checking updated versions"
set +e
MESSAGE=$($ROOT_DIR/check-versions-for-release.sh ${{ needs.parameters.outputs.build_version_type }})
RC=$?
if ((RC!=0)); then
echo "::error ::$MESSAGE"
exit $RC
else
echo "::info ::$MESSAGE"
fi
- name: 'Configure: Docker login'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: 'https://repo.spring.io'
JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
- name: Configure JFrog Cli
shell: bash
run: |
./configure-jfrog.sh ${{ needs.parameters.outputs.build_version_type }}
echo JFROG_CLI_BUILD_NAME=stream-apps-main-release >> $GITHUB_ENV
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
- name: 'Build: ${{ matrix.app }}'
shell: bash
timeout-minutes: 30
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
BUILD_NAME: ${{ needs.parameters.outputs.build_name }}
BUILD_NUMBER: ${{ needs.parameters.outputs.build_number }}
DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }}
VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }}
MAVEN_THREADS: ${{ inputs.mavenThreads }}
BUILD_VERSION_TYPE: ${{ needs.parameters.outputs.build_version_type }}
run: ./build-app.sh . "applications/processor/${{ matrix.app }}"
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Unit Tests - Processors - ${{ matrix.app }}
path: '**/surefire-reports/*.xml'
fail-on-empty: false
reporter: java-junit
- name: Integration Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Integration Tests - Processors - ${{ matrix.app }}
path: '**/failsafe-reports/*.xml'
reporter: java-junit
fail-on-empty: false
- name: 'Upload: Test Reports'
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: '${{ matrix.app }}-surefire-reports'
path: '**/target/surefire-reports'
retention-days: 7
if-no-files-found: ignore
- name: 'Publish: ${{ matrix.app }}'
shell: bash
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }}
run: ./publish-app.sh . "applications/processor/${{ matrix.app }}"
sinks:
if: ${{ github.repository == 'spring-cloud/stream-applications' && needs.parameters.outputs.sinks != '' && needs.parameters.outputs.sinks != null }}
needs:
- core
- parameters
strategy:
fail-fast: false
matrix:
app: ${{ fromJson(needs.parameters.outputs.sinks) }}
runs-on: ubuntu-latest
steps:
- name: 'Configure: checkout stream-applications'
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Ensure scripts are executable
shell: bash
run: find . -type f -name "*.sh" -exec chmod a+x '{}' \;
- name: 'Configure: Install Java'
uses: actions/setup-java@v4
with:
java-version: ${{ needs.parameters.outputs.jdk_build }}
distribution: 'liberica'
- name: 'Configure: cache for maven dependencies'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: maven-repo-${{ hashFiles('**/pom.xml') }}-8-single-${{ inputs.branch }}
restore-keys: |
maven-repo-${{ hashFiles('**/pom.xml') }}-8-${{ inputs.branch }}
maven-repo-${{ hashFiles('**/pom.xml') }}-${{ inputs.branch }}
maven-repo-${{ inputs.branch }}
- name: 'Configure: Install xsltproc'
uses: ./.github/actions/install-xsltproc
- name: 'Configure: Install Pack'
uses: ./.github/actions/install-pack
- name: 'Action: update version'
if: ${{ needs.parameters.outputs.is_version_change == 'true' }}
shell: bash
env:
VERBOSE: ${{ (github.debug || inputs.verbose) && '-X' || '' }}
run: |
ROOT_DIR=$(realpath $PWD)
echo "::notice ::updating versions to ${{ needs.parameters.outputs.build_version }} / ${{ needs.parameters.outputs.release_train_version }}"
$ROOT_DIR/update-project-version.sh "${{ needs.parameters.outputs.build_version }}" "${{ needs.parameters.outputs.release_train_version }}"
echo "::notice ::checking updated versions"
set +e
MESSAGE=$($ROOT_DIR/check-versions-for-release.sh ${{ needs.parameters.outputs.build_version_type }})
RC=$?
if ((RC!=0)); then
echo "::error ::$MESSAGE"
exit $RC
else
echo "::info ::$MESSAGE"
fi
- name: 'Configure: Docker login'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: 'https://repo.spring.io'
JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
- name: Configure JFrog Cli
shell: bash
run: |
./configure-jfrog.sh ${{ needs.parameters.outputs.build_version_type }}
echo JFROG_CLI_BUILD_NAME=stream-apps-main-release >> $GITHUB_ENV
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
- name: 'Build: ${{ matrix.app }}'
shell: bash
timeout-minutes: 30
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
BUILD_NAME: ${{ needs.parameters.outputs.build_name }}
BUILD_NUMBER: ${{ needs.parameters.outputs.build_number }}
DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }}
VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }}
MAVEN_THREADS: ${{ inputs.mavenThreads }}
BUILD_VERSION_TYPE: ${{ needs.parameters.outputs.build_version_type }}
run: ./build-app.sh . "applications/sink/${{ matrix.app }}"
- name: 'Upload: Test Reports'
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: '${{ matrix.app }}-surefire-reports'
path: '**/target/surefire-reports'
retention-days: 7
if-no-files-found: ignore
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Unit Tests - Sinks - ${{ matrix.app }}
path: '**/surefire-reports/*.xml'
fail-on-empty: false
reporter: java-junit
- name: Integration Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Integration Tests - Sinks - ${{ matrix.app }}
path: '**/failsafe-reports/*.xml'
reporter: java-junit
fail-on-empty: false
- name: 'Publish: ${{ matrix.app }}'
shell: bash
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }}
run: ./publish-app.sh . "applications/sink/${{ matrix.app }}"
sources:
if: ${{ github.repository == 'spring-cloud/stream-applications' && needs.parameters.outputs.sources != '' && needs.parameters.outputs.sources != null }}
runs-on: ubuntu-latest
needs:
- core
- parameters
strategy:
fail-fast: false
# will be removed when private runners are used.
matrix:
app: ${{ fromJson(needs.parameters.outputs.sources) }}
steps:
- name: 'Configure: checkout stream-applications'
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Ensure scripts are executable
shell: bash
run: find . -type f -name "*.sh" -exec chmod a+x '{}' \;
- name: 'Configure: Install Java'
if: ${{ needs.parameters.outputs.jdk_build == '8' }}
uses: actions/setup-java@v1
with:
java-version: ${{ needs.parameters.outputs.jdk_build }}
- name: 'Configure: Install GraalVM'
if: ${{ needs.parameters.outputs.jdk_build != '8' }}
uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: ${{ needs.parameters.outputs.jdk_build }}
components: 'js'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Configure: cache for maven dependencies'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: maven-repo-${{ hashFiles('**/pom.xml') }}-8-single-${{ inputs.branch }}
restore-keys: |
maven-repo-${{ hashFiles('**/pom.xml') }}-8-${{ inputs.branch }}
maven-repo-${{ hashFiles('**/pom.xml') }}-${{ inputs.branch }}
maven-repo-${{ inputs.branch }}
- name: 'Configure: Install xsltproc'
uses: ./.github/actions/install-xsltproc
- name: 'Configure: Install Pack'
uses: ./.github/actions/install-pack
- name: 'Action: update version'
if: ${{ needs.parameters.outputs.is_version_change == 'true' }}
shell: bash
env:
VERBOSE: ${{ (github.debug || inputs.verbose) && '-X' || '' }}
run: |
ROOT_DIR=$(realpath $PWD)
echo "::notice ::updating versions to ${{ needs.parameters.outputs.build_version }} / ${{ needs.parameters.outputs.release_train_version }}"
$ROOT_DIR/update-project-version.sh "${{ needs.parameters.outputs.build_version }}" "${{ needs.parameters.outputs.release_train_version }}"
echo "::notice ::checking updated versions"
set +e
MESSAGE=$($ROOT_DIR/check-versions-for-release.sh ${{ needs.parameters.outputs.build_version_type }})
RC=$?
if ((RC!=0)); then
echo "::error ::$MESSAGE"
exit $RC
else
echo "::info ::$MESSAGE"
fi
- name: 'Configure: Docker login'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: 'https://repo.spring.io'
JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
- name: Configure JFrog Cli
shell: bash
run: |
./configure-jfrog.sh ${{ needs.parameters.outputs.build_version_type }}
echo JFROG_CLI_BUILD_NAME=stream-apps-main-release >> $GITHUB_ENV
echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV
- name: 'Build: ${{ matrix.app }}'
shell: bash
timeout-minutes: 30
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
BUILD_NAME: ${{ needs.parameters.outputs.build_name }}
BUILD_NUMBER: ${{ needs.parameters.outputs.build_number }}
DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }}
VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }}
MAVEN_THREADS: ${{ inputs.mavenThreads }}
BUILD_VERSION_TYPE: ${{ needs.parameters.outputs.build_version_type }}
run: ./build-app.sh . "applications/source/${{ matrix.app }}"
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Unit Tests - Sources - ${{ matrix.app }}
path: '**/surefire-reports/*.xml'
fail-on-empty: false
reporter: java-junit
- name: Integration Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Integration Tests - Sources - ${{ matrix.app }}
path: '**/failsafe-reports/*.xml'
reporter: java-junit
fail-on-empty: false
- name: 'Upload: Test Reports'
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: '${{ matrix.app }}-surefire-reports'
path: '**/target/surefire-reports'
retention-days: 7
if-no-files-found: ignore
- name: 'Publish: ${{ matrix.app }}'
shell: bash
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }}
run: ./publish-app.sh . "applications/source/${{ matrix.app }}"
release-train:
if: ${{ github.repository == 'spring-cloud/stream-applications' }}
needs:
- core
- sinks
- sources
- processors
- parameters
runs-on: ubuntu-latest
steps:
- name: 'Configure: checkout stream-applications'
uses: actions/checkout@v3
with:
ref: ${{ inputs.branch }}
- name: Ensure scripts are executable
shell: bash
run: find . -type f -name "*.sh" -exec chmod a+x '{}' \;
- name: 'Configure: Install Java'
if: ${{ needs.parameters.outputs.jdk_build == '8' }}
uses: actions/setup-java@v1
with:
java-version: ${{ needs.parameters.outputs.jdk_build }}
- name: 'Configure: Install GraalVM'
if: ${{ needs.parameters.outputs.jdk_build != '8' }}
uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: ${{ needs.parameters.outputs.jdk_build }}
components: 'js'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: 'Configure: cache for maven dependencies'
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: maven-repo-${{ hashFiles('**/pom.xml') }}-8-single-${{ inputs.branch }}
restore-keys: |
maven-repo-${{ hashFiles('**/pom.xml') }}-8-${{ inputs.branch }}
maven-repo-${{ hashFiles('**/pom.xml') }}-${{ inputs.branch }}
maven-repo-${{ inputs.branch }}
- name: 'Configure: Install Pack'
uses: ./.github/actions/install-pack
- name: 'Action: update version'
if: ${{ needs.parameters.outputs.is_version_change == 'true' }}
shell: bash
env:
VERBOSE: ${{ (github.debug || inputs.verbose) && '-X' || '' }}
run: |
ROOT_DIR=$(realpath $PWD)
echo "::notice ::updating versions to ${{ needs.parameters.outputs.build_version }} / ${{ needs.parameters.outputs.release_train_version }}"
$ROOT_DIR/update-project-version.sh "${{ needs.parameters.outputs.build_version }}" "${{ needs.parameters.outputs.release_train_version }}"
echo "::notice ::checking updated versions"
set +e
MESSAGE=$($ROOT_DIR/check-versions-for-release.sh ${{ needs.parameters.outputs.build_version_type }})
RC=$?
if ((RC!=0)); then
echo "::error ::$MESSAGE"
exit $RC
else
echo "::info ::$MESSAGE"
fi
- uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: 'https://repo.spring.io'
JF_ARTIFACTORY_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
- name: Configure JFrog Cli
shell: bash
env:
JF_SERVER_ID: ${{ vars.JF_SERVER_ID }}
run: |
./configure-jfrog.sh ${{ needs.parameters.outputs.build_version_type }}
echo JFROG_CLI_BUILD_NAME=${{ needs.parameters.outputs.build_name }} >> $GITHUB_ENV
echo JFROG_CLI_BUILD_NUMBER=${{ needs.parameters.outputs.build_number }} >> $GITHUB_ENV
- name: Print Build Info
run: |
echo "::notice ::JFROG_CLI_BUILD_NAME=$JFROG_CLI_BUILD_NAME"
echo "::notice ::JFROG_CLI_BUILD_NUMBER=$JFROG_CLI_BUILD_NUMBER"
- name: 'Build: stream-applications-release-train'
shell: bash
timeout-minutes: 30
env:
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
BUILD_NAME: ${{ needs.parameters.outputs.build_name }}
BUILD_NUMBER: ${{ needs.parameters.outputs.build_number }}
DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }}
VERBOSE: ${{ (github.debug || inputs.verbose) && 'true' || '' }}
MAVEN_THREADS: ${{ inputs.mavenThreads }}
BUILD_VERSION_TYPE: ${{ needs.parameters.outputs.build_version_type }}
run: |
ROOT_DIR=$(realpath $PWD)
echo "::notice ::building - stream-applications-release-train"
set -e
VERSION=${{ needs.parameters.outputs.build_version }} $ROOT_DIR/build-folder.sh stream-applications-release-train "install deploy"
- name: 'Configure: Install libxml2-utils'
uses: ./.github/actions/install-libxml2-utils
- name: Upload descriptors
if: ${{ needs.parameters.outputs.build_version_type == 'snapshot' }}
shell: bash
env:
RELEASE_TRAIN_VERSION: ${{ needs.parameters.outputs.release_train_version }}
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
BUILD_NAME: ${{ needs.parameters.outputs.build_name }}
BUILD_NUMBER: ${{ needs.parameters.outputs.build_number }}
run: |
ROOT_DIR=$(realpath $PWD)
echo "::notice ::uploading unique version snapshot descriptors:$RELEASE_TRAIN_VERSION"
set -e
SRC_ROOT=./stream-applications-release-train/stream-applications-descriptor/target/classes/META-INF
TARGET_REPO=libs-snapshot-local/org/springframework/cloud/stream/app/stream-applications-descriptor/${RELEASE_TRAIN_VERSION}
jfrog rt upload "$SRC_ROOT/kafka-apps-maven.properties" "${TARGET_REPO}/stream-applications-descriptor-${RELEASE_TRAIN_VERSION}.stream-apps-kafka-maven"
jfrog rt upload "$SRC_ROOT/kafka-apps-docker.properties" "${TARGET_REPO}/stream-applications-descriptor-${RELEASE_TRAIN_VERSION}.stream-apps-kafka-docker"
jfrog rt upload "$SRC_ROOT/kafka-apps-harbor.properties" "${TARGET_REPO}/stream-applications-descriptor-${RELEASE_TRAIN_VERSION}.stream-apps-kafka-harbor"
jfrog rt upload "$SRC_ROOT/rabbit-apps-maven.properties" "${TARGET_REPO}/stream-applications-descriptor-${RELEASE_TRAIN_VERSION}.stream-apps-rabbit-maven"
jfrog rt upload "$SRC_ROOT/rabbit-apps-docker.properties" "${TARGET_REPO}/stream-applications-descriptor-${RELEASE_TRAIN_VERSION}.stream-apps-rabbit-docker"
jfrog rt upload "$SRC_ROOT/rabbit-apps-harbor.properties" "${TARGET_REPO}/stream-applications-descriptor-${RELEASE_TRAIN_VERSION}.stream-apps-rabbit-harbor"
jfrog rt upload "$SRC_ROOT/kafka-apps-maven-repo-url.properties" "${TARGET_REPO}/stream-applications-descriptor-${RELEASE_TRAIN_VERSION}.kafka-apps-maven-repo-url.properties"
jfrog rt upload "$SRC_ROOT/rabbit-apps-maven-repo-url.properties" "${TARGET_REPO}/stream-applications-descriptor-${RELEASE_TRAIN_VERSION}.rabbit-apps-maven-repo-url.properties"
- name: Set Stream Applications Docs Properties for ${{ needs.parameters.outputs.release_train_version }}
run: |
./set-doc-properties.sh "${{ needs.parameters.outputs.release_train_version }}"
echo "::notice ::stream-applications-release-train build completed"
- name: Unit Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Unit Tests - Release Train
path: '**/surefire-reports/*.xml'
fail-on-empty: false
reporter: java-junit
- name: Integration Test Report
uses: dorny/test-reporter@v1
if: ${{ success() || failure() }}
with:
name: Integration Tests - Release Train
path: '**/failsafe-reports/*.xml'
reporter: java-junit
fail-on-empty: false
- name: 'Upload: Test Reports'
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: '${{ matrix.app }}-surefire-reports'
path: '**/target/surefire-reports'
retention-days: 7
if-no-files-found: ignore
- name: Tag Release
if: ${{ needs.parameters.outputs.is_version_change == 'true' }}
shell: bash
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git commit -a -m "Release ${{ needs.parameters.outputs.build_version }} / ${{ needs.parameters.outputs.release_train_version }}"
git tag "v${{ needs.parameters.outputs.build_version }}"
git tag "v${{ needs.parameters.outputs.release_train_version }}"
git push --tags -v origin
- name: Install tooling for Github release
if: ${{ needs.parameters.outputs.is_version_change == 'true' }}
run: |
curl -sSL https://github.com/cbroglie/mustache/releases/download/v1.2.2/mustache_1.2.2_linux_amd64.tar.gz | sudo tar -C /usr/local/bin/ --no-same-owner -xzv mustache
- name: Create Github release
if: ${{ needs.parameters.outputs.is_version_change == 'true' }}
env:
RELEASE_NOTES_ISSUES: ${{runner.temp}}/release_notes_issues.json
RELEASE_NOTES_FILE: ${{runner.temp}}/release_notes.md5
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TRAIN_VERSION: ${{ needs.parameters.outputs.release_train_version }}
run: |
gh issue list \
--repo spring-cloud/stream-applications \
--state all --json number,title,labels \
--search milestone:$VERSION \
--jq '{issues:map(select((.labels | length == 0) or (any(.labels[].name; startswith("automation/rlnotes")|not))) + {repo:"spring-cloud/stream-applications"})}' \
> $RELEASE_NOTES_ISSUES
mustache $RELEASE_NOTES_ISSUES .github/rlnotes.mustache > $RELEASE_NOTES_FILE
gh release create v$RELEASE_TRAIN_VERSION \
--draft \
--title "Spring Cloud Stream Applications $RELEASE_TRAIN_VERSION" \
--generate-notes \
--notes-file $RELEASE_NOTES_FILE
- name: 'Action: update next dev version'
if: ${{ needs.parameters.outputs.is_version_change == 'true' }}
shell: bash
env:
VERBOSE: ${{ (github.debug || inputs.verbose) && '-X' || '' }}
run: |
ROOT_DIR=$(realpath $PWD)
git config user.name "GitHub Actions Bot"
git config user.email "<>"
echo "::notice ::updating next dev versions to ${{ needs.parameters.outputs.next_dev_version }} / ${{ needs.parameters.outputs.release_train_next_dev_version }}"
$ROOT_DIR/update-project-version.sh "${{ needs.parameters.outputs.next_dev_version }}" "${{ needs.parameters.outputs.release_train_next_dev_version }}"
echo "::notice ::setting released version to next dev version ${{ needs.parameters.outputs.next_dev_version }} / ${{ needs.parameters.outputs.release_train_next_dev_version }}"
./next-dev-version.sh
git commit -a -m "Next development version ${{ needs.parameters.outputs.next_dev_version }} / ${{ needs.parameters.outputs.release_train_next_dev_version }}"
git push -v origin
- name: 'Start Integration Tests for ${{ needs.parameters.outputs.build_version }}'
if: ${{ success() }}
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh workflow run ci-it.yml -f version=${{ needs.parameters.outputs.build_version }}
rerun-jobs:
if: ${{ failure() && github.run_attempt == '1' }}
runs-on: ubuntu-latest
needs:
- scan
- sources
- processors
- sinks
- release-train
steps:
- name: 'Configure: Checkout stream-applications'
uses: actions/checkout@v3
- name: 'Configure: Install gh cli'
uses: ./.github/actions/install-gh
- name: 'Action: Re-run ${{ github.workflow }}'
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set +e
FAILURES=$(gh run view ${{ github.run_id }} -v | grep "^X")
for msg in $FAILURES; do
echo "$msg"
done
COUNT_TESTS=$(echo "$FAILURES" | grep -c -F "tests ")
if((COUNT_TESTS > 0)); then
echo "::warn ::${COUNT_TESTS} modules failed. Re-run ${{ github.workflow }} run ${{ github.run_id }}"
gh run rerun ${{ github.run_id }} --failed --debug
else
echo "Checked ${{ github.workflow }} run ${{ github.run_id }}. No failures in tests jobs:"
fi