Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Generating a CEDAR Release DEPRECATED

Martin O'Connor edited this page Aug 24, 2020 · 2 revisions

Note that these instructions have been replaced by:

https://github.com/metadatacenter/cedar-conf/wiki/Generating-a-CEDAR-Release

These steps assume that Maven has been configured to use the CEDAR Nexus server and that NPM has been configured to use the CEDAR Nexus server.

First, pull all the latest code for the following CEDAR repos.

   cedar-parent
   cedar-project
   cedar-server-core-library 
   cedar-model-validation-library
   cedar-keycloak-event-listener
   cedar-util
   cedar-swagger-ui
   cedar-admin-tool
   cedar-docs
   cedar-template-editor
   cedar-user-server
   cedar-workspace-server
   cedar-template-server
   cedar-repo-server
   cedar-schema-server
   cedar-resource-server
   cedar-terminology-server  
   cedar-value-recommender-server
   cedar-group-server
   cedar-submission-server
   cedar-worker-server
   cedar-messaging-server
   cedar-docker-build
   cedar-docker-deploy

Empty the local Maven cache:

  rm -rf ~/.m2/repository/org/metadatacenter

Then build the current snapshot version of the parent and the project repo. The project repo POM will build all CEDAR server components:

  cd cedar-parent
  mcit
  cd ../cedar-project
  mcit

Set the release version as follows:

  export CEDAR_RELEASE_VERSION=XXX
  export CEDAR_RELEASE_TAG=release-${CEDAR_RELEASE_VERSION}
  export CEDAR_NEXT_DEVELOPMENT_VERSION=$(echo $CEDAR_RELEASE_VERSION | awk -F. -v OFS=. 'NF==1{print ++$NF}; NF>1{if(length($NF+1)>length($NF))$(NF-1)++; $NF=sprintf("%0*d-SNAPSHOT", length($NF), ($NF+1)%(10^length($NF))); print}')

First release the cedar-parent as follows:

   git checkout develop
   sed -i '' 's/<cedar.version>.*<\/cedar.version>/<cedar.version>'${CEDAR_RELEASE_VERSION}'<\/cedar.version>/g' pom.xml 
   git commit -a -m "Updated cedar.version to release version"
   git push origin develop
   
   # Perform a release using the Maven Releases Plugin and tag it
   mvn --batch-mode -Dtag=$CEDAR_RELEASE_TAG -DreleaseVersion=$CEDAR_RELEASE_VERSION -DscmCommentPrefix="[ci skip] " release:clean release:prepare
   mvn release:perform
   git push origin develop
      
   # Make the master branch reflect the released version
   git checkout master
   git pull origin master 
   git merge -X theirs --no-ff -m "$CEDAR_RELEASE_VERSION" $CEDAR_RELEASE_TAG
   git push origin master
   mvn clean install # install released artifact locally
   
   # Return to develop branch and deploy latest development version
   git checkout develop
   sed -i '' 's/<cedar.version>.*<\/cedar.version>/<cedar.version>'${CEDAR_NEXT_DEVELOPMENT_VERSION}'<\/cedar.version>/g' pom.xml 
   git commit -a -m "Updated cedar.version to next development version"
   git push origin develop
   mvn clean deploy # deploy development artifact
   

Then release the following repos in sequence:

   cedar-server-core-library 
   cedar-model-validation-library
   cedar-keycloak-event-listener
   cedar-util
   cedar-admin-tool
   cedar-user-server
   cedar-workspace-server
   cedar-template-server
   cedar-repo-server
   cedar-schema-server
   cedar-resource-server
   cedar-terminology-server  
   cedar-value-recommender-server
   cedar-group-server
   cedar-submission-server
   cedar-worker-server
   cedar-messaging-server

For each of the above repos perform the following steps:

   # Update versions of parent and dependencies to release version
   git checkout develop
   git pull origin develop
   mvn versions:update-parent versions:update-child-modules # Update parent POM to release version (recursively)
   mvn -DallowSnapshots=false versions:update-properties # Update version properties to point to latest release versions
   git commit -a -m "Updated parent POM and dependency versions to release version"
   git push origin develop
      
   # Prepare a release using the Maven Releases Plugin and tag it
   mvn -Darguments="-DskipTests" --batch-mode -Dtag=$CEDAR_RELEASE_TAG -DreleaseVersion=$CEDAR_RELEASE_VERSION -DscmCommentPrefix="[ci skip] " release:clean release:prepare
    
   # Perform the release using the Maven Releases Plugin
   mvn -Darguments="-DskipTests -Dmaven.javadoc.skip=true" release:perform
   
   # Make the master branch reflect the released version
   git push origin develop
   git checkout master
   git pull origin master
   git merge -X theirs --no-ff -m "Release $CEDAR_RELEASE_VERSION" $CEDAR_RELEASE_TAG
   git push origin master    
   mvn -DskipTests=true clean install # install release artifact locally
   
   # Return to develop branch and update to next development version
   git checkout develop
   git pull origin develop
   mvn -DallowSnapshots=true versions:update-parent # Update parent POM to current development version
   mvn -DallowSnapshots=true versions:update-properties # Update version properties to point to latest development versions
   git commit -a -m "Updated CEDAR component dependencies to point to current development snapshots"
   git push origin develop
   mvn -DskipTests=true deploy # deploy new development artifact 
   

