Skip to content

Commit

Permalink
Merge branch 'master' into watchOption
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoox committed Nov 25, 2021
2 parents c6b082e + dd4b13d commit 6441934
Show file tree
Hide file tree
Showing 56 changed files with 404 additions and 1,908 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://help.github.com/articles/about-codeowners/

* @ikhoon @minwoox @trustin
* @ikhoon @jrhee17 @minwoox @trustin

66 changes: 66 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Publish Docker image

on:
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: 11

- name: Restore Gradle cache
uses: actions/cache@v2
with:
path: |
~/.gradle/wrapper/dists
~/.gradle/caches/jars-3
~/.gradle/caches/modules-2
~/.gradle/caches/package-lists
~/.gradle/caches/sphinx-binary
~/.gradle/go/binary
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build Docker image
run: ./gradlew :dist:docker
shell: bash

- name: Extract release version
id: release-version
uses: actions/github-script@v4
with:
# Extract a release version from 'refs/tags/centraldogma-x.y.z' tag.
script: |
const version = context.ref.replace(/.*centraldogma-/, '')
console.log('Release version: ' + version)
return version
result-encoding: string

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Push Docker image
run: |
docker push line/centraldogma:${{ steps.release-version.outputs.result }}
docker push line/centraldogma:latest
shell: bash

- name: Clean up Gradle cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
shell: bash
9 changes: 1 addition & 8 deletions .post-release-msg
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@

https://github.com/line/centraldogma/releases/tag/${tag}

5. Build a docker image and push it into docker hub

./gradlew :dist:docker
docker login
docker push line/centraldogma:${releaseVersion}
docker push line/centraldogma:latest

6. Copy the web site generated to the 'gh-pages' branch. e.g.
5. Copy the web site generated to the 'gh-pages' branch. e.g.

cd ../site-centraldogma
rm -fr .buildinfo .doctrees .gradle *
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id 'com.google.osdetector' version '1.6.2' apply false
id 'me.champeau.gradle.jmh' version '0.5.3' apply false
id 'me.champeau.jmh' version '0.6.5' apply false
}

