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

Get project version from git #5403

Merged
merged 7 commits into from
Dec 12, 2018
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
19 changes: 10 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ cache:
- $HOME/maven
env:
matrix:
- MAVEN_VERSION=3.3.9 TEST=core
- MAVEN_VERSION=3.3.9 TEST=python-validator
- MAVEN_VERSION=3.3.9 TEST=sanity-checks
- MAVEN_VERSION=3.3.9 TEST=end-to-end
- MAVEN_VERSION=3.5.4 TEST=core
- MAVEN_VERSION=3.5.4 TEST=python-validator
- MAVEN_VERSION=3.5.4 TEST=sanity-checks
- MAVEN_VERSION=3.5.4 TEST=end-to-end
install:
- |
if [[ "${TEST}" == core || "${TEST}" == end-to-end ]]
Expand Down Expand Up @@ -71,18 +71,19 @@ script:
then
~/maven/$MAVEN_VERSION/bin/mvn \
-e \
-Ppublic \
-Dfinal.war.name=cbioportal \
-U \
-Ddb.user=cbio_user \
-Ddb.password=somepassword \
clean integration-test
clean \
install \
integration-test
fi
- |
if [[ "${TEST}" == end-to-end ]]
then
~/maven/$MAVEN_VERSION/bin/mvn \
-Ppublic -DskipTests \
-Dfinal.war.name=cbioportal \
-U \
-DskipTests \
clean install
fi
- |
Expand Down
2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
"SPRING_OPTS": {
"description":"set spring properties with e.g. -Dshow.civic=true (TODO: not all props work atm)",
"value":"-Dauthenticate=false -Dtomcat.catalina.scope=runtime -Ddb.user=cbio_user -Ddb.password=cbio_pass -Ddb.portal_db_name=public_test_small -Ddb.connection_string=jdbc:mysql://devdb.cbioportal.org:3306/ -Ddb.host=devdb.cbioportal.org -Dshow.civic=true -Ddbconnector=dbcp -Dsuppress_schema_version_mismatch_errors=true"
"value":"-Dauthenticate=false -Dtomcat.catalina.scope=runtime -Ddb.user=cbio_user -Ddb.password=cbio_pass -Ddb.portal_db_name=public_test -Ddb.connection_string=jdbc:mysql://devdb.cbioportal.org:3306/ -Ddb.host=devdb.cbioportal.org -Dshow.civic=true -Ddbconnector=dbcp -Dsuppress_schema_version_mismatch_errors=true"
}
},
"buildpacks": [
Expand Down
4 changes: 3 additions & 1 deletion business/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>business</artifactId>
Expand Down
36 changes: 3 additions & 33 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>core</artifactId>
Expand Down Expand Up @@ -290,38 +292,6 @@
</dependency>
</dependencies>

<profiles>
<profile>
<id>heroku</id>
<build>
<plugins>
<!-- remove core temp build files -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>clean-artifacts</id>
<phase>install</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>target</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<build>
<plugins>
<!-- surefire (test) config -->
Expand Down
4 changes: 3 additions & 1 deletion db-scripts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion docs/System-Requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ On Ubuntu: [See Recommended Installation Instructions](https://www.digitalocean

## Apache Maven

The cBioPortal source code is an [Apache Maven](https://maven.apache.org/) driven project. The software needs to be downloaded and installed prior to building the application from source code. It can be found on the [Apache Maven](https://maven.apache.org/download.cgi) website.
The cBioPortal source code is an [Apache Maven](https://maven.apache.org/) driven project. The software needs to be downloaded and installed prior to building the application from source code. It can be found on the [Apache Maven](https://maven.apache.org/download.cgi) website. We are currently using version 3.5.4.

On Ubuntu: ```sudo apt-get install maven```

Expand Down
4 changes: 3 additions & 1 deletion model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 3 additions & 1 deletion persistence/persistence-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<parent>
<artifactId>persistence</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 3 additions & 1 deletion persistence/persistence-mybatis/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<parent>
<artifactId>persistence</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 3 additions & 1 deletion persistence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
23 changes: 21 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
<artifactId>master</artifactId>
<packaging>pom</packaging>
<name>Portal Master</name>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
<description>master maven module</description>

<scm>
Expand All @@ -23,6 +25,12 @@
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</pluginRepository>
</pluginRepositories>

<profiles>
<profile>
Expand All @@ -35,6 +43,17 @@
</properties>
<build>
<plugins>
<plugin>
<groupId>com.github.cbioportal.maven-external-version</groupId>
<artifactId>maven-external-version-plugin</artifactId>
<version>f09c2b9608744881111f24e55d55a91e54e6cb5f</version>
<extensions>true</extensions>
<configuration>
<strategy hint="script">
<script>./version.sh</script>
inodb marked this conversation as resolved.
Show resolved Hide resolved
</strategy>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
Expand Down Expand Up @@ -250,7 +269,7 @@
<jacoco-maven-plugin.version>0.7.6.201602180812</jacoco-maven-plugin.version>
<mockito.version>1.10.19</mockito.version>

<final.war.name>cbioportal-${project.version}</final.war.name>
<final.war.name>cbioportal</final.war.name>

<db.test.driver>com.mysql.jdbc.Driver</db.test.driver>
<!-- For MySQL < 5.5 change 'default_storage_engine' to 'storage_engine' -->
Expand Down
4 changes: 3 additions & 1 deletion portal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>cbioportal</artifactId>
Expand Down
5 changes: 4 additions & 1 deletion scripts/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>scripts</artifactId>
Expand Down Expand Up @@ -65,6 +67,7 @@
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<artifactSet>
<excludes>
<exclude>org.bouncycastle:bcprov-jdk15</exclude>
Expand Down
4 changes: 3 additions & 1 deletion security/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 3 additions & 1 deletion security/security-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<parent>
<artifactId>security</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
4 changes: 3 additions & 1 deletion service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
13 changes: 13 additions & 0 deletions version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
if [ -n "$PROJECT_VERSION" ]; then
# use env variable PROJECT_VERSION if defined
echo $PROJECT_VERSION
inodb marked this conversation as resolved.
Show resolved Hide resolved
elif ! [ -x "$(command -v git)" ] || ! [ -d .git ]; then
# git is not installed, or not in a git repo
echo '0-unknown-version'
else
# fetch all tags silently
git fetch --tags --quiet > /dev/null 2> /dev/null
# get human readable commit id from git
git describe --tags --always --dirty | sed 's/^v//'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If git describe always goes back to a tag, does it mean that portal dependencies can only be brought in from a tagged commit that is pushed to the cbioportal github repo? If a single PR makes changes in both the service and web layer (like changing the service interface), will the "new" web layer be able to bring in the "new" service layer even if a tag has not been created (in a pr to rc, for instance)? Maybe the extra info after the tag is enough to provide the additional path since the tag (the "dirty" part I guess?)

% git describe --tags --always --dirty

v1.18.0-120-g05c7ad6-dirty

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sheridancbio Portal dependencies can be brought in locally or remotely. It doesn't need to be tagged/committed in the github repo. Maven continues to function in the same way, so if u compile something locally the artifacts will end up in your ~/.m2 folder and you can include them in another project as a dependency.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good. I was mainly thinking about dependencies between the modules within cbioportal, but packaging the cbioportal code into other codebases is also needed.

fi
4 changes: 3 additions & 1 deletion web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
<parent>
<artifactId>master</artifactId>
<groupId>org.mskcc.cbio</groupId>
<version>1.18.2-SNAPSHOT</version>
<!-- project version is generated through git or can be passed as
PROJECT_VERSION env variable (see version.sh) -->
<version>0-unknown-version-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>web</artifactId>
Expand Down