From befe016c4dd1141e41a21c9adeef59265ed14da9 Mon Sep 17 00:00:00 2001 From: "Mark S. Lewis" Date: Wed, 16 Jul 2025 17:23:28 +0100 Subject: [PATCH] Remove unused content Remove old (Azure Pipelines) build definitions and scripts, and Gradle build tasks. Signed-off-by: Mark S. Lewis --- build.gradle | 6 +- ci/azure-pipelines.yml | 228 ----------------------------- ci/publish_jar_nexus.sh | 33 ----- ci/templates/build-data.yml | 16 -- fabric-chaincode-shim/build.gradle | 2 +- scripts/changelog.sh | 22 --- scripts/gittag.sh | 35 ----- scripts/multiarch.sh | 81 ---------- scripts/verify-commit.sh | 48 ------ 9 files changed, 2 insertions(+), 469 deletions(-) delete mode 100644 ci/azure-pipelines.yml delete mode 100755 ci/publish_jar_nexus.sh delete mode 100644 ci/templates/build-data.yml delete mode 100755 scripts/changelog.sh delete mode 100755 scripts/gittag.sh delete mode 100755 scripts/multiarch.sh delete mode 100755 scripts/verify-commit.sh diff --git a/build.gradle b/build.gradle index 192a83cd5..b605ec4f9 100644 --- a/build.gradle +++ b/build.gradle @@ -85,12 +85,8 @@ subprojects { } } -task printVersionName() { - println rootProject.version -} - // Get the date in the reverse format for sorting -def getDate() { +static def getDate() { def date = new Date() def formattedDate = date.format('yyyyMMdd') return formattedDate diff --git a/ci/azure-pipelines.yml b/ci/azure-pipelines.yml deleted file mode 100644 index 57986c2d4..000000000 --- a/ci/azure-pipelines.yml +++ /dev/null @@ -1,228 +0,0 @@ -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -# fabric-chaincode-java azure pipeline configuration. -# -name: $(SourceBranchName)-$(Date:yyyyMMdd)$(Rev:.rrr) - -# Daily build for final quality -# cf https://crontab.guru/#0_23_*_*_* -schedules: - - cron: "0 10,12,14,16,23 * * *" - displayName: "Chaincode Java Nightly Driver" - branches: - include: - - main - -trigger: - branches: - include: - - "release-2.5" - tags: - include: - - "*" - -# These are custom defined variables, the pipeline one is currently used for the build scripts -# to know to produce tests results in XML format for Azure to consume, for developers -# this isn't set so command line output is given -# -# Chaincode_Java_Creds is the protected group of keys for publishing -# -variables: - - group: Chaincode_Java_Creds - - group: Github-PackageRegistry-Credentials - - group: JARSigningPublish - - name: component - value: fabric-chaincode-java - - name: pipeline - value: ci - - name: PUSH_VERSION - value: stable - - name: FABRIC_VERSION - value: 2.5-stable - -pool: - vmImage: "ubuntu-latest" - -# The stages and jobs, potential for rationalization and optimization -# Keeping it simple and explicit whilst we gain experience -# -stages: - - stage: Build_and_test - jobs: - - job: displayenv - steps: - - template: templates/build-data.yml - - job: main - steps: - - task: Gradle@2 - inputs: - workingDirectory: "" - gradleWrapperFile: "gradlew" - gradleOptions: "-Xmx3072m" - javaHomeOption: "JDKVersion" - jdkVersionOption: "1.8" - jdkArchitectureOption: "x64" - options: "-x javadoc -x :fabric-chaincode-integration-test:test" - publishJUnitResults: true - testResultsFiles: "$(System.DefaultWorkingDirectory)/**/TEST-*.xml" - tasks: "build" - - task: PublishBuildArtifacts@1 - condition: or(succeeded(), failed()) - inputs: - pathToPublish: fabric-chaincode-shim/build/reports/checkstyle/ - artifactName: checkstylereport - displayName: 'Checkstyle' - continueOnError: true - - task: PublishBuildArtifacts@1 - condition: or(succeeded(), failed()) - inputs: - pathToPublish: fabric-chaincode-shim/build/reports/jacoco/ - artifactName: coveragereport - displayName: 'JaCoCo Coverage' - continueOnError: true - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'JUnit' - testResultsFiles: 'fabric-chaincode-shim/build/reports/dependency-check-junit.xml' - mergeTestResults: true - failTaskOnFailedTests: false - testRunTitle: OWASP Dependency Check - displayName: 'Publish OWASP Dependency Check JUnit results' - - task: CopyFiles@2 - inputs: - contents: | - fabric-chaincode-shim/build/reports/dependency-check-*.* - targetFolder: $(Build.ArtifactStagingDirectory)/dependency-check - displayName: 'Collect OWASP Dependency Check results' - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: $(Build.ArtifactStagingDirectory)/dependency-check - artifactName: 'Dependency Check Report' - displayName: 'Publish full OWASP Dependency Check result' - - task: PublishCodeCoverageResults@1 - inputs: - summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/fabric-chaincode-shim/build/reports/jacoco/test/jacocoTestReport.xml" - # Copy the built artifacts to the staging directory, tgz, and the docker image - - script: | - set -ev - ./gradlew -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} publishShimJarPublicationToMavenLocal - tar -zcvf localmaven.tgz ${HOME}/.m2/repository/org/hyperledger - docker image save hyperledger/fabric-javaenv | gzip > $(Build.ArtifactStagingDirectory)/fabric-javaenv.tar.gz - displayName: 'Package tgz and docker image' - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: localmaven.tgz - artifactName: java-tgz - - task: PublishBuildArtifacts@1 - inputs: - pathToPublish: $(Build.ArtifactStagingDirectory)/fabric-javaenv.tar.gz - artifactName: javaenv-docker-image - - - job: javadoc - dependsOn: displayenv - variables: - ${{ if eq(variables['Build.SourceBranch'], 'refs/heads/main') }}: - javadoc_release: main - ${{ if ne(variables['Build.SourceBranch'], 'refs/heads/main') }}: - javadoc_release: $[format('release-{0}',dependencies.displayenv.outputs['BuildData.MINOR_PACKAGE_VERSION'])] - steps: - - script: ./gradlew javadoc - displayName: 'Build JavaDoc' - - script: | - if [ -d docs ]; then - mkdir gh-pages - cp -r docs/* gh-pages - fi - displayName: 'Copy gh-pages doc' - condition: eq(variables['Build.SourceBranch'], 'refs/heads/main') - - script: | - git fetch origin - git checkout -b gh-pages origin/gh-pages - mkdir -p $(javadoc_release)/api - rm -rf $(javadoc_release)/api/* - cp -r fabric-chaincode-shim/build/docs/javadoc/* $(javadoc_release)/api - - # if the gh-pages is present from the previous script, then copy across the files across. - if [ -d gh-pages ]; then - find . -maxdepth 1 ! \( -name [.]* -o -name 'gh-pages' -o -name 'main' -o -name 'release-*' \) -exec rm -rf {} \; - cp -r gh-pages/* . - rm -rf gh-pages - fi - displayName: 'Update gh-pages branch' - - script: | - git config --global user.email "hlfdev.azp@gmail.com" - git config --global user.name "Hyperledger Bot" - git add -A - git commit -m "Publishing GitHub Pages" - git push https://$(GITHUB-PAT)@github.com/hyperledger/fabric-chaincode-java.git gh-pages - displayName: 'Commit gh-pages changes' - condition: and(succeeded(),eq(variables['Build.Reason'], 'IndividualCI')) - - # As the next script is more complex and uses loops, run this discretely in a sh file - # Publishing step for git tags - - stage: Publish_tag - condition: and(succeeded('Build_and_test'), startsWith(variables['Build.SourceBranch'], 'refs/tags')) - jobs: - - job: docker_publish - steps: - - template: templates/build-data.yml - - task: DownloadPipelineArtifact@2 - inputs: - artifact: javaenv-docker-image - path: $(Build.SourcesDirectory)/build - - script: | - wget -qO "$PWD/manifest-tool" https://github.com/estesp/manifest-tool/releases/download/v1.0.0/manifest-tool-linux-amd64 - chmod +x ./manifest-tool - - docker image load --input build/fabric-javaenv.tar.gz - docker images - docker login ${DOCKER_REGISTRY_URL} --username=${DOCKER_REGISTRY_USERNAME} --password=${DOCKER_REGISTRY_PASSWORD} - echo "Logged in to docker registry" - # tag javaenv image to PACKAGE_VERSION - docker tag hyperledger/fabric-javaenv hyperledger/fabric-javaenv:amd64-$(BuildData.PACKAGE_VERSION) - # push javaenv to repository - docker push hyperledger/fabric-javaenv:amd64-$(BuildData.PACKAGE_VERSION) - ./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-javaenv:amd64-$(BuildData.PACKAGE_VERSION)" --target "hyperledger/fabric-javaenv:$(BuildData.PACKAGE_VERSION)" - ./manifest-tool push from-args --platforms linux/amd64 --template "hyperledger/fabric-javaenv:amd64-$(BuildData.PACKAGE_VERSION)" --target "hyperledger/fabric-javaenv:$(BuildData.MINOR_PACKAGE_VERSION)" - env: - DOCKER_REGISTRY_USERNAME: $(DockerHub-Username) - DOCKER_REGISTRY_PASSWORD: $(DockerHub-Password) - - job: jar_publish - steps: - - template: templates/build-data.yml - - task: DownloadSecureFile@1 - name: keyring - inputs: - secureFile: secring.gpg - - script: | - ./gradlew -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PossrhUsername=${OSSRH_USER} -PossrhPassword=${OSSRH_PASSWORD} publishAllPublicationsToReleaseRepository - ./gradlew -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PossrhUsername=${OSSRH_USER} -PossrhPassword=${OSSRH_PASSWORD} publishAllPublicationsToSnapshotRepository - env: - SIGNING_ID: $(JAR-Signing-Id) - SIGNING_PASSWORD: $(JAR-Signing-Password) - KEYRING_FILE: $(keyring.secureFilePath) - OSSRH_USER: $(OSSRH-User) - OSSRH_PASSWORD: $(OSSRH-Password) - - # will re-enable when we get a proper userid/password - # - stage: Publish_tag_nightly - # condition: and(succeeded('Build_and_test'), eq(variables['Build.Reason'], 'Schedule')) # only run on the scheduled builds - # jobs: - # - job: jar_publish - # steps: - # - template: templates/build-data.yml - # - task: DownloadSecureFile@1 - # name: keyring - # inputs: - # secureFile: secring.gpg - # - script: | - # ./gradlew -PNIGHTLY=true -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PartifactoryUsername=${ARTIFACTORY_USER} -PartifactoryhPassword=${ARTIFACTORY_PASSWORD} publishAllPublicationsToReleaseRepository - # ./gradlew -PNIGHTLY=true -Psigning.keyId=${SIGNING_ID} -Psigning.password=${SIGNING_PASSWORD} -Psigning.secretKeyRingFile=${KEYRING_FILE} -PartifactoryUsername=${ARTIFACTORY_USER} -PartifactoryhPassword=${ARTIFACTORY_PASSWORD} publishAllPublicationsToSnapshotRepository - # env: - # SIGNING_ID: $(JAR-Signing-Id) - # SIGNING_PASSWORD: $(JAR-Signing-Password) - # KEYRING_FILE: $(keyring.secureFilePath) - # ARTIFACTORY_USER: $(ARTIFACTORY-User) - # ARTIFACTORY_PASSWORD: $(ARTIFACTORY-Password) diff --git a/ci/publish_jar_nexus.sh b/ci/publish_jar_nexus.sh deleted file mode 100755 index 12ff7625d..000000000 --- a/ci/publish_jar_nexus.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# -# SPDX-License-Identifier: Apache-2.0 -# - -# Exit on first error, print all commands. -set -e -set -o pipefail -WORKSPACE="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" - -function abort { - echo "!! Exiting shell script" - echo "!!" "$1" - exit -1 -} - -for binary in shim; do -echo "Pushing fabric-chaincode-$binary.$PUSH_VERSION.jar to maven releases.." -cp $WORKSPACE/fabric-chaincode-$binary/build/libs/fabric-chaincode-$binary-$PUSH_VERSION.jar $WORKSPACE/fabric-chaincode-$binary/build/libs/fabric-chaincode-$binary.$PUSH_VERSION.jar -mvn org.apache.maven.plugins:maven-deploy-plugin:deploy-file \ - -DupdateReleaseInfo=true \ - -Dfile=$WORKSPACE/fabric-chaincode-$binary/build/libs/fabric-chaincode-$binary.$PUSH_VERSION.jar \ - -DpomFile=$WORKSPACE/fabric-chaincode-$binary/build/publications/"$binary"Jar/pom-default.xml \ - -DrepositoryId=hyperledger-releases \ - -Durl=https://nexus.hyperledger.org/content/repositories/releases/ \ - -DgroupId=org.hyperledger.fabric-chaincode-java \ - -Dversion=$PUSH_VERSION \ - -DartifactId=fabric-chaincode-$binary \ - -DgeneratePom=false \ - -DuniqueVersion=false \ - -Dpackaging=jar \ - -gs $GLOBAL_SETTINGS_FILE -s $SETTINGS_FILE -done \ No newline at end of file diff --git a/ci/templates/build-data.yml b/ci/templates/build-data.yml deleted file mode 100644 index ead7e0bcb..000000000 --- a/ci/templates/build-data.yml +++ /dev/null @@ -1,16 +0,0 @@ -steps: -- script: | - env | sort - java -version - # handle full version number - VERSION=$(./gradlew -q printVersionName | head -n 1 | cut -d'-' -f1) - VERSION=${VERSION// } - echo Current version in code is :${VERSION}: - echo "##vso[task.setvariable variable=PACKAGE_VERSION;isOutput=true]${VERSION}" - # handle minor version - MINOR_VERSION=$(echo $VERSION | sed 's/^\([0-9]\{1,\}\.[0-9]\{1,\}\)\..*/\1/') - MINOR_VERSION=${MINOR_VERSION// } - echo Current minor version in code is :${MINOR_VERSION}: - echo "##vso[task.setvariable variable=MINOR_PACKAGE_VERSION;isOutput=true]${MINOR_VERSION}" - name: BuildData - displayName: 'Build data' diff --git a/fabric-chaincode-shim/build.gradle b/fabric-chaincode-shim/build.gradle index 8cff266f8..afc91fa62 100644 --- a/fabric-chaincode-shim/build.gradle +++ b/fabric-chaincode-shim/build.gradle @@ -27,7 +27,7 @@ configurations { } } -tasks.withType(org.gradle.api.tasks.testing.Test) { +tasks.withType(Test).configureEach { systemProperty 'CORE_CHAINCODE_LOGGING_LEVEL', 'DEBUG' } diff --git a/scripts/changelog.sh b/scripts/changelog.sh deleted file mode 100755 index b74634c42..000000000 --- a/scripts/changelog.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# -set -ev - -PREVIOUS_TAG=$1 -NEW_VERSION=$2 - -: ${PREVIOUS_TAG:?} -: ${NEW_VERSION:?} - -echo "## ${NEW_VERSION}" >> CHANGELOG.new -echo "$(date)" >> CHANGELOG.new -echo "" >> CHANGELOG.new -git log ${PREVIOUS_TAG}..HEAD --oneline | grep -v Merge | sed -e "s/\[\{0,1\}\(FAB[^0-9]*-[0-9]*\)\]\{0,1\}/\[\1\](https:\/\/jira.hyperledger.org\/browse\/\1\)/" -e "s/\([0-9|a-z]*\)/* \[\1\](https:\/\/github.com\/hyperledger\/fabric-chaincode-java\/commit\/\1)/" >> CHANGELOG.new -echo "" >> CHANGELOG.new -cat CHANGELOG.md >> CHANGELOG.new -mv -f CHANGELOG.new CHANGELOG.md - diff --git a/scripts/gittag.sh b/scripts/gittag.sh deleted file mode 100755 index c41fd8062..000000000 --- a/scripts/gittag.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# -# SPDX-License-Identifier: Apache-2.0 -# - -# Exit on first error, print all commands. -set -e -set -o pipefail -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" - -# release name -RELEASE=release-1.4 - -function abort { - echo "!! Exiting shell script" - echo "!!" "$1" - exit -1 -} - -# Run printVersionName task in the root directory, grab the first line and remove anything after the version number -VERSION=$(cd ../ && ./gradlew -q printVersionName | head -n 1 | cut -d'-' -f1) - -echo New version string will be v${VERSION} - -# do the release notes for this new version exist? -if [[ -f "${DIR}/release_notes/v${VERSION}.txt" ]]; then - echo "Release notes exist, hope they make sense!" -else - abort "No releases notes under the file ${DIR}/release_notes/v${NEW_VERSION}.txt exist"; -fi - -git checkout "${RELEASE}" -git pull -git tag -a "v${VERSION}" `git log -n 1 --pretty=oneline | head -c7` -F release_notes/"v${VERSION}".txt -git push origin v${VERSION} HEAD:refs/heads/${RELEASE} \ No newline at end of file diff --git a/scripts/multiarch.sh b/scripts/multiarch.sh deleted file mode 100755 index 5795a46fd..000000000 --- a/scripts/multiarch.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh -# -# Copyright IBM Corp. All Rights Reserved. -# -# SPDX-License-Identifier: Apache-2.0 -# - -usage() { - echo "Usage: $0 " - echo " and credentials for the repository" - echo "ENV:" - echo " NS=$NS" - echo " VERSION=$VERSION" - echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION" - exit 1 -} - -missing() { - echo "Error: some image(s) missing from registry" - echo "ENV:" - echo " NS=$NS" - echo " VERSION=$VERSION" - echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION" - exit 1 -} - -failed() { - echo "Error: multiarch manifest push failed" - echo "ENV:" - echo " NS=$NS" - echo " VERSION=$VERSION" - echo " TWO_DIGIT_VERSION=$TWO_DIGIT_VERSION" - exit 1 -} - -USER=${1:-nobody} -PASSWORD=${2:-nohow} -NS=${NS:-hyperledger} -VERSION=${BASE_VERSION:-1.3.0} -TWO_DIGIT_VERSION=${TWO_DIGIT_VERSION:-1.3} - -if [ "$#" -ne 2 ]; then - usage -fi - -# verify that manifest-tool is installed and found on PATH -which manifest-tool -if [ "$?" -ne 0 ]; then - echo "manifest-tool not installed or not found on PATH" - exit 1 -fi - -IMAGES="fabric-javaenv" - -# check that all images have been published -for image in ${IMAGES}; do - docker pull ${NS}/${image}:amd64-${VERSION} || missing -done - -# push the multiarch manifest and tag with just $VERSION and 'latest' -for image in ${IMAGES}; do - manifest-tool --username ${USER} --password ${PASSWORD} push from-args\ - --platforms linux/amd64 --template "${NS}/${image}:ARCH-${VERSION}"\ - --target "${NS}/${image}:${VERSION}" -# manifest-tool --username ${USER} --password ${PASSWORD} push from-args\ -# --platforms linux/amd64 --template "${NS}/${image}:ARCH-${VERSION}"\ -# --target "${NS}/${image}:latest" - manifest-tool --username ${USER} --password ${PASSWORD} push from-args\ - --platforms linux/amd64 --template "${NS}/${image}:ARCH-${VERSION}"\ - --target "${NS}/${image}:${TWO_DIGIT_VERSION}" -done - -# test that manifest is working as expected -for image in ${IMAGES}; do - docker pull ${NS}/${image}:${VERSION} || failed - docker pull ${NS}/${image}:${TWO_DIGIT_VERSION} || failed -# docker pull ${NS}/${image}:latest || failed -done - -echo "Successfully pushed multiarch manifest" -exit 0 diff --git a/scripts/verify-commit.sh b/scripts/verify-commit.sh deleted file mode 100755 index 0fb1dcd8d..000000000 --- a/scripts/verify-commit.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -ue - -# -# SPDX-License-Identifier: Apache-2.0 -############################################################################## -# Copyright (c) 2018 IBM Corporation, The Linux Foundation and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License 2.0 -# which accompanies this distribution, and is available at -# https://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -# This script makes several basic commit message validations. -# This is with the purpose of keeping up with the aesthetics of our code. -# Verify if the commit message contains JIRA URLs. -# its-jira pluggin attempts to process jira links and breaks. - -set +ue # Temporarily ignore any errors - -set -o pipefail -echo "----> verify-commit.sh" - -if git rev-list --format=%B --max-count=1 HEAD | grep -io 'http[s]*://jira\..*' > /dev/null ; then - echo 'Error: Remove JIRA URLs from commit message' - echo 'Add jira references as: Issue: -, instead of URLs' - exit 1 -fi - -# Check for trailing white-space (tab or spaces) in any files that were changed -#commit_files=$(git diff-tree --name-only -r HEAD~2..HEAD) -commit_files=$(find ./fabric-chaincode-shim/src -name *.java) - -found_trailing=false -for filename in $commit_files; do - if [[ $(file -b $filename) == "ASCII text"* ]]; then - if egrep -q "\s$" $filename; then - found_trailing=true - echo "Error: Trailing white spaces found in file: $filename" - fi - fi -done - -#if $found_trailing; then -# echo "#### filename:line-num:line ####" -# egrep -n "\s$" $commit_files -# exit 1 -#fi \ No newline at end of file