allprojects {
Expand Down Expand Up @@ -33,7 +33,7 @@ apply from: "${rootDir}/gradle/scripts/build-flags.gradle"
configure(projectsWithFlags('java')) {

// Apply common plugins.
apply plugin: 'me.champeau.gradle.jmh'
apply plugin: 'me.champeau.jmh'

// Common properties and functions.
ext {
Expand Down Expand Up @@ -128,7 +128,7 @@ configure(projectsWithFlags('java')) {
verbosity = 'EXTRA'
}
}
configurations.jmh.extendsFrom configurations.testRuntime
configurations.jmh.extendsFrom configurations.testImplementation

// Add common JVM options such as max memory and leak detection.
tasks.withType(JavaForkOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ protected final B self() {
/**
* Adds the {@link URI} of the Central Dogma server.
*
* @deprecated Use {@link #host(String)} or {@link #profile(String...)}.
*
* @param uri the URI of the Central Dogma server. e.g.
* {@code tbinary+http://example.com:36462/cd/thrift/v1}
*
* @deprecated Use {@link #host(String)} or {@link #profile(String...)}.
*/
@Deprecated
public final B uri(String uri) {
Expand Down
48 changes: 24 additions & 24 deletions dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
# If its classes are exposed in Javadoc, update offline links as well.
#
boms:
- com.fasterxml.jackson:jackson-bom:2.12.3
- com.linecorp.armeria:armeria-bom:1.8.0
- io.micrometer:micrometer-bom:1.7.0
- org.junit:junit-bom:5.7.2
- com.fasterxml.jackson:jackson-bom:2.13.0
- com.linecorp.armeria:armeria-bom:1.13.3
- io.micrometer:micrometer-bom:1.7.4
- org.junit:junit-bom:5.8.1

ch.qos.logback:
logback-classic:
version: '1.2.3'
version: '1.2.6'
javadocs:
- https://www.javadoc.io/doc/ch.qos.logback/logback-classic/1.2.3/
- https://www.javadoc.io/doc/ch.qos.logback/logback-classic/1.2.6/

com.beust:
# Please check `jcommander` version of Maven Central Repository before updating
Expand Down Expand Up @@ -58,14 +58,14 @@ com.github.jengelman.gradle.plugins:
shadow: { version: '6.1.0' }

com.github.node-gradle:
gradle-node-plugin: { version: '3.0.1' }
gradle-node-plugin: { version: '3.1.1' }

com.google.code.findbugs:
jsr305: { version: '3.0.2' }

com.google.guava:
guava:
version: &GUAVA_VERSION '30.1.1-jre'
version: &GUAVA_VERSION '31.0.1-jre'
exclusions:
- com.google.errorprone:error_prone_annotations
- com.google.j2objc:j2objc-annotations
Expand Down Expand Up @@ -111,14 +111,14 @@ com.jcraft:
com.linecorp.armeria:
armeria:
javadocs:
- https://www.javadoc.io/doc/com.linecorp.armeria/armeria-javadoc/1.6.0/
- https://www.javadoc.io/doc/com.linecorp.armeria/armeria-javadoc/1.9.0/

com.puppycrawl.tools:
checkstyle: { version: '8.42' }
checkstyle: { version: '8.45.1' }

com.spotify:
completable-futures:
version: '0.3.4'
version: '0.3.5'
relocations:
- from: com.spotify.futures
to: com.linecorp.centraldogma.internal.shaded.futures
Expand All @@ -132,10 +132,10 @@ gradle.plugin.net.davidecavestro:
io.micrometer:
micrometer-core:
javadocs:
- https://www.javadoc.io/doc/io.micrometer/micrometer-core/1.6.5/
- https://www.javadoc.io/doc/io.micrometer/micrometer-core/1.7.3/
micrometer-registry-prometheus:
javadocs:
- https://www.javadoc.io/doc/io.micrometer/micrometer-registry-prometheus/1.6.5/
- https://www.javadoc.io/doc/io.micrometer/micrometer-registry-prometheus/1.7.3/

javax.annotation:
javax.annotation-api: { version: '1.3.2' }
Expand All @@ -161,15 +161,15 @@ org.junit.jupiter:
kr.motd.gradle:
sphinx-gradle-plugin: { version: '2.10.1' }

me.champeau.gradle:
jmh-gradle-plugin: { version: '0.5.3' }
me.champeau.jmh:
jmh-gradle-plugin: { version: '0.6.6' }

net.javacrumbs.json-unit:
json-unit: { version: &JSON_UNIT_VERSION '2.25.0' }
json-unit: { version: &JSON_UNIT_VERSION '2.28.0' }
json-unit-fluent: { version: *JSON_UNIT_VERSION }

com.guardsquare:
proguard-gradle: { version: '7.0.1' }
proguard-gradle: { version: '7.1.1' }

# Ensure that we use the same ZooKeeper version as what Curator depends on.
# See: https://github.com/apache/curator/blob/master/pom.xml
Expand Down Expand Up @@ -203,7 +203,7 @@ org.apache.zookeeper:
- org.slf4j:slf4j-log4j12

org.assertj:
assertj-core: { version: '3.19.0' }
assertj-core: { version: '3.21.0' }

org.awaitility:
awaitility: { version: '4.1.0' }
Expand All @@ -215,28 +215,28 @@ org.eclipse.jetty.alpn:
alpn-api: { version: '1.1.3.v20160715' }

org.eclipse.jgit:
org.eclipse.jgit: { version: &JGIT_VERSION '5.11.1.202105131744-r' }
org.eclipse.jgit: { version: &JGIT_VERSION '5.13.0.202109080827-r' }
org.eclipse.jgit.ssh.jsch: { version: *JGIT_VERSION }

org.hibernate.validator:
hibernate-validator: { version: '6.1.6.Final' }

org.javassist:
javassist: { version: '3.27.0-GA' }
javassist: { version: '3.28.0-GA' }

org.mockito:
mockito-core: { version: &MOCKITO_VERSION '3.10.0' }
mockito-core: { version: &MOCKITO_VERSION '4.0.0' }
mockito-junit-jupiter: { version: *MOCKITO_VERSION }

org.mortbay.jetty.alpn:
jetty-alpn-agent: { version: '2.0.10' }

org.openjdk.jmh:
jmh-core: { version: &JMH_VERSION '1.31' }
jmh-core: { version: &JMH_VERSION '1.33' }
jmh-generator-annprocess: { version: *JMH_VERSION }

org.slf4j:
jcl-over-slf4j: { version: &SLF4J_VERSION '1.7.30' }
jcl-over-slf4j: { version: &SLF4J_VERSION '1.7.32' }
jul-to-slf4j: { version: *SLF4J_VERSION }
log4j-over-slf4j: { version: *SLF4J_VERSION }
slf4j-api:
Expand All @@ -246,7 +246,7 @@ org.slf4j:

org.springframework.boot:
spring-boot-starter:
version: &SPRING_BOOT_VERSION '2.4.5'
version: &SPRING_BOOT_VERSION '2.5.5'
javadocs:
- https://docs.spring.io/spring/docs/current/javadoc-api/
spring-boot-starter-test: { version: *SPRING_BOOT_VERSION }
Expand Down
16 changes: 16 additions & 0 deletions dist/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ task copyClientBinaries(group: 'Build',
into "${project.ext.distDir}/bin/native"
}

task distDirWithoutClientBinaries(group: 'Build',
description: "Builds a distribution directory without client binaries (${project.ext.relativeDistDir})",
dependsOn: [tasks.copyLicenses, tasks.copyLib])

// Create the tasks that copy each directory excluding client binaries under src/ into dist/
['bin', 'conf'].each { dirName ->
def taskName = "copy${CaseFormat.LOWER_HYPHEN.to(CaseFormat.UPPER_CAMEL, dirName)}WithoutClientBinaries"
tasks.distDirWithoutClientBinaries.dependsOn(tasks.create(taskName, Copy) {
group = 'Build'
description = "Copies src/$dirName into ${project.ext.relativeDistDir}/$dirName"
from "${project.projectDir}/src/$dirName"
into "${project.ext.distDir}/$dirName"
exclude '**/dogma*'
})
}

task distDir(group: 'Build',
description: "Builds a distribution directory (${project.ext.relativeDistDir})",
dependsOn: [tasks.copyLicenses, tasks.copyLib, tasks.copyClientBinaries])
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=com.linecorp.centraldogma
version=0.50.1-SNAPSHOT
version=0.52.7-SNAPSHOT
projectName=Central Dogma
projectUrl=https://line.github.io/centraldogma/
projectDescription=Highly-available version-controlled service configuration repository based on Git, ZooKeeper and HTTP/2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,15 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInfo;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvSource;

import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.base.Strings;
import com.google.common.io.Files;

import com.linecorp.centraldogma.client.CentralDogma;
import com.linecorp.centraldogma.common.CentralDogmaException;
import com.linecorp.centraldogma.common.Change;
import com.linecorp.centraldogma.common.Entry;
import com.linecorp.centraldogma.common.Revision;
Expand Down Expand Up @@ -392,13 +395,25 @@ void remoteToLocal_tooManyBytes() throws Exception {
.hasMessageContaining("byte");
}

@CsvSource({ "meta", "dogma" })
@ParameterizedTest
void cannotMirrorToInternalRepositories(String localRepo) {
assertThatThrownBy(() -> pushMirrorSettings(localRepo, "/", "/"))
.hasCauseInstanceOf(CentralDogmaException.class)
.hasMessageContaining("invalid localRepo:");
}

private void pushMirrorSettings(@Nullable String localPath, @Nullable String remotePath) {
pushMirrorSettings(REPO_FOO, localPath, remotePath);
}

private void pushMirrorSettings(String localRepo, @Nullable String localPath, @Nullable String remotePath) {
client.push(projName, Project.REPO_META, Revision.HEAD, "Add /mirrors.json",
Change.ofJsonUpsert("/mirrors.json",
"[{" +
" \"type\": \"single\"," +
" \"direction\": \"REMOTE_TO_LOCAL\"," +
" \"localRepo\": \"" + REPO_FOO + "\"," +
" \"localRepo\": \"" + localRepo + "\"," +
(localPath != null ? "\"localPath\": \"" + localPath + "\"," : "") +
" \"remoteUri\": \"" + gitUri + firstNonNull(remotePath, "") + '"' +
"}]")).join();
Expand Down
Loading

0 comments on commit 6441934

Please sign in to comment.