We'd love to accept your patches and contributions to this project. There are just a few small guidelines you need to follow.
Contributions to this project must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of the project. Head over to https://cla.developers.google.com/ to see your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.
All submissions, including submissions by project members, require review. We use Github pull requests for this purpose.
Before submitting a pull request, please make sure to:
- Identify an existing issue to associate with your proposed change, or file a new issue.
- Describe any implementation plans in the issue and wait for a review from the repository maintainers.
- Set your git user.email property to the address used for signing the CLA. E.g.
If you're a Googler or other corporate contributor, use your corporate email address here, not your personal address.
git config --global user.email "[email protected]"
- Fork the repository into your own Github account.
- We follow our own Java style guide that extends the Google Java Style Guide.
- Please include unit tests (and integration tests if applicable) for all new code.
- Make sure all existing tests pass (but see the note below about integration tests).
- run
./gradlew clean goJF build integrationTest
- run
- Associate the change with an existing issue or file a new issue.
- Create a pull request!
Jib comes as 3 public components:
jib-core
: a library for building containersjib-maven-plugin
: a Maven plugin that usesjib-core
andjib-plugins-common
jib-gradle-plugin
: a Gradle plugin that usesjib-core
andjib-plugins-common
And 1 internal component:
jib-plugins-common
: a library with helpers for maven/gradle plugins
The project is configured as a single gradle build. Run ./gradlew build
to build the
whole project. Run ./gradlew install
to install all public components into the
local maven repository.
Note that in order to run integration tests, you will need to set one of the following environment variables:
- If you are using a GCP project then set
JIB_INTEGRATION_TESTING_PROJECT
to the GCP project to use for testing; the registry tested will begcr.io/<JIB_INTEGRATION_TESTING_PROJECT>
. - If you're not using a GCP project then set
JIB_INTEGRATION_TESTING_LOCATION
to a specific registry for testing. (For example, you can rundocker run -d -p 9990:5000 registry:2
to set up a local registry and set the variable tolocalhost:9990
.)
You will also need Docker installed with the daemon running. Note that the integration tests will create local registries on ports 5000 and 6000.
To run select integration tests, use --tests=<testPattern>
, see gradle docs for testPattern
examples.
Although jib is a mix of Gradle and Maven projects, we build everything using one unifed gradle build. There is special code to include some projects directly as source, but importing your project should be pretty straight forward.
- Ensure you have installed the Gradle tooling for Eclipse, called Buildship (available from the Eclipse Marketplace).
- Import the Gradle project: Buildship does not yet support
Eclipse Smart Import.
Use File → Import → Gradle → Existing Gradle Project
and import
jib
.
Note that you will likely need to re-apply these changes whenever you refresh or update these projects.
To use a local build of the jib-maven-plugin
:
- Build and install
jib-maven-plugin
into your local~/.m2/repository
with./gradlew jib-maven-plugin:install
; - Modify your test project's
pom.xml
to reference the-SNAPSHOT
version of thecom.google.cloud.tools.jib
plugin.
If developing from within Eclipse with M2Eclipse (the Maven tooling for Eclipse):
- Modify your test project's
pom.xml
to reference the-SNAPSHOT
version of thecom.google.cloud.tools.jib
plugin. - Create and launch a Maven Build launch configuration for the test project, and ensure the Resolve Workspace artifacts is checked.
Run mvnDebug jib:build
and attach to port 8000.
If developing with Eclipse and M2Eclipse (the Maven tooling for Eclipse), just launch the Maven Build with Debug.
To use a local build of the jib-gradle-plugin
:
- Build and install
jib-gradle-plugin
into your local~/.m2/repository
with./gradlew jib-gradle-plugin:install
- Add a
pluginManagement
block to your test project'ssettings.gradle
to enable reading plugins from the local maven repository. It must be the first block in the file before anyinclude
directives.pluginManagement { repositories { mavenLocal() gradlePluginPortal() } }
- Modify your test project's
build.gradle
to use the latest snapshot versionplugins { // id 'com.google.cloud.tools.jib' version 'major.minor.patch' id 'com.google.cloud.tools.jib' version 'major.minor.patch-SNAPSHOT' }
Attach a debugger to a Gradle instance by running Gradle as follows:
./gradlew jib \
--no-daemon \
-Dorg.gradle.jvmargs='-agentlib:jdwp:transport=dt_socket,server=y,address=5005,suspend=y'