Then release the cedar-project project:

    # Update to next release version and push a release tag
    git checkout develop
    git pull origin develop
    mvn versions:set -DnewVersion=$CEDAR_RELEASE_VERSION -DupdateMatchingVersions=false
    git commit -a -m "Update to next release version"
    git push origin develop
    git tag $CEDAR_RELEASE_TAG
    git push origin $CEDAR_RELEASE_TAG
        
    # Make the master branch reflect the released version
    git checkout master
    git pull origin master
    git merge -X theirs --no-ff -m "Release $CEDAR_RELEASE_VERSION" $CEDAR_RELEASE_TAG
    git push origin master
    
    # Return to develop branch and update to next development version
    git checkout develop
    git pull origin develop
    mvn build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT versions:commit
    git commit -a -m "Update to next development version"
    git push origin develop
    

Release the cedar-template-editor:

    # Tag the latest development version
    git checkout develop
    git pull origin develop
    sed -i '' 's/- CEDAR_VERSION\s*=.*\".*\"/- CEDAR_VERSION=\"'${CEDAR_RELEASE_VERSION}'\"/g' .travis.yml
    jq '.version="'${CEDAR_RELEASE_VERSION}'"' package.json > json.package && mv json.package package.json
    git commit -a -m "Set release version for .travis.yml and package.json"
    git push origin develop
    git tag $CEDAR_RELEASE_TAG
    git push origin $CEDAR_RELEASE_TAG
    
    # Make the master branch reflect the release tag
    git checkout master
    git pull origin master
    git merge -X theirs --no-ff -m "Release $CEDAR_RELEASE_VERSION" $CEDAR_RELEASE_TAG
    git push origin master
    npm publish # Publish the new release version to Nexus server
    
    # Return to develop branch 
    git checkout develop
    sed -i '' 's/- CEDAR_VERSION\s*=.*\".*\"/- CEDAR_VERSION=\"'${CEDAR_NEXT_DEVELOPMENT_VERSION}'\"/g' .travis.yml
    jq '.version="'${CEDAR_NEXT_DEVELOPMENT_VERSION}'"' package.json > json.package && mv json.package package.json
    git commit -a -m "Updated to next development version"
    git push origin develop
    npm publish # Publish the new development version to Nexus server

Release cedar-docs and cedar-swagger-ui projects:

    # Tag the latest development version
    git checkout develop
    git pull origin develop
    git tag $CEDAR_RELEASE_TAG
    git push origin $CEDAR_RELEASE_TAG
    
    # Make the master branch reflect the release tag
    git checkout master
    git pull origin master
    git merge -X theirs --no-ff -m "Release $CEDAR_RELEASE_VERSION" $CEDAR_RELEASE_TAG
    git push origin master
    
    # Return to develop branch 
    git checkout develop

Release cedar-docker-build as follows.

    # Tag the latest development version
    git checkout develop
    git pull origin develop
    find . -name Dockerfile -exec sed -i '' 's/^ENV CEDAR_VERSION=.*$/ENV CEDAR_VERSION='${CEDAR_RELEASE_VERSION}'/' {} \; -print
    git commit -a -m "Set the release version in the Dockerfiles"
    git push origin develop
    git tag $CEDAR_RELEASE_TAG
    git push origin $CEDAR_RELEASE_TAG
    
    # Make the master branch reflect the release tag
    git checkout master
    git pull origin master
    git merge -X theirs --no-ff -m "Release $CEDAR_RELEASE_VERSION" $CEDAR_RELEASE_TAG
    git push origin master
    # TODO Publish the new release to Dockerhub
    
    # Return to develop branch 
    git checkout develop
    find . -name Dockerfile -exec sed -i '' 's/^ENV CEDAR_VERSION=.*$/ENV CEDAR_VERSION='${CEDAR_NEXT_DEVELOPMENT_VERSION}'/' {} \; -print
    git commit -a -m "Updated to next development version"
    git push origin develop
    # TODO Publish the new development version to Dockerhub

Release cedar-docker-deploy projects as follows.

    # Tag the latest development version
    git checkout develop
    git pull origin develop
    sed -i '' 's/^export CEDAR_VERSION=.*$/export CEDAR_VERSION='${CEDAR_RELEASE_VERSION}'/' ./cedar-assets/bin/set-env-base.sh
    git commit -a -m "Set the release version in the Dockerfiles"
    git push origin develop
    git tag $CEDAR_RELEASE_TAG
    git push origin $CEDAR_RELEASE_TAG
    
    # Make the master branch reflect the release tag
    git checkout master
    git pull origin master
    git merge -X theirs --no-ff -m "Release $CEDAR_RELEASE_VERSION" $CEDAR_RELEASE_TAG
    git push origin master
    
    # Return to develop branch 
    git checkout develop
    sed -i '' 's/^export CEDAR_VERSION=.*$/export CEDAR_VERSION='${CEDAR_NEXT_DEVELOPMENT_VERSION}'/' ./cedar-assets/bin/set-env-base.sh
    git commit -a -m "Updated to next development version"
    git push origin develop

Finally, clean the local Maven cache and rebuild:

  rm -rf ~/.m2/repository/org/metadatacenter
  cd cedar-parent
  mcit
  cd ../cedar-project
  mcit
Clone this wiki locally