Skip to content

Commit

Permalink
Merge pull request #486 from Netflix/publishing-for-2.4.x
Browse files Browse the repository at this point in the history
Upgrade nebula.netflixoss to replace bintray publication and update TravisCI Secrets
  • Loading branch information
rpalcolea authored Aug 5, 2021
2 parents 3a339b4 + 5487097 commit 5d00bc5
Show file tree
Hide file tree
Showing 23 changed files with 471 additions and 152 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ atlassian-ide-plugin.xml

# NetBeans specific files/directories
.nbattrs

# publishing secrets
secrets/signing-key
12 changes: 7 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
language: java
jdk:
- oraclejdk8
- openjdk8
sudo: false
install: "./installViaTravis.sh"
script: "./buildViaTravis.sh"
env:
global:
- secure: mprd3lRQDzNFIqWJ/hhHt84Oo1rQFv5Hp2GyySTx/xPiu2Qv6F+C0YOHTHIT2+BxxW/7580w/8e6L8YLxiVX0d2J8YwQm7tPoc4WN3kV9K6U/LTdVmNAePNyeMq1R13CPAguDVG2CY4+Y08rdU7OYDuL1mQFHzPmvhGzLnN4kiE=
- secure: INE6Zlu2EMfRZI13F8B4RyKkmvtaMA8K5bMYwRPWDJ+PUnGUfU27xIjx8mY+dd6A2JfSeeoF7dkOko4xi+PiiayY2Byi8fneja1j01Du7l0okBaeROGlLscLid2ME0yDCql06vERhCdIDEBMpZzVu8GbqpZ1z/x0JQ0YgBiMVEc=
- secure: OumwxBfa3lOrT2BHRx9a9Ppxiua0IbEtRFs2CQHCWOW6iYRLDavLqya+oMPvx+gAlZRX54VTYuuxh858dxR8O94xPi4NvZ/POvoTdgU1MNekBqYsuWys3B4Dw8CMrrpfzvtD8tWe8TkgwGpzzpRuEzQ6bvh0uCAmiQ0kQhKA8+0=
- secure: TeSjCxSjlH0fE30WoBWOPIWPMMn66v6KGAMbUGPO1Z98q1AXptmcFnAob0of8Q/HLkR6Paxtl4r4yt35pqakw40M6s5w4O2Pe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/R1MeTNC9hG4Il9MzcNIlqSAf0ztnfGHEiFs9Idc2Q4bPJgH2RM5M=
cache:
directories:
- "$HOME/.gradle/caches"
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'nebula.netflixoss' version '2.2.10'
id 'nebula.netflixoss' version '9.1.0'
}

// Establish version and status
Expand Down
8 changes: 5 additions & 3 deletions buildViaTravis.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#!/bin/bash
# This script will build the project.

Expand All @@ -6,18 +7,19 @@ if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
./gradlew build
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Build Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
./gradlew -Prelease.travisci=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" build snapshot
./gradlew -Prelease.travisci=true -PnetflixOss.username="$NETFLIX_OSS_REPO_USERNAME" -PnetflixOss.password="$NETFLIX_OSS_REPO_PASSWORD" -Psonatype.signingPassword="$NETFLIX_OSS_SIGNING_PASSWORD" build snapshot
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
echo -e 'Build Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
case "$TRAVIS_TAG" in
*-rc\.*)
./gradlew -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" candidate
./gradlew -Prelease.travisci=true -PnetflixOss.username="$NETFLIX_OSS_REPO_USERNAME" -PnetflixOss.password="$NETFLIX_OSS_REPO_PASSWORD" -Psonatype.signingPassword="$NETFLIX_OSS_SIGNING_PASSWORD" -Prelease.useLastTag=true candidate
;;
*)
./gradlew -Prelease.travisci=true -Prelease.useLastTag=true -PbintrayUser="${bintrayUser}" -PbintrayKey="${bintrayKey}" -PsonatypeUsername="${sonatypeUsername}" -PsonatypePassword="${sonatypePassword}" final
./gradlew -Prelease.travisci=true -PnetflixOss.username="$NETFLIX_OSS_REPO_USERNAME" -PnetflixOss.password="$NETFLIX_OSS_REPO_PASSWORD" -Psonatype.username="$NETFLIX_OSS_SONATYPE_USERNAME" -Psonatype.password="$NETFLIX_OSS_SONATYPE_PASSWORD" -Psonatype.signingPassword="$NETFLIX_OSS_SIGNING_PASSWORD" -Prelease.useLastTag=true final
;;
esac
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
./gradlew build
fi

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
15 changes: 3 additions & 12 deletions installViaTravis.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
#!/bin/bash
# This script will build the project.

