Skip to content

Commit

Permalink
Convert CD pipeline to work on release tags (#58)
Browse files Browse the repository at this point in the history
* Removed ninja as a dependency

* Use any version tag, not just annotated ones
  • Loading branch information
Justin Boswell authored Jun 6, 2019
1 parent 9dfeeb4 commit dc2bd6c
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 12 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Requirements:
* Clang 3.9+ or GCC 4.4+
* libssl-dev (on POSIX platforms)
* cmake 3.1+
* ninja
* Java: Any JDK8 or above, ensure JAVA_HOME is set
* Maven

Expand Down
2 changes: 1 addition & 1 deletion codebuild/cd/deploy-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ phases:
pre_build:
commands:
- cd $CODEBUILD_SRC_DIR/aws-crt-java
- export PKG_VERSION=$(git describe --abbrev=0 | cut -f2 -dv)
- export PKG_VERSION=$(git describe --tags | cut -f2 -dv)
- mkdir -p mvn-build
- aws s3 cp --recursive s3://aws-crt-java-pipeline/v${PKG_VERSION}/lib $CODEBUILD_SRC_DIR/aws-crt-java/mvn-build/lib
- cp -rv $CODEBUILD_SRC_DIR_linux_x64/dist/* $CODEBUILD_SRC_DIR/aws-crt-java/mvn-build/
Expand Down
2 changes: 1 addition & 1 deletion codebuild/cd/freebsd-x64-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ cd `dirname $0`/../..
mvn -B compile

# Upload the lib to S3
GIT_TAG=$(git describe --abbrev=0)
GIT_TAG=$(git describe --tags)
aws s3 cp --recursive mvn-build/lib s3://aws-crt-java-pipeline/${GIT_TAG}/lib
1 change: 0 additions & 1 deletion codebuild/cd/manylinux-x86-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ phases:
pre_build:
commands:
- export CC=gcc
- export GIT_TAG=$(git describe --abbrev=0)
build:
commands:
- cd aws-crt-java
Expand Down
2 changes: 1 addition & 1 deletion codebuild/cd/promote-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ phases:
pre_build:
commands:
- cd $CODEBUILD_SRC_DIR/aws-crt-java
- export PKG_VERSION=$(git describe --abbrev=0 | cut -f2 -dv)
- export PKG_VERSION=$(git describe --tags | cut -f2 -dv)
- echo PKG_VERSION=$PKG_VERSION
# install settings.xml to ~/.m2/settings.xml
- mkdir -p $HOME/.m2
Expand Down
2 changes: 1 addition & 1 deletion codebuild/cd/test-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ phases:
pre_build:
commands:
- cd aws-crt-java
- export CRT_VERSION=$(git describe --abbrev=0 | sed -e s/^v//)
- export CRT_VERSION=$(git describe --tags | sed -e s/^v//)

build:
commands:
Expand Down
16 changes: 12 additions & 4 deletions codebuild/cd/test-version-exists.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
#!/usr/bin/env bash
set -e
set -x
#force a failure if there's no tag
git describe --abbrev=0
#now get the tag
CURRENT_TAG_VERSION=$(git describe --abbrev=0 | cut -f2 -dv)
# force a failure if there's no tag
git describe --tags
# now get the tag
CURRENT_TAG=$(git describe --tags | cut -f2 -dv)
# convert v0.2.12-2-g50254a9 to 0.2.12
CURRENT_TAG_VERSION=$(git describe --tags | cut -f1 -d'-' | cut -f2 -dv)
# if there's a hash on the tag, then this is not a release tagged commit
if [ "$CURRENT_TAG" != "$CURRENT_TAG_VERSION" ]; then
echo "Current tag version is not a release tag, cut a new release if you want to publish."
exit 1
fi

PUBLISHED_TAG_VERSION=$(curl -s "https://repo.maven.apache.org/maven2/software/amazon/awssdk/crt/aws-crt/maven-metadata.xml" | grep "<latest>" | cut -f2 -d ">" | cut -f1 -d "<")
if [ "$PUBLISHED_TAG_VERSION" == "$CURRENT_TAG_VERSION" ]; then
echo "$CURRENT_TAG_VERSION is already in Sonatype, cut a new tag if you want to upload another version."
Expand Down
2 changes: 1 addition & 1 deletion codebuild/cd/windows-vs2015-x64-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set AWS_CMAKE_GENERATOR=Visual Studio 14 2015 Win64

mvn -X compile || goto error

for /f %%A in ('git describe --abbrev^=0') do (
for /f %%A in ('git describe --tags') do (
set GIT_TAG=%%A
)

Expand Down
2 changes: 1 addition & 1 deletion codebuild/cd/windows-vs2015-x86-build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set AWS_CMAKE_GENERATOR=Visual Studio 14 2015

mvn -X compile || goto error

for /f %%A in ('git describe --abbrev^=0') do (
for /f %%A in ('git describe --tags') do (
set GIT_TAG=%%A
)

Expand Down

0 comments on commit dc2bd6c

Please sign in to comment.