Skip to content

Commit

Permalink
chore(build): update to newer spinnaker project plugin (#707)
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 committed Apr 20, 2020
1 parent c44f7cc commit aa141ac
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 74 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
5 changes: 3 additions & 2 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
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"
21 changes: 4 additions & 17 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,13 @@
* 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"
}
}
plugins {
id 'io.spinnaker.project' version "$spinnakerGradleVersion" apply false
}

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

if ([korkVersion, fiatVersion].find { it.endsWith('-SNAPSHOT') }) {
repositories {
Expand Down
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
enablePublishing=false
fiatVersion=1.18.3
korkVersion=7.37.0
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.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 15 additions & 20 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
Expand Down Expand Up @@ -125,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down Expand Up @@ -154,19 +154,19 @@ if $cygwin ; 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" "$@"
5 changes: 4 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem http://www.apache.org/licenses/LICENSE-2.0
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
Expand All @@ -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
11 changes: 0 additions & 11 deletions igor-bom/igor-bom.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,12 @@
*/

apply plugin: "java-platform"
apply plugin: "maven-publish"

javaPlatform {
allowDependencies()
}


if (Boolean.valueOf(enablePublishing)) {
publishing {
publications {
nebula(MavenPublication) {
from components.javaPlatform
}
}
}
}

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

Expand Down
2 changes: 1 addition & 1 deletion igor-web/igor-web.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ext {
springConfigLocation = System.getProperty('spring.config.additional-location', "${System.getProperty('user.home')}/.spinnaker/")
}

apply plugin: 'spinnaker.application'
apply plugin: 'io.spinnaker.package'

run {
systemProperty('spring.config.additional-location', project.springConfigLocation)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@
RedisConfig.class,
LockManagerConfig.class,
GoogleCloudBuildTestConfig.class
})
},
properties = {"fiat.enabled=false"})
@TestPropertySource(properties = {"spring.config.location=classpath:gcb/gcb-test.yml"})
public class GoogleCloudBuildTest {
@Autowired private MockMvc mockMvc;
Expand Down

0 comments on commit aa141ac

Please sign in to comment.