Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ee4j-build] Staging profile id?

Hi Vinay,

This is the script:

First part:

 #!/bin/bash -e
 
 gpg --batch --import ${KEYRING}
 for fpr in $(gpg --list-keys --with-colons  | awk -F: '/fpr:/ {print $10}' | sort -u);
 do
   echo -e "5\ny\n" |  gpg --batch --command-fd 0 --expert --edit-key $fpr trust;
 done


Second part:

#!/bin/bash -ex

TOOLS_PREFIX='/opt/tools'
JAVA_PREFIX="${TOOLS_PREFIX}/java/oracle"
MVN_HOME="${TOOLS_PREFIX}/apache-maven/latest"
JAVA_HOME="${JAVA_PREFIX}/jdk-8/latest"
PATH="${MVN_HOME}/bin:${JAVA_HOME}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Maven plugins
VERSIONS_PLUGIN='org.codehaus.mojo:versions-maven-plugin:2.5'
HELP_PLUGIN='org.apache.maven.plugins:maven-help-plugin:2.1.1'

# Directory with project top level pom.xml
BUILD_DIR="${WORKSPACE}"

cd ${BUILD_DIR}
# Check whether top level pom.xml contains SNAPSHOT version
if ! grep '<version>' pom.xml | grep 'SNAPSHOT' ; then
  echo '-[ Missing SNAPSHOT version in POM! ]-------------------------------------------'
  exit 1
fi

TEST_MVN=`mvn -version`

echo "Maven version: ${TEST_MVN}"

echo " "

echo "Compute release versions"

PROJECT_VERSION=`mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.version`

echo "Project version: ${PROJECT_VERSION}"

echo "\n"

# Compute release versions
SNAPSHOT_VERSION=`mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.version 2> /dev/null | grep -E '^[0-9]+(\.[0-9]+)+-SNAPSHOT$'`



if [ -z "${RELEASE_VERSION}" ]; then
  if [ -z ${SNAPSHOT_VERSION} ]; then
    echo '-[ Missing required snapshot version number! ]----------------------------------'
  fi
  RELEASE_VERSION=`echo ${SNAPSHOT_VERSION} | sed -e 's/-SNAPSHOT//'`
fi