if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo -e "Assemble Pull Request #$TRAVIS_PULL_REQUEST => Branch [$TRAVIS_BRANCH]"
./gradlew assemble
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" == "" ]; then
echo -e 'Assemble Branch with Snapshot => Branch ['$TRAVIS_BRANCH']'
./gradlew -Prelease.travisci=true assemble
elif [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_TAG" != "" ]; then
echo -e 'Assemble Branch for Release => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG']'
./gradlew -Prelease.travisci=true -Prelease.useLastTag=true assemble
else
echo -e 'WARN: Should not be here => Branch ['$TRAVIS_BRANCH'] Tag ['$TRAVIS_TAG'] Pull Request ['$TRAVIS_PULL_REQUEST']'
./gradlew assemble
if [ "$TRAVIS_SECURE_ENV_VARS" = "true" ]; then
echo "Decrypting publishing credentials"
openssl aes-256-cbc -k "$NETFLIX_OSS_SIGNING_FILE_PASSWORD" -in secrets/signing-key.enc -out secrets/signing-key -d
fi
3 changes: 3 additions & 0 deletions ribbon-eureka/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ dependencies {
compile "com.netflix.eureka:eureka-client:${eureka_version}"
compile 'com.google.code.findbugs:annotations:2.0.0'
compile "org.slf4j:slf4j-api:${slf4j_version}"
compile "com.netflix.archaius:archaius-core:0.7.5"
compile "commons-configuration:commons-configuration:1.8"
compile "javax.inject:javax.inject:1"

testCompile project(":ribbon-archaius")
testCompile "org.slf4j:slf4j-log4j12:${slf4j_version}"
Expand Down
1 change: 0 additions & 1 deletion ribbon-evcache/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ dependencies {
compile "io.reactivex:rxjava:${rx_java_version}"
compile "org.slf4j:slf4j-api:${slf4j_version}"
testCompile project(':ribbon-test')
testCompile project(path: ':ribbon', configuration: 'test')
testCompile "junit:junit:${junit_version}"
testCompile "org.powermock:powermock-easymock-release-full:${powermock_version}"
testCompile "org.easymock:easymock:${easymock_version}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright 2014 Netflix, Inc.
*
* 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.netflix.ribbon.proxy.sample;

import com.netflix.hystrix.HystrixInvokableInfo;
import com.netflix.ribbon.ServerError;
import com.netflix.ribbon.UnsuccessfulResponseException;
import com.netflix.ribbon.http.HttpResponseValidator;
import com.netflix.ribbon.hystrix.FallbackHandler;
import io.netty.buffer.ByteBuf;
import io.reactivex.netty.protocol.http.client.HttpClientResponse;
import rx.Observable;

import java.util.Map;

/**
* @author Tomasz Bak
*/
public class HystrixHandlers {

public static class SampleHttpResponseValidator implements HttpResponseValidator {

@Override
public void validate(HttpClientResponse<ByteBuf> response) throws UnsuccessfulResponseException, ServerError {
}
}

public static class MovieFallbackHandler implements FallbackHandler<Movie> {

@Override
public Observable<Movie> getFallback(HystrixInvokableInfo<?> hystrixInfo, Map<String, Object> requestProperties) {
return null;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.netflix.ribbon.proxy.sample;

public class Movie {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
package com.netflix.ribbon.proxy.sample;

import com.netflix.ribbon.RibbonRequest;
import com.netflix.ribbon.proxy.annotation.*;
import com.netflix.ribbon.proxy.annotation.ClientProperties.Property;
import com.netflix.ribbon.proxy.annotation.Http.Header;
import com.netflix.ribbon.proxy.annotation.Http.HttpMethod;
import com.netflix.ribbon.proxy.sample.HystrixHandlers.MovieFallbackHandler;
import com.netflix.ribbon.proxy.sample.HystrixHandlers.SampleHttpResponseValidator;
import io.netty.buffer.ByteBuf;
import rx.Observable;

import java.util.concurrent.atomic.AtomicReference;

import static com.netflix.ribbon.proxy.sample.ResourceGroupClasses.SampleHttpResourceGroup;

/**
* @author Tomasz Bak
*/
public class MovieServiceInterfaces {

@ClientProperties(properties = {
@Property(name="ReadTimeout", value="2000"),
@Property(name="ConnectTimeout", value="1000"),
@Property(name="MaxAutoRetriesNextServer", value="2")
}, exportToArchaius = true)
public static interface SampleMovieService {

@TemplateName("findMovieById")
@Http(
method = HttpMethod.GET,
uri = "/movies/{id}",
headers = {
@Header(name = "X-MyHeader1", value = "value1.1"),
@Header(name = "X-MyHeader1", value = "value1.2"),
@Header(name = "X-MyHeader2", value = "value2")
})
@Hystrix(
cacheKey = "findMovieById/{id}",
validator = SampleHttpResponseValidator.class,
fallbackHandler = MovieFallbackHandler.class)
@CacheProvider(key = "findMovieById_{id}", provider = SampleCacheProviderFactory.class)
RibbonRequest<ByteBuf> findMovieById(@Var("id") String id);

@TemplateName("findRawMovieById")
@Http(method = HttpMethod.GET, uri = "/rawMovies/{id}")
RibbonRequest<ByteBuf> findRawMovieById(@Var("id") String id);

@TemplateName("findMovie")
@Http(method = HttpMethod.GET, uri = "/movies?name={name}&author={author}")
RibbonRequest<ByteBuf> findMovie(@Var("name") String name, @Var("author") String author);

@TemplateName("registerMovie")
@Http(method = HttpMethod.POST, uri = "/movies")
@Hystrix(cacheKey = "registerMovie", fallbackHandler = MovieFallbackHandler.class)
@ContentTransformerClass(MovieTransformer.class)
RibbonRequest<ByteBuf> registerMovie(@Content Movie movie);

@Http(method = HttpMethod.PUT, uri = "/movies/{id}")
@ContentTransformerClass(MovieTransformer.class)
RibbonRequest<ByteBuf> updateMovie(@Var("id") String id, @Content Movie movie);

@Http(method = HttpMethod.PATCH, uri = "/movies/{id}")
@ContentTransformerClass(MovieTransformer.class)
RibbonRequest<ByteBuf> updateMoviePartial(@Var("id") String id, @Content Movie movie);

@TemplateName("registerTitle")
@Http(method = HttpMethod.POST, uri = "/titles")
@Hystrix(cacheKey = "registerTitle", fallbackHandler = MovieFallbackHandler.class)
RibbonRequest<ByteBuf> registerTitle(@Content String title);

@TemplateName("registerByteBufBinary")
@Http(method = HttpMethod.POST, uri = "/binaries/byteBuf")
@Hystrix(cacheKey = "registerByteBufBinary", fallbackHandler = MovieFallbackHandler.class)
RibbonRequest<ByteBuf> registerByteBufBinary(@Content ByteBuf binary);

@TemplateName("registerByteArrayBinary")
@Http(method = HttpMethod.POST, uri = "/binaries/byteArray")
@Hystrix(cacheKey = "registerByteArrayBinary", fallbackHandler = MovieFallbackHandler.class)
RibbonRequest<ByteBuf> registerByteArrayBinary(@Content byte[] binary);

@TemplateName("deleteMovie")
@Http(method = HttpMethod.DELETE, uri = "/movies/{id}")
RibbonRequest<ByteBuf> deleteMovie(@Var("id") String id);
}

public static interface ShortMovieService {
@TemplateName("findMovieById")
@Http(method = HttpMethod.GET, uri = "/movies/{id}")
RibbonRequest<ByteBuf> findMovieById(@Var("id") String id);

@TemplateName("findMovieById")
@Http(method = HttpMethod.GET, uri = "/movies")
RibbonRequest<ByteBuf> findAll();
}

public static interface BrokenMovieService {

@Http(method = HttpMethod.GET)
Movie returnTypeNotRibbonRequest();

Movie missingHttpAnnotation();

@Http(method = HttpMethod.GET)
RibbonRequest<ByteBuf> multipleContentParameters(@Content Movie content1, @Content Movie content2);
}

@ResourceGroup(name = "testResourceGroup")
public static interface SampleMovieServiceWithResourceGroupNameAnnotation {

}

@ResourceGroup(resourceGroupClass = SampleHttpResourceGroup.class)
public static interface SampleMovieServiceWithResourceGroupClassAnnotation {

}

@ResourceGroup(name = "testResourceGroup", resourceGroupClass = SampleHttpResourceGroup.class)
public static interface BrokenMovieServiceWithResourceGroupNameAndClassAnnotation {

}

@ResourceGroup(name = "testResourceGroup")
public static interface TemplateNameDerivedFromMethodName {
@Http(method = HttpMethod.GET, uri = "/template")
RibbonRequest<ByteBuf> myTemplateName();
}

@ResourceGroup(name = "testResourceGroup")
public static interface HystrixOptionalAnnotationValues {

@TemplateName("hystrix1")
@Http(method = HttpMethod.GET, uri = "/hystrix/1")
@Hystrix(cacheKey = "findMovieById/{id}")
RibbonRequest<ByteBuf> hystrixWithCacheKeyOnly();

@TemplateName("hystrix2")
@Http(method = HttpMethod.GET, uri = "/hystrix/2")
@Hystrix(validator = SampleHttpResponseValidator.class)
RibbonRequest<ByteBuf> hystrixWithValidatorOnly();

@TemplateName("hystrix3")
@Http(method = HttpMethod.GET, uri = "/hystrix/3")
@Hystrix(fallbackHandler = MovieFallbackHandler.class)
RibbonRequest<ByteBuf> hystrixWithFallbackHandlerOnly();

}

@ResourceGroup(name = "testResourceGroup")
public static interface PostsWithDifferentContentTypes {

@TemplateName("rawContentSource")
@Http(method = HttpMethod.POST, uri = "/content/rawContentSource")
@ContentTransformerClass(MovieTransformer.class)
RibbonRequest<ByteBuf> postwithRawContentSource(AtomicReference<Object> arg1, int arg2, @Content Observable<Movie> movie);

@TemplateName("byteBufContent")
@Http(method = HttpMethod.POST, uri = "/content/byteBufContent")
RibbonRequest<ByteBuf> postwithByteBufContent(@Content ByteBuf byteBuf);

@TemplateName("byteArrayContent")
@Http(method = HttpMethod.POST, uri = "/content/byteArrayContent")
RibbonRequest<ByteBuf> postwithByteArrayContent(@Content byte[] bytes);

@TemplateName("stringContent")
@Http(method = HttpMethod.POST, uri = "/content/stringContent")
RibbonRequest<ByteBuf> postwithStringContent(@Content String content);

@TemplateName("movieContent")
@Http(method = HttpMethod.POST, uri = "/content/movieContent")
@ContentTransformerClass(MovieTransformer.class)
RibbonRequest<ByteBuf> postwithMovieContent(@Content Movie movie);

@TemplateName("movieContentBroken")
@Http(method = HttpMethod.POST, uri = "/content/movieContentBroken")
RibbonRequest<ByteBuf> postwithMovieContentBroken(@Content Movie movie);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2014 Netflix, Inc.
*
* 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.netflix.ribbon.proxy.sample;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufAllocator;
import io.reactivex.netty.channel.ContentTransformer;

/**
* @author Tomasz Bak
*/
public class MovieTransformer implements ContentTransformer<MovieTransformer> {
@Override
public ByteBuf call(MovieTransformer toTransform, ByteBufAllocator byteBufAllocator) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.netflix.ribbon.proxy.sample;

import com.netflix.ribbon.http.HttpResourceGroup;

/**
* @author Tomasz Bak
*/
public class ResourceGroupClasses {
public static class SampleHttpResourceGroup extends HttpResourceGroup {
public SampleHttpResourceGroup() {
super("myTestGroup");
}
}
}
Loading

0 comments on commit 5d00bc5

Please sign in to comment.