Skip to content

Commit

Permalink
chore(build): update to newer spinnaker project plugin (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
cfieber committed Apr 18, 2020
1 parent 4c8fe9f commit d6c92c1
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 61 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
1 change: 1 addition & 0 deletions .github/workflows/bump_dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
bump-dependencies:
if: startsWith(github.repository, 'spinnaker/')
runs-on: ubuntu-latest
steps:
- uses: spinnaker/bumpdeps@master
Expand Down
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"
28 changes: 4 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +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"
// TODO: nebula-publishing-plugin version override should be removed as soon as spinnaker-gradle-project is updated
// this override is needed to omit compileOnly dependencies from generated pom.xml
classpath "com.netflix.nebula:nebula-publishing-plugin:12.0.1"
}
}
plugins {
id 'io.spinnaker.project' version "$spinnakerGradleVersion" apply false
}

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

if ([korkVersion].find { it.endsWith("-SNAPSHOT") }) {
repositories {
Expand Down Expand Up @@ -64,11 +48,7 @@ allprojects {
jvmArgs '-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7103'
}
}
}
}

subprojects { project ->
if (name != "fiat-bom") {
dependencies {
implementation platform("com.netflix.spinnaker.kork:kork-bom:$korkVersion")
compileOnly "org.projectlombok:lombok"
Expand Down
12 changes: 0 additions & 12 deletions fiat-bom/fiat-bom.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,11 @@
*/

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 fiat-web/fiat-web.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apply plugin: 'spinnaker.application'
apply plugin: 'io.spinnaker.package'

ext {
springConfigLocation = System.getProperty('spring.config.additional-location', "${System.getProperty('user.home')}/.spinnaker/")
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
includeProviders=file,github,google-groups,ldap
korkVersion=7.37.0
org.gradle.parallel=true
spinnakerGradleVersion=7.11.6
spinnakerGradleVersion=8.0.0-rc.1
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.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 9 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@
* limitations under the License.
*/

if (spinnakerGradleVersion.endsWith('-SNAPSHOT')) {
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
}

rootProject.name="fiat"

include 'fiat-api',
Expand All @@ -37,6 +46,5 @@ rootProject.children.each {
setBuildFile(it)
}


// Set as an ext variable so that build scripts can access it
gradle.ext.includedProviderProjects = includeProviders.split(',').collect{ ':fiat-' + it.toLowerCase() }

0 comments on commit d6c92c1

Please sign in to comment.