diff --git a/.github/workflows/ci.yml b/.github/workflows/actions_build.yml similarity index 66% rename from .github/workflows/ci.yml rename to .github/workflows/actions_build.yml index 8fd60ad6f2..38e310f575 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/actions_build.yml @@ -3,6 +3,9 @@ on: push: branches: - master + tags-ignore: + # The release versions will be verified by 'publish-release.yml' + - centraldogma-* pull_request: concurrency: @@ -23,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-latest, macos-12, windows-latest] java: [11] include: - java: 11 @@ -47,7 +50,9 @@ jobs: - name: Build with Gradle run: | - ./gradlew --no-daemon --stacktrace -Pcoverage -PnoLint build \ + ./gradlew --no-daemon --stacktrace -Pleak -PnoLint build \ + ${{ matrix.coverage && '-Pcoverage' || '' }} \ + -PflakyTests=false \ -PbuildJdkVersion=${{ matrix.java }} \ -PtestJavaVersion=${{ matrix.java }} \ shell: bash @@ -75,23 +80,20 @@ jobs: shell: bash lint: - runs-on: ${{ matrix.os }} + if: github.repository == 'line/centraldogma' + runs-on: ubuntu-latest timeout-minutes: 60 env: GRADLE_OPTS: -Xmx1280m - strategy: - fail-fast: false - matrix: - os: [ubuntu-latest] - java: [17] steps: - uses: actions/checkout@v2 - - name: Set up JDK ${{ matrix.java }} + - id: setup-jdk-17 + name: Set up JDK 17 uses: actions/setup-java@v2 with: distribution: 'temurin' - java-version: ${{ matrix.java }} + java-version: '17' - name: Setup Gradle uses: gradle/gradle-build-action@v2 @@ -99,6 +101,30 @@ jobs: - name: Build with Gradle run: | ./gradlew --no-daemon --stacktrace lint \ - -PbuildJdkVersion=${{ matrix.java }} \ - -PtestJavaVersion=${{ matrix.java }} + -PbuildJdkVersion=17 \ + -PtestJavaVersion=17 + shell: bash + + flaky-tests: + if: github.repository == 'line/centraldogma' + runs-on: ubuntu-latest + timeout-minutes: 60 + env: + GRADLE_OPTS: -Xmx1280m + steps: + - uses: actions/checkout@v2 + + - id: setup-jdk-17 + name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: '17' + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: Run flaky tests + run: | + ./gradlew --no-daemon --stacktrace -PnoLint -PflakyTests=true shell: bash diff --git a/build.gradle b/build.gradle index ec9fc297bc..da061e19f0 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,5 @@ plugins { + alias libs.plugins.nexus.publish alias libs.plugins.osdetector apply false alias libs.plugins.jmh apply false } diff --git a/client/java-armeria/src/test/java/com/linecorp/centraldogma/client/armeria/ArmeriaCentralDogmaBuilderTest.java b/client/java-armeria/src/test/java/com/linecorp/centraldogma/client/armeria/ArmeriaCentralDogmaBuilderTest.java index 3e8efa5932..6aade54a84 100644 --- a/client/java-armeria/src/test/java/com/linecorp/centraldogma/client/armeria/ArmeriaCentralDogmaBuilderTest.java +++ b/client/java-armeria/src/test/java/com/linecorp/centraldogma/client/armeria/ArmeriaCentralDogmaBuilderTest.java @@ -36,7 +36,9 @@ import com.linecorp.armeria.client.endpoint.EndpointGroup; import com.linecorp.armeria.client.endpoint.dns.DnsAddressEndpointGroup; import com.linecorp.armeria.client.endpoint.healthcheck.HealthCheckedEndpointGroup; +import com.linecorp.centraldogma.testing.internal.FlakyTest; +@FlakyTest class ArmeriaCentralDogmaBuilderTest { // Note: This test case relies on https://sslip.io/ diff --git a/dependencies.toml b/dependencies.toml index 9f4a4609ef..f6f7de57b5 100644 --- a/dependencies.toml +++ b/dependencies.toml @@ -8,16 +8,16 @@ guava = "31.1-jre" jgit = "5.13.0.202109080827-r" json-unit = "2.35.0" jmh = "1.35" -micrometer = "1.9.3" +micrometer = "1.9.4" mockito = "4.8.0" slf4j = "1.7.36" spring-boot1 = "1.5.22.RELEASE" -spring-boot2 = "2.7.3" +spring-boot2 = "2.7.4" [boms] -armeria = { module = "com.linecorp.armeria:armeria-bom", version = "1.19.0" } +armeria = { module = "com.linecorp.armeria:armeria-bom", version = "1.20.1" } jackson = { module = "com.fasterxml.jackson:jackson-bom", version = "2.13.4" } -junit5 = { module = "org.junit:junit-bom", version = "5.9.0" } +junit5 = { module = "org.junit:junit-bom", version = "5.9.1" } [libraries.armeria] module = "com.linecorp.armeria:armeria" @@ -129,7 +129,7 @@ module = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" [libraries.javassist] module = "org.javassist:javassist" -version = "3.29.1-GA" +version = "3.29.2-GA" [libraries.javax-annotation] module = "javax.annotation:javax.annotation-api" @@ -306,10 +306,11 @@ exclusions = [ [plugins] docker = { id = "com.bmuschko.docker-remote-api", version = "6.7.0" } -download = { id = "de.undercouch.download", version = "5.1.0" } -jmh = { id = "me.champeau.jmh", version = "0.6.7" } +download = { id = "de.undercouch.download", version = "5.2.1" } +jmh = { id = "me.champeau.jmh", version = "0.6.8" } jxr = { id = "net.davidecavestro.gradle.jxr", version = "0.2.1" } log = { id = "com.boazj.log", version = "0.1.0" } +nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version = "1.1.0" } node-gradle = { id = "com.github.node-gradle.node", version = "3.4.0" } -osdetector = { id = "com.google.osdetector", version = "1.6.2" } -sphinx = { id = "kr.motd.sphinx", version = "2.10.0" } +osdetector = { id = "com.google.osdetector", version = "1.7.1" } +sphinx = { id = "kr.motd.sphinx", version = "2.10.1" } diff --git a/gradle.properties b/gradle.properties index 8aac41da06..945097ce26 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ group=com.linecorp.centraldogma -version=0.58.0-SNAPSHOT +version=0.57.4-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 diff --git a/gradle/scripts/.gitrepo b/gradle/scripts/.gitrepo index 9c16c49175..d30e9f540d 100644 --- a/gradle/scripts/.gitrepo +++ b/gradle/scripts/.gitrepo @@ -1,12 +1,12 @@ ; DO NOT EDIT (unless you know what you are doing) ; ; This subdirectory is a git "subrepo", and this file is maintained by the -; git-subrepo command. See https://github.com/git-commands/git-subrepo#readme +; git-subrepo command. See https://github.com/ingydotnet/git-subrepo#readme ; [subrepo] remote = https://github.com/line/gradle-scripts.git branch = master - commit = d8dbcb3f2d1730582f30db4c6f0007102011a2ba - parent = 40da8c431672c35f0face746c3d247f87f700dfa - cmdver = 0.4.3 + commit = 566f6109098bb5c3737f494b67d943e760d804c9 + parent = 3fbe79292a19239434ee29c22462059bc9c8839b + cmdver = 0.4.5 method = merge diff --git a/gradle/scripts/README.md b/gradle/scripts/README.md index f17eabaf4b..4eab2a19d1 100644 --- a/gradle/scripts/README.md +++ b/gradle/scripts/README.md @@ -523,6 +523,11 @@ generate Maven BOM based on the dependencies specified in `dependencies.toml`. `bom` flag implies `publish` flag, which means the BOM will be uploaded to a Maven repository by `./gradlew publish`. +```groovy +// settings.gradle +includeWithFlags ':bom', 'bom' +``` + If you want to publish multiple boms with different subprojects, you can use the `bomGroups` extension property. Specify each bom's name with the subprojects: ```groovy @@ -534,6 +539,19 @@ ext { } ``` +## Sharing [dependency versions](https://docs.gradle.org/current/userguide/platforms.html#sec:version-catalog-plugin) with `version-catalog` flag + +If you configure a project with the `version-catalog` flag, the project will be configured to +publish version catalog based on the dependencies specified in `dependencies.toml`. + +The `version-catalog` flag also implies `publish` flag, which means the `libs.versions.toml` will be uploaded to a +Maven repository by `./gradlew publish`. + +```groovy +// settings.gradle +includeWithFlags ':version-catalog', 'version-catalog' +``` + ## Building shaded JARs with `shade` flag Let's say you have a project that depends on a very old version of Guava and diff --git a/gradle/scripts/lib/common-dependencies-legacy.gradle b/gradle/scripts/lib/common-dependencies-legacy.gradle index a363e663ae..5bb76d5dd6 100644 --- a/gradle/scripts/lib/common-dependencies-legacy.gradle +++ b/gradle/scripts/lib/common-dependencies-legacy.gradle @@ -9,7 +9,7 @@ buildscript { dependencies { // These should be the only dependencies that need hard-coded versions. classpath 'com.github.ben-manes:gradle-versions-plugin:0.39.0' - classpath 'org.yaml:snakeyaml:1.29' + classpath 'org.yaml:snakeyaml:1.33' } } diff --git a/gradle/scripts/lib/common-dependencies.gradle b/gradle/scripts/lib/common-dependencies.gradle index ac13e71539..535cee518c 100644 --- a/gradle/scripts/lib/common-dependencies.gradle +++ b/gradle/scripts/lib/common-dependencies.gradle @@ -11,7 +11,7 @@ buildscript { dependencies { // These should be the only dependencies that need hard-coded versions. classpath 'com.github.ben-manes:gradle-versions-plugin:0.42.0' - classpath 'org.yaml:snakeyaml:1.29' + classpath 'org.yaml:snakeyaml:1.33' } } @@ -91,6 +91,64 @@ configure(rootProject) { } } +// Publish version catalog so that other projects can easily align transitive versions of the project by +// importing the published catalog. +// https://docs.gradle.org/current/userguide/platforms.html#sec:version-catalog-plugin +configure(projectsWithFlag('version-catalog')) { catalogProject -> + apply plugin: 'version-catalog' + apply plugin: 'maven-publish' + + publishing { + publications { + maven(MavenPublication) { + from components.versionCatalog + } + } + } + + catalog { + versionCatalog { + def catalogs = rootProject.extensions.getByType(VersionCatalogsExtension).named('libs') + catalogs.libraryAliases.forEach { alias -> + def dep = catalogs.findLibrary(alias).get().get() + if (!dep.versionConstraint.requiredVersion.isEmpty()) { + library(alias, dep.toString()) + } + } + + catalogs.pluginAliases.forEach { alias -> + def plug = catalogs.findPlugin(alias).get().get() + plugin(alias, plug.pluginId).version(plug.version.requiredVersion) + } + + catalogs.versionAliases.forEach { alias -> + def ver = catalogs.findVersion(alias).get() + version(alias, ver.toString()) + } + + catalogs.bundleAliases.forEach { alias -> + def aliases = catalogs.findBundle(alias).get().get() + bundle(alias, aliases.toString()) + } + + afterEvaluate { + projectsWithFlag('publish').each { proj -> + if (proj != catalogProject) { + String alias = proj.ext.artifactId + // Normalize the alias since Gradle prefixes `get` for '.' or '_' followed by a number. + // Replace "armeria-scala_2.12" with "armeria-scala_v2.12" + alias = alias.replaceAll('_(\\d)', '_v$1') + // Replace "armeria-scala_v2.12" with "armeria-scala_v212" + // or "armeria-thrift0.13" with "armeria-thrift013" + alias = alias.replaceAll('\\.(\\d)', '$1') + library(alias, proj.group, proj.ext.artifactId).version(proj.version) + } + } + } + } + } +} + configure(projectsWithFlags('java')) { configurations.configureEach { configuration -> @@ -260,7 +318,7 @@ final class GentlePlainTextReporter implements Reporter { } String quickSearchLink = "https://search.maven.org/search?q=g:${old.group}%20a:${old.name}%20v:" + - "${versionParts[0]}.${versionParts[1]}.*\n" + "${versionParts[0]}.${versionParts[1]}.*\n" String projectUrl if (old.projectUrl == null) { projectUrl = quickSearchLink @@ -272,7 +330,7 @@ final class GentlePlainTextReporter implements Reporter { DependenciesGroup outdatedWithNote = new DependenciesGroup<>(outdated.count, updated) return new Result(result.count, result.current, outdatedWithNote, result.exceeded, result.undeclared, - result.unresolved, result.gradle) + result.unresolved, result.gradle) } String getFileExtension() { diff --git a/gradle/scripts/lib/java-publish.gradle b/gradle/scripts/lib/java-publish.gradle index 4ec90dbf0e..df429677ab 100644 --- a/gradle/scripts/lib/java-publish.gradle +++ b/gradle/scripts/lib/java-publish.gradle @@ -129,8 +129,11 @@ configure(projectsWithFlags('publish')) { } } - // For now, disable Gradle metadata generation until verifying it is correctly generated. - tasks.withType(GenerateModuleMetadata) { - enabled = false + // A version catalog need to publish Gradle metadata together to be correctly imported externally. + if (!hasFlags('version-catalog')) { + // For now, disable Gradle metadata generation until verifying it is correctly generated. + tasks.withType(GenerateModuleMetadata) { + enabled = false + } } } diff --git a/gradle/scripts/lib/scala.gradle b/gradle/scripts/lib/scala.gradle index 27bbdcaf7d..50305d575e 100644 --- a/gradle/scripts/lib/scala.gradle +++ b/gradle/scripts/lib/scala.gradle @@ -58,7 +58,7 @@ configure(scala212 + scala213 + scala3) { configure(scala212) { dependencies { - implementation('org.scala-lang:scala-library:2.12.15') + implementation('org.scala-lang:scala-library:2.12.17') if (managedVersions.containsKey('org.scalameta:munit_2.12')) { testImplementation "org.scalameta:munit_2.12:${managedVersions['org.scalameta:munit_2.12']}" } @@ -76,7 +76,7 @@ configure(scala212) { configure(scala213) { dependencies { - implementation 'org.scala-lang:scala-library:2.13.8' + implementation 'org.scala-lang:scala-library:2.13.9' if (managedVersions.containsKey('org.scalameta:munit_2.13')) { testImplementation "org.scalameta:munit_2.13:${managedVersions['org.scalameta:munit_2.13']}" } diff --git a/gradle/scripts/lib/thrift/0.17/thrift.linux-x86_64 b/gradle/scripts/lib/thrift/0.17/thrift.linux-x86_64 new file mode 100755 index 0000000000..7d23d52515 Binary files /dev/null and b/gradle/scripts/lib/thrift/0.17/thrift.linux-x86_64 differ diff --git a/gradle/scripts/lib/thrift/0.17/thrift.osx-aarch_64 b/gradle/scripts/lib/thrift/0.17/thrift.osx-aarch_64 new file mode 100755 index 0000000000..542a8cc0c3 Binary files /dev/null and b/gradle/scripts/lib/thrift/0.17/thrift.osx-aarch_64 differ diff --git a/gradle/scripts/lib/thrift/0.17/thrift.osx-x86_64 b/gradle/scripts/lib/thrift/0.17/thrift.osx-x86_64 new file mode 100755 index 0000000000..542a8cc0c3 Binary files /dev/null and b/gradle/scripts/lib/thrift/0.17/thrift.osx-x86_64 differ diff --git a/gradle/scripts/lib/thrift/0.17/thrift.windows-x86_64.exe b/gradle/scripts/lib/thrift/0.17/thrift.windows-x86_64.exe new file mode 100644 index 0000000000..28aa9bee75 Binary files /dev/null and b/gradle/scripts/lib/thrift/0.17/thrift.windows-x86_64.exe differ diff --git a/gradle/scripts/lib/thrift/dockerfile/Dockerfile.bionic b/gradle/scripts/lib/thrift/dockerfile/Dockerfile.bionic new file mode 100644 index 0000000000..da71113cf3 --- /dev/null +++ b/gradle/scripts/lib/thrift/dockerfile/Dockerfile.bionic @@ -0,0 +1,50 @@ +# this builds a thrift binary without library support (only for code generation) +# because Apache thrift official repo no longer maintain a binary distribution +FROM ubuntu:bionic as builder + +ENV DEBIAN_FRONTEND=noninteractive + +# see https://archive.apache.org/dist/thrift/ +ENV THRIFT_VERSION=0.17.0 + +# see https://thrift.apache.org/docs/install/debian.html +RUN apt-get update -yq && \ + apt-get install -y --no-install-recommends \ + automake \ + bison \ + binutils \ + flex \ + g++ \ + git \ + libboost-all-dev \ + libevent-dev \ + libssl-dev \ + libtool \ + make \ + pkg-config + +ADD https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz /tmp/thrift.tar.gz + +RUN echo "b272c1788bb165d99521a2599b31b97fa69e5931d099015d91ae107a0b0cc58f /tmp/thrift.tar.gz" | sha256sum -c && \ + tar xzf /tmp/thrift.tar.gz -C /tmp + +RUN cd /tmp/thrift-${THRIFT_VERSION} && \ + ./bootstrap.sh && \ + ./configure \ + --disable-debug \ + --disable-tests \ + --disable-libs \ + && \ + make -j$(nproc) && \ + make install + +FROM ubuntu:bionic + +COPY --from=builder /usr/local/bin/thrift /usr/local/bin/thrift + +# Minimizing Thrift binary size +RUN /usr/bin/strip /usr/local/bin/thrift + +ENTRYPOINT [ "/usr/local/bin/thrift" ] + +CMD [ "-help" ] diff --git a/gradle/scripts/lib/thrift/dockerfile/Dockerfile.centos7 b/gradle/scripts/lib/thrift/dockerfile/Dockerfile.centos7 new file mode 100644 index 0000000000..f47d990b2a --- /dev/null +++ b/gradle/scripts/lib/thrift/dockerfile/Dockerfile.centos7 @@ -0,0 +1,51 @@ + +# this builds a thrift binary without library support (only for code generation) +# because Apache thrift official repo no longer maintain a binary distribution +FROM centos:centos7 as builder + +ENV DEBIAN_FRONTEND=noninteractive + +# see https://archive.apache.org/dist/thrift/ +ENV THRIFT_VERSION=0.17.0 + +# see https://thrift.apache.org/docs/install/centos.html +RUN yum update -y -q && \ + yum -y groupinstall "Development Tools" && \ + yum install -y \ + automake \ + bison \ + flex \ + g++ \ + git \ + libboost-all-dev \ + libevent-dev \ + libssl-dev \ + libtool \ + make \ + pkg-config + +ADD https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz /tmp/thrift.tar.gz + +RUN echo "b272c1788bb165d99521a2599b31b97fa69e5931d099015d91ae107a0b0cc58f /tmp/thrift.tar.gz" | sha256sum -c && \ + tar xzf /tmp/thrift.tar.gz -C /tmp + +RUN cd /tmp/thrift-${THRIFT_VERSION} && \ + ./bootstrap.sh && \ + ./configure \ + --disable-debug \ + --disable-tests \ + --disable-libs \ + && \ + make -j$(nproc) && \ + make install + +FROM centos:centos7 + +COPY --from=builder /usr/local/bin/thrift /usr/local/bin/thrift + +# Minimizing Thrift binary size +RUN strip /usr/local/bin/thrift + +ENTRYPOINT [ "/usr/local/bin/thrift" ] + +CMD [ "-help" ] diff --git a/gradle/scripts/lib/thrift/dockerfile/Dockerfile.trusty b/gradle/scripts/lib/thrift/dockerfile/Dockerfile.trusty new file mode 100644 index 0000000000..808c9e50fa --- /dev/null +++ b/gradle/scripts/lib/thrift/dockerfile/Dockerfile.trusty @@ -0,0 +1,50 @@ +# this builds a thrift binary without library support (only for code generation) +# because Apache thrift official repo no longer maintain a binary distribution +FROM ubuntu:trusty as builder + +ENV DEBIAN_FRONTEND=noninteractive + +# see https://archive.apache.org/dist/thrift/ +ENV THRIFT_VERSION=0.17.0 + +# see https://thrift.apache.org/docs/install/debian.html +RUN apt-get update -yq && \ + apt-get install -y --no-install-recommends \ + automake \ + bison \ + binutils \ + flex \ + g++ \ + git \ + libboost-all-dev \ + libevent-dev \ + libssl-dev \ + libtool \ + make \ + pkg-config + +ADD https://archive.apache.org/dist/thrift/${THRIFT_VERSION}/thrift-${THRIFT_VERSION}.tar.gz /tmp/thrift.tar.gz + +RUN echo "b272c1788bb165d99521a2599b31b97fa69e5931d099015d91ae107a0b0cc58f /tmp/thrift.tar.gz" | sha256sum -c && \ + tar xzf /tmp/thrift.tar.gz -C /tmp + +RUN cd /tmp/thrift-${THRIFT_VERSION} && \ + ./bootstrap.sh && \ + ./configure \ + --disable-debug \ + --disable-tests \ + --disable-libs \ + && \ + make -j$(nproc) && \ + make install + +FROM ubuntu:trusty + +COPY --from=builder /usr/local/bin/thrift /usr/local/bin/thrift + +# Minimizing Thrift binary size +RUN /usr/bin/strip /usr/local/bin/thrift + +ENTRYPOINT [ "/usr/local/bin/thrift" ] + +CMD [ "-help" ] diff --git a/gradle/scripts/settings-flags.gradle b/gradle/scripts/settings-flags.gradle index 2c13b7dde4..afc451dc19 100644 --- a/gradle/scripts/settings-flags.gradle +++ b/gradle/scripts/settings-flags.gradle @@ -4,9 +4,9 @@ import java.util.concurrent.ConcurrentHashMap import static java.util.Objects.requireNonNull -// version catalogs should be defined in the settings.gradle or directly imported files. +// A version catalog should be defined in the settings.gradle or directly imported files. // https://docs.gradle.org/current/userguide/platforms.html#sub:version-catalog-declaration -apply from: "${rootDir}/gradle/scripts/version-catalogs.gradle" +apply from: "${rootDir}/gradle/scripts/version-catalog.gradle" // Ensure the Gradle version first of all. GradleVersion minimumSupportedGradleVersion = GradleVersion.version('6.0') @@ -101,6 +101,11 @@ static def addFlags(Set actualFlags, ...flags) { actualFlags.add('publish') } + // 'version-catalog' implies 'publish'. + if (actualFlags.contains('version-catalog')) { + actualFlags.add('publish') + } + return Collections.unmodifiableSet(actualFlags) } diff --git a/gradle/scripts/version-catalogs.gradle b/gradle/scripts/version-catalog.gradle similarity index 78% rename from gradle/scripts/version-catalogs.gradle rename to gradle/scripts/version-catalog.gradle index ac22c28a20..ebb05d31f2 100644 --- a/gradle/scripts/version-catalogs.gradle +++ b/gradle/scripts/version-catalog.gradle @@ -95,8 +95,37 @@ if (dependenciesTomlFile.exists()) { } } -static def addVersion(VersionCatalogBuilder libs, String alias, String version) { - libs.version(alias, version) +static def addVersion(VersionCatalogBuilder libs, String alias, Object version) { + if (version instanceof String) { + libs.version(alias, version) + } else if (version instanceof TomlTable) { + libs.version(alias) { setRichVersion(it, version) } + } else { + throw new IllegalStateException("An invalid vesion declaration on ${alias}: ${version} (expected: string or objects compatible with MutableVersionConstraint)"); + } +} + +private static String setRichVersion(MutableVersionConstraint constraint, TomlTable version) { + if (version.contains("require")) { + constraint.require(version["require"]) + } + if (version.contains("strictly")) { + constraint.strictly(version["strictly"]) + } + if (version.contains("prefer")) { + constraint.prefer(version["prefer"]) + } + if (version.contains("reject")) { + def rejected = version["reject"] + if (rejected instanceof TomlArray) { + constraint.reject(rejected.toList() as String[]) + } else { + constraint.reject(rejected) + } + } + if (version["rejectAll"]) { + constraint.rejectAll() + } } static def addBom(VersionCatalogBuilder libs, String alias, TomlTable dependency, List boms) { @@ -134,28 +163,7 @@ static def addLibrary(VersionCatalogBuilder libs, String alias, TomlTable depend if (version.contains("ref")) { library.versionRef(version["ref"]) } else { - library.version { - if (version.contains("require")) { - require(version["require"]) - } - if (version.contains("strictly")) { - strictly(version["strictly"]) - } - if (version.contains("prefer")) { - prefer(version["prefer"]) - } - if (version.contains("reject")) { - def rejected = version["reject"] - if (rejected instanceof TomlArray) { - reject(rejected.toList() as String[]) - } else { - reject(rejected) - } - } - if (version["rejectAll"]) { - rejectAll() - } - } + library.version { setRichVersion(it, version) } } } @@ -252,34 +260,35 @@ static def addPlugin(VersionCatalogBuilder libs, String alias, TomlTable plugin) gradle.projectsLoaded { gradle.rootProject { p -> - // Prints all versions registered through 'dependencies.toml' - p.tasks.register("printVersionCatalogs") { - def catalogs = p.extensions.getByType(VersionCatalogsExtension) - doLast { - catalogs.catalogNames.forEach { name -> - def catalog = catalogs.named(name) - catalog.libraryAliases.forEach { - def library = catalog.findLibrary(it).get().get() - println "$name / library / $it / $library" - } + if (p.ext.hasDependenciesToml) { + // Prints all versions registered through 'dependencies.toml' + p.tasks.register("printVersionCatalogs") { + def catalogs = p.extensions.getByType(VersionCatalogsExtension) + doLast { + catalogs.catalogNames.forEach { name -> + def catalog = catalogs.named(name) + catalog.libraryAliases.forEach { + def library = catalog.findLibrary(it).get().get() + println "$name / library / $it / $library" + } - catalog.pluginAliases.forEach { - def plugin = catalog.findPlugin(it).get().get() - println "$name / plugin / $it / $plugin" - } + catalog.pluginAliases.forEach { + def plugin = catalog.findPlugin(it).get().get() + println "$name / plugin / $it / $plugin" + } - catalog.versionAliases.forEach { - def version = catalog.findVersion(it).get() - println "$name / version / $it / $version" - } + catalog.versionAliases.forEach { + def version = catalog.findVersion(it).get() + println "$name / version / $it / $version" + } - catalog.bundleAliases.forEach { - def bundle = catalog.findBundle(it).get().get() - println "$name / bundle / $it / $bundle" + catalog.bundleAliases.forEach { + def bundle = catalog.findBundle(it).get().get() + println "$name / bundle / $it / $bundle" + } } } } } - } } diff --git a/it/src/test/java/com/linecorp/centraldogma/it/CentralDogmaEndpointGroupTest.java b/it/src/test/java/com/linecorp/centraldogma/it/CentralDogmaEndpointGroupTest.java index f83983d43b..5fc377d35e 100644 --- a/it/src/test/java/com/linecorp/centraldogma/it/CentralDogmaEndpointGroupTest.java +++ b/it/src/test/java/com/linecorp/centraldogma/it/CentralDogmaEndpointGroupTest.java @@ -40,8 +40,10 @@ import com.linecorp.centraldogma.client.armeria.EndpointListDecoder; import com.linecorp.centraldogma.common.Change; import com.linecorp.centraldogma.common.Query; +import com.linecorp.centraldogma.testing.internal.FlakyTest; import com.linecorp.centraldogma.testing.junit.CentralDogmaExtension; +@FlakyTest class CentralDogmaEndpointGroupTest { private static final List HOST_AND_PORT_LIST = ImmutableList.of( diff --git a/it/src/test/java/com/linecorp/centraldogma/it/ReplicationWriteQuotaTest.java b/it/src/test/java/com/linecorp/centraldogma/it/ReplicationWriteQuotaTest.java index ae15ec1db6..462896ebd5 100644 --- a/it/src/test/java/com/linecorp/centraldogma/it/ReplicationWriteQuotaTest.java +++ b/it/src/test/java/com/linecorp/centraldogma/it/ReplicationWriteQuotaTest.java @@ -47,10 +47,12 @@ import com.linecorp.centraldogma.server.ZooKeeperReplicationConfig; import com.linecorp.centraldogma.server.ZooKeeperServerConfig; import com.linecorp.centraldogma.server.auth.AuthProviderFactory; +import com.linecorp.centraldogma.testing.internal.FlakyTest; import com.linecorp.centraldogma.testing.internal.TemporaryFolderExtension; import com.linecorp.centraldogma.testing.internal.auth.TestAuthMessageUtil; import com.linecorp.centraldogma.testing.internal.auth.TestAuthProviderFactory; +@FlakyTest class ReplicationWriteQuotaTest extends WriteQuotaTestBase { private static final AuthProviderFactory factory = new TestAuthProviderFactory(); diff --git a/server/package-lock.json b/server/package-lock.json index de5df8b39b..100ded60e9 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -23,7 +23,7 @@ "angular-ui-bootstrap": "2.2.0", "angular-ui-notification": "0.2.0", "angular-ui-router": "0.3.2", - "bootstrap": "4.3.1", + "bootstrap": "3.3.7", "bootswatch": "3.3.7", "diff": "3.0.1", "fast-json-patch": "1.1.1", @@ -135,15 +135,11 @@ } }, "node_modules/bootstrap": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.3.1.tgz", - "integrity": "sha512-rXqOmH1VilAt2DyPzluTi2blhk17bO7ef+zLLPlWvG494pDxcM234pJ8wTc/6R40UWizAIIMgxjvxZg5kmsbag==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.3.7.tgz", + "integrity": "sha512-qcFaisBrcBhTFkz1IUnGDYnX6ZWfFzH8zOixUDtHW9Ip+r+7MfMFav2rzy7cIHc7rgIg7xjhWBoo1mS/U26j4g==", "engines": { - "node": ">=6" - }, - "peerDependencies": { - "jquery": "1.9.1 - 3", - "popper.js": "^1.14.7" + "node": ">=0.10.1" } }, "node_modules/bootswatch": { @@ -188,17 +184,6 @@ "engines": { "node": "*" } - }, - "node_modules/popper.js": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz", - "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==", - "deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1", - "peer": true, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/popperjs" - } } }, "dependencies": { @@ -296,10 +281,9 @@ } }, "bootstrap": { - "version": "4.3.1", - "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.3.1.tgz", - "integrity": "sha512-rXqOmH1VilAt2DyPzluTi2blhk17bO7ef+zLLPlWvG494pDxcM234pJ8wTc/6R40UWizAIIMgxjvxZg5kmsbag==", - "requires": {} + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-3.3.7.tgz", + "integrity": "sha512-qcFaisBrcBhTFkz1IUnGDYnX6ZWfFzH8zOixUDtHW9Ip+r+7MfMFav2rzy7cIHc7rgIg7xjhWBoo1mS/U26j4g==" }, "bootswatch": { "version": "3.3.7", @@ -330,12 +314,6 @@ "version": "2.16.0", "resolved": "https://registry.npmjs.org/moment/-/moment-2.16.0.tgz", "integrity": "sha512-Jmy+b0/BMklLlYBzrClLstnS9Wn/WzYnmM2ub8wjdIJhp8UnbTTIHLLZpEsgmPTPgjFnXbTe32XYKYkadf9qJQ==" - }, - "popper.js": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz", - "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==", - "peer": true } } } diff --git a/server/package.json b/server/package.json index 83f05c352e..19a3cedeaf 100644 --- a/server/package.json +++ b/server/package.json @@ -19,7 +19,7 @@ "angular-ui-bootstrap": "2.2.0", "angular-ui-notification": "0.2.0", "angular-ui-router": "0.3.2", - "bootstrap": "4.3.1", + "bootstrap": "3.3.7", "bootswatch": "3.3.7", "diff": "3.0.1", "fast-json-patch": "1.1.1", diff --git a/server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java b/server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java index b9934b4a44..52a0f6c0a4 100644 --- a/server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java +++ b/server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/GitMirror.java @@ -104,7 +104,7 @@ public final class GitMirror extends AbstractMirror { private static final Pattern DISALLOWED_CHARS = Pattern.compile("[^-_a-zA-Z]"); private static final Pattern CONSECUTIVE_UNDERSCORES = Pattern.compile("_+"); - private static final int GIT_TIMEOUT_SECS = 10; + private static final int GIT_TIMEOUT_SECS = 60; @Nullable private IgnoreNode ignoreNode; diff --git a/server/src/test/java/com/linecorp/centraldogma/server/auth/ReplicatedLoginAndLogoutTest.java b/server/src/test/java/com/linecorp/centraldogma/server/auth/ReplicatedLoginAndLogoutTest.java index 59518c06ed..2d70d2c9ed 100644 --- a/server/src/test/java/com/linecorp/centraldogma/server/auth/ReplicatedLoginAndLogoutTest.java +++ b/server/src/test/java/com/linecorp/centraldogma/server/auth/ReplicatedLoginAndLogoutTest.java @@ -54,9 +54,11 @@ import com.linecorp.centraldogma.server.GracefulShutdownTimeout; import com.linecorp.centraldogma.server.ZooKeeperReplicationConfig; import com.linecorp.centraldogma.server.ZooKeeperServerConfig; +import com.linecorp.centraldogma.testing.internal.FlakyTest; import com.linecorp.centraldogma.testing.internal.TemporaryFolderExtension; import com.linecorp.centraldogma.testing.internal.auth.TestAuthProviderFactory; +@FlakyTest class ReplicatedLoginAndLogoutTest { @RegisterExtension diff --git a/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ReplicationLogTest.java b/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ReplicationLogTest.java index effefa96be..bc82e83f44 100644 --- a/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ReplicationLogTest.java +++ b/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ReplicationLogTest.java @@ -30,7 +30,9 @@ import com.linecorp.centraldogma.server.command.CommitResult; import com.linecorp.centraldogma.server.command.NormalizingPushCommand; import com.linecorp.centraldogma.server.command.PushAsIsCommand; +import com.linecorp.centraldogma.testing.internal.FlakyTest; +@FlakyTest class ReplicationLogTest { private static final Author AUTHOR = new Author("foo", "bar@baz.com"); diff --git a/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/StartStopWithoutInitialQuorumTest.java b/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/StartStopWithoutInitialQuorumTest.java index 02ba432553..91ff1845c5 100644 --- a/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/StartStopWithoutInitialQuorumTest.java +++ b/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/StartStopWithoutInitialQuorumTest.java @@ -28,11 +28,13 @@ import com.linecorp.centraldogma.server.CentralDogmaBuilder; import com.linecorp.centraldogma.server.ZooKeeperReplicationConfig; import com.linecorp.centraldogma.server.ZooKeeperServerConfig; +import com.linecorp.centraldogma.testing.internal.FlakyTest; import com.linecorp.centraldogma.testing.junit.CentralDogmaExtension; /** * Makes sure that we can stop a replica that's waiting for the initial quorum. */ +@FlakyTest class StartStopWithoutInitialQuorumTest { @RegisterExtension diff --git a/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ZooKeeperCommandExecutorTest.java b/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ZooKeeperCommandExecutorTest.java index fb24584438..ad18a6f80d 100644 --- a/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ZooKeeperCommandExecutorTest.java +++ b/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ZooKeeperCommandExecutorTest.java @@ -66,7 +66,9 @@ import com.linecorp.centraldogma.server.command.CommitResult; import com.linecorp.centraldogma.server.command.NormalizingPushCommand; import com.linecorp.centraldogma.server.command.PushAsIsCommand; +import com.linecorp.centraldogma.testing.internal.FlakyTest; +@FlakyTest class ZooKeeperCommandExecutorTest { private static final Logger logger = LoggerFactory.getLogger(ZooKeeperCommandExecutorTest.class); diff --git a/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ZooKeeperQuotaTest.java b/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ZooKeeperQuotaTest.java index ea82431ac9..f62ac0ce06 100644 --- a/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ZooKeeperQuotaTest.java +++ b/server/src/test/java/com/linecorp/centraldogma/server/internal/replication/ZooKeeperQuotaTest.java @@ -34,7 +34,9 @@ import com.linecorp.centraldogma.server.QuotaConfig; import com.linecorp.centraldogma.server.command.Command; import com.linecorp.centraldogma.server.command.CommitResult; +import com.linecorp.centraldogma.testing.internal.FlakyTest; +@FlakyTest class ZooKeeperQuotaTest { private static final int MAX_QUOTA = 3; diff --git a/site/src/sphinx/_static/add_badges.js b/site/src/sphinx/_static/add_badges.js index 04ef2ead89..52b0967abc 100644 --- a/site/src/sphinx/_static/add_badges.js +++ b/site/src/sphinx/_static/add_badges.js @@ -42,9 +42,9 @@ function addBadges(parent) { 'https://codecov.io/gh/line/centraldogma'); var ciImg = new Image(); - ciImg.src = 'https://github.com/line/centraldogma/actions/workflows/gradle.yml/badge.svg'; + ciImg.src = 'https://github.com/line/centraldogma/actions/workflows/actions_build.yml/badge.svg'; addBadge(div, ciImg, - 'https://github.com/line/centraldogma/actions/workflows/gradle.yml'); + 'https://github.com/line/centraldogma/actions/workflows/actions_build.yml'); li.appendChild(div); parent.appendChild(li); diff --git a/testing-internal/src/main/java/com/linecorp/centraldogma/testing/internal/FlakyTest.java b/testing-internal/src/main/java/com/linecorp/centraldogma/testing/internal/FlakyTest.java new file mode 100644 index 0000000000..1cd9b63cae --- /dev/null +++ b/testing-internal/src/main/java/com/linecorp/centraldogma/testing/internal/FlakyTest.java @@ -0,0 +1,32 @@ +/* + * Copyright 2022 LINE Corporation + * + * LINE Corporation licenses this file to you 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: + * + * https://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.linecorp.centraldogma.testing.internal; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.junit.jupiter.api.Tag; + +@Inherited +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Tag("FLAKY_TESTS") +public @interface FlakyTest { +}