Skip to content
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

GH-4199 Hot patch jib #1

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import net.ltgt.gradle.errorprone.CheckSeverity
}

subprojects {
group 'com.google.cloud.tools'
group 'net.dzikoysk.jib-fork'

repositories {
mavenCentral()
Expand Down Expand Up @@ -292,6 +292,17 @@ subprojects {
}

publishing {
repositories {
maven {
name = "panda-repository"
url = uri("https://maven.reposilite.com/releases")
credentials {
username = System.getenv("MAVEN_NAME") ?: property("mavenUser").toString()
password = System.getenv("MAVEN_TOKEN") ?: property("mavenPassword").toString()
}
}
}

publications {
mavenJava(MavenPublication) {
pom {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@
import java.net.URL;
import java.security.GeneralSecurityException;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Supplier;
import javax.net.ssl.SSLException;
Expand Down Expand Up @@ -78,6 +81,8 @@
*/
public class FailoverHttpClient {

public static final List<BiConsumer<URL, Request>> REQUEST_PROCESSORS = new ArrayList<>();

/** Represents failover actions taken. To be recorded in the failover history. */
private static enum Failover {
NONE, // no failover (secure HTTPS)
Expand Down Expand Up @@ -257,6 +262,8 @@ public Response call(String httpMethod, URL url, Request request) throws IOExcep
throw new SSLException("insecure HTTP connection not allowed: " + url);
}

REQUEST_PROCESSORS.forEach(processor -> processor.accept(url, request));

Optional<Response> fastPathResponse = followFailoverHistory(httpMethod, url, request);
if (fastPathResponse.isPresent()) {
return fastPathResponse.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ private Request(Builder builder) {
this.httpTimeout = builder.httpTimeout;
}

HttpHeaders getHeaders() {
public HttpHeaders getHeaders() {
return headers;
}

Expand Down
21 changes: 14 additions & 7 deletions jib-gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,26 @@ plugins {
id 'eclipse'
}

publishing {
repositories {
maven {
name = "panda-repository"
url = uri("https://maven.reposilite.com/releases")
credentials {
username = System.getenv("MAVEN_NAME") ?: property("mavenUser").toString()
password = System.getenv("MAVEN_TOKEN") ?: property("mavenPassword").toString()
}
}
}
}

/* LOCAL SNAPSHOT DEV */
// to install for local testing - do not load this plugin when publishing to plugin portal
// 'maven-publish' and 'com.gradle.plugin-publish' do not interact well with each other
// https://discuss.gradle.org/t/debug-an-issue-in-publish-plugin-gradle-plugin-not-being-prepended-to-groupid/32720
if (version.contains('SNAPSHOT')) {
apply plugin: 'maven-publish'

publishing {
repositories {
mavenLocal()
}
}

task install {
dependsOn publishToMavenLocal
}
Expand Down Expand Up @@ -71,7 +78,7 @@ gradlePlugin {
testSourceSets sourceSets.integrationTest, sourceSets.test
plugins {
jibPlugin {
id = 'com.google.cloud.tools.jib'
id = 'net.dzikoysk.jib-fork.jib-gradle-plugin'
displayName = 'Jib'
description = 'Containerize your Java application'
implementationClass = 'com.google.cloud.tools.jib.gradle.JibPlugin'
Expand Down