-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the
from.platforms
Jib config parameter to jib-maven-plugin …
…and to the jib-gradle-plugin (#2568) * Adding the plugins tag for Jib-Maven-Plugin * Adding the plugins tag * Solved Style Issues * Added the getPlatforms test * Style Fixes * Comment Fixes * Making inner classes private * New option to skip pushing images (manifests) if the image (manifest) already exists in the target registry (#2531) * Adds proposal to control the pushing of tags on existing images in target registry. * Updates proposal with more detail. * Work for tags-on-existing-images.md * Cleanup. * * Simplified implementation: * Removed newly added class ManifestDescriptor, replaced it with already existing ManifestAndDigest. * Removed the CheckImageStep and incorporated the check within the PushImageStep. Implementation now follows similar checks, eg, in PushBlopStep. * Adds unit and integration tests. * Fixes resulting from testing. * Code formatting changes. * Code cleanup, post-review. * Code cleanup, post-review. * * Adds a new CheckImageStep and integrates it in the StepsRunner. * Reverts PushImageStep to the state before the PR started, apart from the manifest existence check. * Refactor code * CHANGELOG * Update comments * Improve test Co-authored-by: Chanseok Oh <[email protected]> * Making the os/platform nullable * Style Fixes * Adding getPlatforms() to RawConfiguration * Adding the Jib config parameter to jib-gradle-plugin * Style Fixes * Making Platforms Parameter Singular * Style FIxes * SMALL FIX * Fix Gradle platforms config * Rename PlatformConfiguration interface * Small style changes Co-authored-by: Karl <[email protected]> Co-authored-by: Chanseok Oh <[email protected]>
- Loading branch information
1 parent
00dbfee
commit daed808
Showing
9 changed files
with
193 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/PlatformParameters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright 2020 Google LLC. | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
package com.google.cloud.tools.jib.gradle; | ||
|
||
import com.google.cloud.tools.jib.plugins.common.RawConfiguration.PlatformConfiguration; | ||
import java.util.Optional; | ||
import javax.annotation.Nullable; | ||
import org.gradle.api.tasks.Input; | ||
import org.gradle.api.tasks.Internal; | ||
|
||
/** Configuration of a platform. */ | ||
public class PlatformParameters implements PlatformConfiguration { | ||
@Nullable private String os; | ||
@Nullable private String architecture; | ||
|
||
@Input | ||
@Nullable | ||
public String getOs() { | ||
return os; | ||
} | ||
|
||
@Internal | ||
@Override | ||
public Optional<String> getOsName() { | ||
return Optional.ofNullable(os); | ||
} | ||
|
||
public void setOs(String os) { | ||
this.os = os; | ||
} | ||
|
||
@Input | ||
@Nullable | ||
public String getArchitecture() { | ||
return architecture; | ||
} | ||
|
||
@Internal | ||
@Override | ||
public Optional<String> getArchitectureName() { | ||
return Optional.ofNullable(architecture); | ||
} | ||
|
||
public void setArchitecture(String architecture) { | ||
this.architecture = architecture; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
...gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/PlatformParametersSpec.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright 2020 Google LLC. | ||
* | ||
* Licensed 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. | ||
*/ | ||
|
||
package com.google.cloud.tools.jib.gradle; | ||
|
||
import javax.inject.Inject; | ||
import org.gradle.api.Action; | ||
import org.gradle.api.model.ObjectFactory; | ||
import org.gradle.api.provider.ListProperty; | ||
|
||
/** Allows to add {@link PlatformParameters} objects to the list property of the same type. */ | ||
public class PlatformParametersSpec { | ||
|
||
private final ObjectFactory objectFactory; | ||
private final ListProperty<PlatformParameters> platforms; | ||
|
||
@Inject | ||
public PlatformParametersSpec( | ||
ObjectFactory objectFactory, ListProperty<PlatformParameters> platforms) { | ||
this.platforms = platforms; | ||
this.objectFactory = objectFactory; | ||
} | ||
|
||
/** | ||
* Adds a new platform configuration to the platforms list. | ||
* | ||
* @param action closure representing a platform configuration | ||
*/ | ||
public void platform(Action<? super PlatformParameters> action) { | ||
PlatformParameters platform = objectFactory.newInstance(PlatformParameters.class); | ||
action.execute(platform); | ||
platforms.add(platform); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters