Skip to content

Commit

Permalink
Versioning of Docker images
Browse files Browse the repository at this point in the history
  • Loading branch information
Felipe444 committed Jun 16, 2020
1 parent 21d214d commit 034e5d4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
- stage: build docker images for server and agent
if: NOT branch = master OR type IN (pull_request)
script:
- mvn docker:build@build-docker -P docker-app -f ./judge-d-server/pom.xml
- mvn docker:build@build-docker -P docker-app -f ./judge-d-agent/pom.xml
- mvn validate docker:build@build-docker -P docker-app -f ./judge-d-server/pom.xml
- mvn validate docker:build@build-docker -P docker-app -f ./judge-d-agent/pom.xml
- stage: build & publish docker image for server
if: branch = master AND NOT type IN (pull_request)
script:
- mvn docker:build@build-docker -P docker-app -f ./judge-d-server/pom.xml
- mvn validate docker:build@build-docker -P docker-app -f ./judge-d-server/pom.xml
- echo "Pushing to docker registry"
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push hltech/judge-d
Expand All @@ -35,6 +35,6 @@ jobs:
- stage: build & publish docker image for agent
if: branch = master AND NOT type IN (pull_request)
script:
- mvn docker:build@build-docker -P docker-app -f ./judge-d-agent/pom.xml
- mvn validate docker:build@build-docker -P docker-app -f ./judge-d-agent/pom.xml
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- docker push hltech/judge-d-agent
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ Want to help? Have any problems or questions? Let us know!

## Versioning <a name="Versioning"></a>

TODO - Gitflow versioning in plans.
Each merge to master triggers release of Docker image tagged with both latest and x.<total commit count>.0_<git commit abbreviated>

## Authors <a name="Authors"></a>

Expand Down
9 changes: 8 additions & 1 deletion judge-d-agent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand All @@ -217,14 +221,17 @@
<configuration>
<imageName>hltech/judge-d-agent</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>

<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<imageTags>
<imageTag>latest</imageTag>
<imageTag>${version.number}</imageTag>
</imageTags>
</configuration>
</execution>
</executions>
Expand Down
9 changes: 8 additions & 1 deletion judge-d-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,10 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
Expand All @@ -259,14 +263,17 @@
<configuration>
<imageName>hltech/judge-d</imageName>
<dockerDirectory>${project.basedir}/src/main/docker</dockerDirectory>

<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
<imageTags>
<imageTag>latest</imageTag>
<imageTag>${version.number}</imageTag>
</imageTags>
</configuration>
</execution>
</executions>
Expand Down
23 changes: 23 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
<groovyAllVersion>2.4.7</groovyAllVersion>
<lombokVersion>1.18.12</lombokVersion>
<spockVersion>1.1-groovy-2.4</spockVersion>
<version.number>1.${git.total.commit.count}.0_${git.commit.id.abbrev}</version.number>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -155,6 +156,28 @@
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.0</version>
<executions>
<execution>
<id>get-git-metadata</id>
<phase>validate</phase>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<includeOnlyProperties>
<includeOnlyProperty>git.commit.id.abbrev</includeOnlyProperty>
<includeOnlyProperty>git.total.commit.count</includeOnlyProperty>
</includeOnlyProperties>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Expand Down

0 comments on commit 034e5d4

Please sign in to comment.