# Bash specific code
if [ -z "${NEXT_VERSION}" ]; then
  NEXT_VERSION=`echo ${RELEASE_VERSION} | sed -e 's/\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/'`
  set -f
  NEXT_COMPONENTS=(${RELEASE_VERSION//\./ })
  LAST_INDEX=$((${#NEXT_COMPONENTS[@]} - 1))
  NEXT_COMPONENTS[${LAST_INDEX}]=$((${NEXT_COMPONENTS[${LAST_INDEX}]} + 1))
  NEXT_VERSION=`echo ${NEXT_COMPONENTS[@]} | tr ' ' '.'`'-SNAPSHOT'
fi

RELEASE_TAG="${RELEASE_VERSION}-RELEASE"

echo "Current version: ${SNAPSHOT_VERSION}"
echo "Release version: ${RELEASE_VERSION}"
echo "Next version:    ${NEXT_VERSION}"
echo "Release tag:     ${RELEASE_TAG}"

if [ -z "${SNAPSHOT_VERSION}" -o -z "${RELEASE_VERSION}" -o -z "${NEXT_VERSION}" ]; then
  echo '-[ Missing required version numbers! ]------------------------------------------'
  exit 1
fi

if [ ${DRY_RUN} = 'true' ]; then
  echo '-[ Dry run turned on ]----------------------------------------------------------'
  MVN_DEPLOY_ARGS=''
  echo '-[ Skipping GitHub branch and tag checks ]--------------------------------------'
else
  # MVN_DEPLOY_ARGS='deploy:deploy'
  MVN_DEPLOY_ARGS='nexus-staging:deploy'
  
  GIT_ORIGIN=`git remote`
  
  echo '-[ Prepare branch ]-------------------------------------------------------------'
  if [[ -n `git branch -r | grep "${GIT_ORIGIN}/${RELEASE_VERSION}"` ]]; then
    if [ "${OVERWRITE}" = 'true' ]; then
      echo "${GIT_ORIGIN}/${RELEASE_VERSION} branch already exists, deleting"
      git push --delete origin "${RELEASE_VERSION}" && true
    else
      echo "Error: ${GIT_ORIGIN}/${RELEASE_VERSION} branch already exists"
      exit 1
    fi
  fi
  
  echo '-[ Release tag cleanup ]--------------------------------------------------------'
  if [[ -n `git ls-remote --tags ${GIT_ORIGIN} | grep "${RELEASE_TAG}"` ]]; then
    if [ "${OVERWRITE}" = 'true' ]; then
      echo "${RELEASE_TAG} tag already exists, deleting"
      git push --delete origin "${RELEASE_TAG}" && true
    else
      echo "Error: ${RELEASE_TAG} tag already exists"
      exit 1
    fi
  fi
fi

cd ${WORKSPACE}

# Always delete local branch if exists
git branch --delete "${RELEASE_VERSION}" && true
git checkout -b ${RELEASE_VERSION}

# Always delete local tag if exists
git tag --delete "${RELEASE_TAG}" && true

# Setup jacc bot account information
git config --global user.email "jacc-bot@xxxxxxxxxxx"
git config --global user.name "Eclipse jacc Bot"


cd ${BUILD_DIR}

# Project identifiers
ARTIFACT_ID=$(mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.artifactId | grep -Ev '(^\[)')
GROUP_ID=$(mvn -B ${HELP_PLUGIN}:evaluate -Dexpression=project.groupId | grep -Ev '(^\[)')

echo '-[ Set release version ]--------------------------------------------------------'

# Set release version
mvn -U -C \
    -DnewVersion="${RELEASE_VERSION}" \
    -DgenerateBackupPoms=false \
    clean ${VERSIONS_PLUGIN}:set

cd ${WORKSPACE}

echo '-[ Commit modified pom.xml files ]----------------------------------------------'
POM_FILES=`git status | grep -E 'modified:.*pom\.xml' | sed -e 's/[[:space:]][[:space:]]*modified:[[:space:]][[:space:]]*//'`
git add ${POM_FILES} && \
git commit -m "Prepare release ${GROUP_ID}:${ARTIFACT_ID}:${RELEASE_VERSION}"

cd ${BUILD_DIR}

echo '-[ Deploy artifacts to staging repository ]-------------------------------------'
mvn -U -C -s /home/jenkins/.m2/settings.xml \
    -DskipTests -Ddoclint=none \
    -Poss-release -Pstaging\
    clean package source:jar javadoc:jar gpg:sign install:install ${MVN_DEPLOY_ARGS}

cd ${WORKSPACE}

echo '-[ Tag release ]----------------------------------------------------------------'
git tag "${RELEASE_TAG}" -m "Release ${GROUP_ID}:${ARTIFACT_ID}:${RELEASE_VERSION}"

cd ${BUILD_DIR}

echo '-[ Set next snapshot version ]--------------------------------------------------'
mvn -U -C \
    -DnewVersion="${NEXT_VERSION}" \
    -DgenerateBackupPoms=false \
    clean ${VERSIONS_PLUGIN}:set

cd ${WORKSPACE}

echo '-[ Commit modified pom.xml files ]----------------------------------------------'
POM_FILES=`git status | grep -E 'modified:.*pom\.xml' | sed -e 's/[[:space:]][[:space:]]*modified:[[:space:]][[:space:]]*//'`
git add ${POM_FILES} && \
git commit -m "Prepare next development cycle for ${NEXT_VERSION}"

GIT_STATUS=`git status`

echo $GIT_STATUS

if [ ${DRY_RUN} = 'true' ]; then
  echo '-[ Skipping GitHub update ]-----------------------------------------------------'
else
  echo '-[ Push branch and tag to GitHub ]----------------------------------------------'
  git push origin "${RELEASE_VERSION}"
  git push origin "${RELEASE_TAG}"
fi


Hope this helps!

Kind regards,
Arjan


On Tue, Nov 13, 2018 at 8:49 AM vinay.vishal@xxxxxxxxxx <vinay.vishal@xxxxxxxxxx> wrote:

Hi Arjan,

I am using 1.0.5, I am getting following error when I execute this:

# Open a new staging repo
mvn -B nexus-staging:rc-open \
  -DstagingProfileId="${STAGING_PROFILE_ID}" \
  -DstagingDescription="${STAGING_DESC}"

Can you point me to the job (or share the script) to refer to, I might be missing something trivial in my script then?

Thanks,

Vinay

On 13/11/18 1:59 PM, arjan tijms wrote:
Hi,

I used the 1.0.5 parent and didn’t need to set any of these. Which parent pom are you using, then?


On Tuesday, November 13, 2018, vinay.vishal@xxxxxxxxxx <vinay.vishal@xxxxxxxxxx> wrote:

Hi,

As per wiki, following three need to be customized for each project:

# Customize these for each project
STAGING_NAME
STAGING_DESC
STAGING_PROFILE_ID

What is STAGING_PROFILE_ID, is this just the hash of the latest commit id (in short form)?.

I am getting following error when rc-open goal gets executed of nexus-staging-maven-plugin.

[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:rc-open (default-cli) on project glassfish-main-aggregator: 
Execution default-cli of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.8:rc-open failed: 404 - Not Found -> [Help 1]

Any help?


_______________________________________________
ee4j-build mailing list
ee4j-build@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/ee4j-build
_______________________________________________
ee4j-build mailing list
ee4j-build@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/ee4j-build

Back to the top