Skip to content

Commit

Permalink
chore(build): update to newer spinnaker project plugin (spinnaker#1626)
Browse files Browse the repository at this point in the history
updates to gradle 6.3

updates github actions workflows for new release flags
  • Loading branch information
cfieber authored and German Muzquiz committed Apr 23, 2020
1 parent d73a561 commit 644c8b5
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 69 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- master
- version-*

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx2g -Xms2g

jobs:
branch-build:
# Only run this on repositories in the 'spinnaker' org, not on forks.
Expand All @@ -28,8 +31,4 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: ./gradlew -PenableCrossCompilerPlugin=true -PenablePublishing=true -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" build snapshot --stacktrace
run: ./gradlew -PenableCrossCompilerPlugin=true build --stacktrace
7 changes: 4 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ name: PR Build

on: [ pull_request ]

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx2g -Xms2g

jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -22,6 +25,4 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: Build
env:
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: ./gradlew -PenableCrossCompilerPlugin=true build javadoc
run: ./gradlew -PenableCrossCompilerPlugin=true build
19 changes: 7 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+"

env:
GRADLE_OPTS: -Dorg.gradle.daemon=false -Xmx2g -Xms2g

jobs:
release:
runs-on: ubuntu-latest
Expand All @@ -31,26 +34,18 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
. .github/workflows/release_info.sh ${{ github.event.repository.name }}
. .github/workflows/release_info.sh ${{ github.event.repository.full_name }}
echo ::set-output name=CHANGELOG::$(echo -e "${CHANGELOG}")
echo ::set-output name=SKIP_RELEASE::${SKIP_RELEASE}
echo ::set-output name=IS_CANDIDATE::${IS_CANDIDATE}
- name: Candidate build
if: steps.release_info.outputs.IS_CANDIDATE == 'true'
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
run: |
./gradlew -PenableCrossCompilerPlugin=true -PenablePublishing=true --info -Prelease.disableGitChecks=true -Prelease.useLastTag=true -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" candidate
echo ::set-output name=RELEASE_VERSION::${RELEASE_VERSION}
- name: Release build
if: steps.release_info.outputs.IS_CANDIDATE == 'false'
env:
BINTRAY_USER: ${{ secrets.BINTRAY_USER }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GRADLE_OPTS: -Xmx6g -Xms6g -Dorg.gradle.daemon=false
RELEASE_VERSION: ${{ steps.release_info.outputs.RELEASE_VERSION }}
run: |
./gradlew -PenableCrossCompilerPlugin=true -PenablePublishing=true --info -Prelease.disableGitChecks=true -Prelease.useLastTag=true -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" final
./gradlew -PenableCrossCompilerPlugin=true --info -Pversion="${RELEASE_VERSION}" -PbintrayUser="${BINTRAY_USER}" -PbintrayKey="${BINTRAY_API_KEY}" publish
- name: Create release
if: steps.release_info.outputs.SKIP_RELEASE == 'false'
uses: actions/create-release@v1
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/release_info.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -x

# Only look to the latest release to determine the previous tag -- this allows us to skip unsupported tag formats (like `version-1.0.0`)
export PREVIOUS_TAG=`curl --silent "https://api.github.com/repos/spinnaker/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'`
export PREVIOUS_TAG=`curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'`
echo "PREVIOUS_TAG=$PREVIOUS_TAG"
export NEW_TAG=${GITHUB_REF/refs\/tags\//}
echo "NEW_TAG=$NEW_TAG"
Expand Down Expand Up @@ -29,3 +29,7 @@ SEMVER_REGEX="\

# Used in downstream steps to determine if the release should be marked as a "prerelease" and if the build should build candidate release artifacts
export IS_CANDIDATE=`[[ $NEW_TAG =~ $SEMVER_REGEX && ! -z ${BASH_REMATCH[4]} ]] && echo "true" || echo "false"`

# This is the version string we will pass to the build, trim off leading 'v' if present
export RELEASE_VERSION=`[[ $NEW_TAG =~ $SEMVER_REGEX ]] && echo "${NEW_TAG:1}" || echo "${NEW_TAG}"`
echo "RELEASE_VERSION=$RELEASE_VERSION"
39 changes: 12 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,16 @@
* limitations under the License.
*/

buildscript {
repositories {
jcenter()
maven { url "https://spinnaker.bintray.com/gradle" }
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath "com.netflix.spinnaker.gradle:spinnaker-dev-plugin:$spinnakerGradleVersion"
if (Boolean.valueOf(enablePublishing)) {
classpath "com.netflix.spinnaker.gradle:spinnaker-gradle-project:$spinnakerGradleVersion"
}
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
}
plugins {
id 'io.spinnaker.project' version "$spinnakerGradleVersion" apply false
id 'com.google.protobuf' version "0.8.12" apply false
}

allprojects {
subprojects {
group = "com.netflix.spinnaker.halyard"
apply plugin: 'spinnaker.base-project'
apply plugin: 'io.spinnaker.project'
apply plugin: 'java-library'
apply plugin: 'groovy'
if (Boolean.valueOf(enablePublishing)) {
apply plugin: 'spinnaker.project'
}

test {
testLogging {
Expand All @@ -47,6 +34,13 @@ allprojects {
maxHeapSize = "512m"
}

if ([korkVersion, fiatVersion, clouddriverVersion, front50Version].any { it.endsWith("-SNAPSHOT") }) {
logger.info("Enabling mavenLocal")
repositories {
mavenLocal()
}
}

dependencies {
implementation platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion")

Expand Down Expand Up @@ -77,12 +71,3 @@ def createScript(project, mainClass, name) {
}
}
}

subprojects { project ->
if ([korkVersion, fiatVersion, clouddriverVersion, front50Version].any { it.endsWith("-SNAPSHOT") }) {
logger.info("Enabling mavenLocal")
repositories {
mavenLocal()
}
}
}
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
clouddriverVersion=5.57.0
enablePublishing=false
fiatVersion=1.18.3
front50Version=2.17.1
korkVersion=7.38.1
org.gradle.parallel=true
spinnakerGradleVersion=7.11.6
spinnakerGradleVersion=8.0.0-rc.3
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
29 changes: 12 additions & 17 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -175,14 +175,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"
3 changes: 3 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

Expand Down
2 changes: 1 addition & 1 deletion halyard-web/halyard-web.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apply plugin: 'com.google.protobuf'
apply plugin: 'spinnaker.application'
apply plugin: 'io.spinnaker.package'

ext {
springConfigLocation = System.getProperty('spring.config.additional-location', "${System.getProperty('user.home')}/.spinnaker/")
Expand Down

0 comments on commit 644c8b5

Please sign in to comment.