-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement a Docker image generator gradle plugin for Spark applications #381
Changes from 23 commits
42988ef
4b32aa9
6bded05
2bb1702
cad9d41
92139c0
5a847bb
46f23c9
71b835a
4149dfd
814978f
e123548
6bf957a
3194cd1
53c0b1a
d046ab7
186b3a3
0f6be98
6352a26
1fa699c
de403f0
cad1bb1
1ae4f61
9ea102a
94c6c55
999b5f8
6704dd5
e2c862d
3017341
fb57b7e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
.ensime_cache/ | ||
.ensime_lucene | ||
.generated-mima* | ||
.gradle | ||
.idea/ | ||
.idea_modules/ | ||
.project | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); 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 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
set -euo pipefail | ||
ROOT=$(git rev-parse --show-toplevel) | ||
DOCKER_PLUGIN_PROJECT_DIR=$ROOT/resource-managers/kubernetes/docker | ||
$DOCKER_PLUGIN_PROJECT_DIR/gradlew -p $DOCKER_PLUGIN_PROJECT_DIR --info compileJava compileTestJava |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); 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 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
set -euo pipefail | ||
ROOT=$(git rev-parse --show-toplevel) | ||
DOCKER_PLUGIN_PROJECT_DIR=$ROOT/resource-managers/kubernetes/docker | ||
$DOCKER_PLUGIN_PROJECT_DIR/gradlew -p $DOCKER_PLUGIN_PROJECT_DIR --info test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add gradle to root and only define one subproject with that path so we can just run |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
src/main/resources/docker-resources | ||
.gradle | ||
build | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); 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 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import java.nio.charset.StandardCharsets | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
maven { url "http://palantir.bintray.com/releases" } | ||
} | ||
|
||
dependencies { | ||
classpath 'gradle.plugin.com.palantir:gradle-circle-style:1.1.2' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you use baseline? |
||
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' | ||
classpath 'com.netflix.nebula:nebula-dependency-recommender:5.2.0' | ||
classpath 'com.netflix.nebula:nebula-publishing-plugin:5.1.5' | ||
} | ||
} | ||
|
||
plugins { | ||
id 'com.palantir.git-version' version '0.9.1' | ||
id 'java-gradle-plugin' | ||
} | ||
|
||
repositories { | ||
jcenter() | ||
maven { url "http://palantir.bintray.com/releases" } | ||
} | ||
|
||
apply plugin: 'java' | ||
apply plugin: 'idea' | ||
apply plugin: 'nebula.dependency-recommender' | ||
version System.env.CIRCLE_TAG ?: gitVersion() | ||
group 'org.apache.spark' | ||
|
||
sourceCompatibility = 1.8 | ||
|
||
dependencyRecommendations { | ||
strategy OverrideTransitives | ||
propertiesFile file: project.rootProject.file('versions.props') | ||
} | ||
|
||
test { | ||
minHeapSize = "512m" | ||
maxHeapSize = "512m" | ||
} | ||
|
||
dependencies { | ||
compileOnly gradleApi() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make it compile - this is a weird dependency |
||
compile 'org.apache.commons:commons-compress' | ||
compile 'commons-io:commons-io' | ||
testCompile 'org.assertj:assertj-core' | ||
testCompile 'org.mockito:mockito-core' | ||
testCompile 'junit:junit' | ||
testCompile 'com.spotify:docker-client' | ||
testCompile gradleApi() | ||
testCompile gradleTestKit() | ||
} | ||
|
||
def getGitRepoRoot = { -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a closure whether you add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This function isn't in the latest version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this shouldn't be necessary - let's make root project be in the root of the repo |
||
def bashStdOut = new ByteArrayOutputStream() | ||
exec { | ||
commandLine 'git', 'rev-parse', '--show-toplevel' | ||
standardOutput = bashStdOut | ||
} | ||
return new String(bashStdOut.toByteArray(), StandardCharsets.UTF_8).trim() | ||
} | ||
|
||
|
||
task prepareDockerBundleDir(type: Sync) { | ||
from('src/main/dockerfiles/spark/Dockerfile') { | ||
into 'kubernetes/dockerfiles/spark' | ||
rename 'Dockerfile', 'Dockerfile.original' | ||
} | ||
|
||
from('src/main/dockerfiles/spark/entrypoint.sh') { | ||
into 'kubernetes/dockerfiles/spark' | ||
} | ||
|
||
from(fileTree("$getGitRepoRoot/bin")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we just use a relative path here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this doesn't apply anymore, given how we've rearranged the Gradle project. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We instead use |
||
into 'bin' | ||
} | ||
|
||
from(fileTree("$getGitRepoRoot/sbin")) { | ||
into 'sbin' | ||
} | ||
|
||
into file("src/main/resources/docker-resources") | ||
includeEmptyDirs = false | ||
} | ||
|
||
tasks.compileJava.dependsOn tasks.prepareDockerBundleDir | ||
tasks.idea.dependsOn tasks.prepareDockerBundleDir | ||
|
||
apply from: "${rootDir}/gradle/publish.gradle" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); 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 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
apply plugin: 'com.jfrog.bintray' | ||
apply plugin: 'nebula.maven-base-publish' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
apply plugin: 'nebula.maven-resolved-dependencies' | ||
apply plugin: 'nebula.javadoc-jar' | ||
apply plugin: 'nebula.source-jar' | ||
|
||
jar { | ||
manifest { | ||
attributes( | ||
"Implementation-Title" : project.name, | ||
"Implementation-Version" : project.version, | ||
"Implementation-Vendor" : "Palantir Technologies Inc.") | ||
} | ||
} | ||
|
||
bintray { | ||
user = System.env.BINTRAY_USERNAME | ||
key = System.env.BINTRAY_PASSWORD | ||
publish = true | ||
pkg { | ||
repo = 'releases' | ||
name = 'spark' | ||
userOrg = 'palantir' | ||
licenses = ['Apache-2.0'] | ||
publications = ['nebula'] | ||
} | ||
} | ||
|
||
bintrayUpload.dependsOn { generatePomFileForNebulaPublication } | ||
bintrayUpload.dependsOn { sourceJar } | ||
bintrayUpload.dependsOn { build } | ||
|
||
publishing { | ||
publications { | ||
nebula(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You under the Apache License, Version 2.0 | ||
# (the "License"); 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 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. latest |
||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need to wire publishing as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be included because we put the gradle publish call in
publish_functions.sh