diff --git a/ci/README.adoc b/ci/README.adoc deleted file mode 100644 index 71c8918..0000000 --- a/ci/README.adoc +++ /dev/null @@ -1,32 +0,0 @@ -== Concourse pipeline - - - -=== Updating -To add a new smoke test, modify `ci/smoke-tests.yml`. -An updated pipeline is then generated using https://carvel.dev/ytt[`ytt`]. -With `ytt` installed, run the following command: - -[source] ----- -ytt -f ci/pipeline-template/schema.yml -f ci/pipeline-template/pipeline.yml --data-values-file ci/smoke-tests.yml > ci/pipeline.yml ----- - - - -== Deploying -Ensure that you've set up the `spring-lifecycle-smoke-tests` target and can login: - -[source] ----- -$ fly -t spring-lifecycle-smoke-tests login -n spring-lifecycle-smoke-tests -c https://ci.spring.io ----- - -Deploy the pipeline using the following command: - -[source] ----- -$ fly -t spring-lifecycle-smoke-tests set-pipeline -p spring-lifecycle-smoke-tests-3.3.x -c ci/pipeline.yml ----- - -NOTE: This assumes that you have Vault integration configured with the appropriate secrets. diff --git a/ci/config/changelog-generator.yml b/ci/config/changelog-generator.yml deleted file mode 100644 index 64fda2f..0000000 --- a/ci/config/changelog-generator.yml +++ /dev/null @@ -1,17 +0,0 @@ -changelog: - repository: spring-gradle-plugins/dependency-management-plugin - sections: - - title: ":star: New Features" - labels: - - "type: enhancement" - - title: ":lady_beetle: Bug Fixes" - labels: - - "type: bug" - - "type: regression" - - title: ":notebook_with_decorative_cover: Documentation" - labels: - - "type: documentation" - - title: ":hammer: Dependency Upgrades" - sort: "title" - labels: - - "type: dependency-upgrade" diff --git a/ci/config/release-scripts.yml b/ci/config/release-scripts.yml deleted file mode 100644 index ead5d30..0000000 --- a/ci/config/release-scripts.yml +++ /dev/null @@ -1,9 +0,0 @@ -logging: - level: - io.spring.concourse: DEBUG -spring: - main: - banner-mode: off -sonatype: - exclude: - - 'build-info\.json' diff --git a/ci/images/README.adoc b/ci/images/README.adoc deleted file mode 100644 index 92fa3c2..0000000 --- a/ci/images/README.adoc +++ /dev/null @@ -1,21 +0,0 @@ -== CI Images - -These images are used by CI to run the actual builds. - -To build the image locally run the following from this directory: - ----- -$ docker build --no-cache -f /Dockerfile . ----- - -For example - ----- -$ docker build --no-cache -f ci-image/Dockerfile . ----- - -To test run: - ----- -$ docker run -it --entrypoint /bin/bash ----- diff --git a/ci/images/ci-image/Dockerfile b/ci/images/ci-image/Dockerfile deleted file mode 100644 index 7e63599..0000000 --- a/ci/images/ci-image/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM ubuntu:focal-20220531 - -ADD setup.sh /setup.sh -ADD get-crac-jdk-url.sh /get-crac-jdk-url.sh -ADD get-docker-url.sh /get-docker-url.sh -ADD get-ytt-url.sh /get-ytt-url.sh -ADD get-docker-compose-url.sh /get-docker-compose-url.sh -ADD get-gradle-url.sh /get-gradle-url.sh -RUN ./setup.sh - -ENV JAVA_HOME /opt/crac-jdk -ENV PATH $JAVA_HOME/bin:/opt/ytt/bin:/opt/docker-compose/bin:/opt/gradle/bin:$PATH -ENV GRADLE_OPTS -Dorg.gradle.project.buildDir=/tmp/gradle-build -RUN git config --global --add safe.directory /workspace -ADD docker-lib.sh /docker-lib.sh diff --git a/ci/images/docker-lib.sh b/ci/images/docker-lib.sh deleted file mode 100755 index eac9c2e..0000000 --- a/ci/images/docker-lib.sh +++ /dev/null @@ -1,97 +0,0 @@ -# Based on: https://github.com/concourse/docker-image-resource/blob/master/assets/common.sh - -DOCKER_LOG_FILE=${DOCKER_LOG_FILE:-/tmp/docker.log} -SKIP_PRIVILEGED=${SKIP_PRIVILEGED:-false} -STARTUP_TIMEOUT=${STARTUP_TIMEOUT:-120} - -sanitize_cgroups() { - mkdir -p /sys/fs/cgroup - mountpoint -q /sys/fs/cgroup || \ - mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup - - mount -o remount,rw /sys/fs/cgroup - - sed -e 1d /proc/cgroups | while read sys hierarchy num enabled; do - if [ "$enabled" != "1" ]; then - # subsystem disabled; skip - continue - fi - - grouping="$(cat /proc/self/cgroup | cut -d: -f2 | grep "\\<$sys\\>")" || true - if [ -z "$grouping" ]; then - # subsystem not mounted anywhere; mount it on its own - grouping="$sys" - fi - - mountpoint="/sys/fs/cgroup/$grouping" - - mkdir -p "$mountpoint" - - # clear out existing mount to make sure new one is read-write - if mountpoint -q "$mountpoint"; then - umount "$mountpoint" - fi - - mount -n -t cgroup -o "$grouping" cgroup "$mountpoint" - - if [ "$grouping" != "$sys" ]; then - if [ -L "/sys/fs/cgroup/$sys" ]; then - rm "/sys/fs/cgroup/$sys" - fi - - ln -s "$mountpoint" "/sys/fs/cgroup/$sys" - fi - done - - if ! test -e /sys/fs/cgroup/systemd ; then - mkdir /sys/fs/cgroup/systemd - mount -t cgroup -o none,name=systemd none /sys/fs/cgroup/systemd - fi -} - -start_docker() { - mkdir -p /var/log - mkdir -p /var/run - - if [ "$SKIP_PRIVILEGED" = "false" ]; then - sanitize_cgroups - - # check for /proc/sys being mounted readonly, as systemd does - if grep '/proc/sys\s\+\w\+\s\+ro,' /proc/mounts >/dev/null; then - mount -o remount,rw /proc/sys - fi - fi - - local mtu=$(cat /sys/class/net/$(ip route get 8.8.8.8|awk '{ print $5 }')/mtu) - local server_args="--mtu ${mtu}" - local registry="" - - server_args="${server_args}" - - if [ -n "$1" ]; then - server_args="${server_args} --registry-mirror https://$1" - fi - - try_start() { - dockerd --data-root /scratch/docker ${server_args} >$DOCKER_LOG_FILE 2>&1 & - echo $! > /tmp/docker.pid - - sleep 1 - - echo waiting for docker to come up... - until docker info >/dev/null 2>&1; do - sleep 1 - if ! kill -0 "$(cat /tmp/docker.pid)" 2>/dev/null; then - return 1 - fi - done - } - - export server_args DOCKER_LOG_FILE - declare -fx try_start - - if ! timeout ${STARTUP_TIMEOUT} bash -ce 'while true; do try_start && break; done'; then - echo Docker failed to start within ${STARTUP_TIMEOUT} seconds. - return 1 - fi -} diff --git a/ci/images/get-crac-jdk-url.sh b/ci/images/get-crac-jdk-url.sh deleted file mode 100755 index 8020170..0000000 --- a/ci/images/get-crac-jdk-url.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e - -case $ARCH in - aarch64) echo "https://cdn.azul.com/zulu/bin/zulu17.44.17-ca-crac-jdk17.0.8-linux_aarch64.tar.gz" ;; - *) echo "https://cdn.azul.com/zulu/bin/zulu17.44.17-ca-crac-jdk17.0.8-linux_x64.tar.gz" ;; -esac - diff --git a/ci/images/get-docker-compose-url.sh b/ci/images/get-docker-compose-url.sh deleted file mode 100755 index 99b99b8..0000000 --- a/ci/images/get-docker-compose-url.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -e - -VERSION="2.20.2" -echo "https://github.com/docker/compose/releases/download/v$VERSION/docker-compose-linux-$ARCH" diff --git a/ci/images/get-docker-url.sh b/ci/images/get-docker-url.sh deleted file mode 100755 index ea32d7e..0000000 --- a/ci/images/get-docker-url.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -e - -VERSION="24.0.5" -echo "https://download.docker.com/linux/static/stable/$ARCH/docker-$VERSION.tgz" diff --git a/ci/images/get-gradle-url.sh b/ci/images/get-gradle-url.sh deleted file mode 100755 index 9412525..0000000 --- a/ci/images/get-gradle-url.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -set -e - -VERSION="8.7" -echo "https://services.gradle.org/distributions/gradle-$VERSION-bin.zip" diff --git a/ci/images/get-ytt-url.sh b/ci/images/get-ytt-url.sh deleted file mode 100755 index 9152327..0000000 --- a/ci/images/get-ytt-url.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash -set -e - -VERSION=0.41.1 -case $ARCH in - aarch64) FILE="ytt-linux-arm64" ;; - *) FILE="ytt-linux-amd64" ;; -esac -echo https://github.com/vmware-tanzu/carvel-ytt/releases/download/v$VERSION/$FILE \ No newline at end of file diff --git a/ci/images/setup.sh b/ci/images/setup.sh deleted file mode 100755 index 1d1f670..0000000 --- a/ci/images/setup.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -set -ex - -export ARCH=$(uname -m) - -########################################################### -# UTILS -########################################################### - -export DEBIAN_FRONTEND=noninteractive -apt-get update -apt-get install --no-install-recommends -y tzdata ca-certificates net-tools libxml2-utils git curl libudev1 libxml2-utils iptables iproute2 jq unzip build-essential libz-dev libfreetype-dev nano libarchive-tools -ln -fs /usr/share/zoneinfo/UTC /etc/localtime -dpkg-reconfigure --frontend noninteractive tzdata -rm -rf /var/lib/apt/lists/* - -curl https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v0.0.4/concourse-java.sh > /opt/concourse-java.sh - -mkdir -p /opt/ytt/bin -YTT_URL=$( ./get-ytt-url.sh ) -curl --location $YTT_URL > /opt/ytt/bin/ytt -chmod +x /opt/ytt/bin/ytt - -########################################################### -# CRaC JDK -########################################################### -CRAC_JDK_URL=$( ./get-crac-jdk-url.sh ) - -mkdir -p /opt/crac-jdk -cd /opt/crac-jdk -curl -L ${CRAC_JDK_URL} | tar zx --strip-components=1 -test -f /opt/crac-jdk/bin/java -test -f /opt/crac-jdk/bin/javac -echo 'ulimit -n 1024' >> /root/.bashrc - -########################################################### -# DOCKER -########################################################### -cd / -DOCKER_URL=$( ./get-docker-url.sh ) -curl -L ${DOCKER_URL} | tar zx -mv /docker/* /bin/ -chmod +x /bin/docker* - -########################################################### -# DOCKER COMPOSE -########################################################### -mkdir -p /opt/docker-compose/bin -DOCKER_COMPOSE_URL=$( ./get-docker-compose-url.sh ) -curl --location $DOCKER_COMPOSE_URL > /opt/docker-compose/bin/docker-compose -chmod +x /opt/docker-compose/bin/docker-compose - -########################################################### -# GRADLE -########################################################### -GRADLE_URL=$( /get-gradle-url.sh ) -mkdir -p /opt/gradle -cd /opt/gradle -curl -L $GRADLE_URL | bsdtar --strip-components=1 -xvf- -chmod +x /opt/gradle/bin/gradle diff --git a/ci/pipeline-template/pipeline.yml b/ci/pipeline-template/pipeline.yml deleted file mode 100644 index f638344..0000000 --- a/ci/pipeline-template/pipeline.yml +++ /dev/null @@ -1,227 +0,0 @@ -#@ github = { -#@ "organization": "spring-projects", -#@ "repository": "spring-lifecycle-smoke-tests", -#@ "uri": "https://github.com/spring-projects/spring-lifecycle-smoke-tests.git" -#@ } -#@ docker_hub = { -#@ "organization": "springci" -#@ } -#@ branch = "main" -#@ milestone = "3.3.x" -#@ task_timeout = "1h00m" - -#@ load("@ytt:data", "data") - -#@ total_tests = 0 -#@ for group in data.values.groups: -#@ for smoke_test in group.smoke_tests: -#@ if smoke_test.app_test: -#@ total_tests += 1 -#@ end -#@ if smoke_test.test: -#@ total_tests += 1 -#@ end -#@ end -#@ end -#@ total_tests = total_tests + 1 -#@ test_interval = (60 * 24) // total_tests -#@ trigger_times = [] -#@ for x in range(total_tests): -#@ hours = str((x * test_interval) // 60) -#@ if (len(hours) == 1): -#@ hours = "0" + hours -#@ end -#@ minutes = str((x * test_interval) % 60) -#@ if (len(minutes) == 1): -#@ minutes = "0" + minutes -#@ end -#@ trigger_times.append(hours + ":" + minutes) -#@ end -#@ test_index = 0 - -resources: -- name: git-repo - type: git - icon: github - source: - uri: #@ github["uri"] - username: ((github-username)) - password: ((github-password)) - branch: #@ branch -- name: ci-images-git-repo - type: git - icon: github - source: - uri: #@ github["uri"] - branch: #@ branch - paths: - - "ci/images/*" -- name: ci-image - type: registry-image - icon: docker - source: - username: ((docker-hub-username)) - password: ((docker-hub-password)) - tag: #@ milestone - repository: #@ docker_hub["organization"] + "/" + github["repository"] + "-ci" -#@ for group in data.values.groups: -#@ for smoke_test in group.smoke_tests: -#@ if smoke_test.app_test: -- name: #@ "time-" + smoke_test.name + "-app-test" - type: time - icon: clock-outline - source: - interval: 24h - start: #@ trigger_times[test_index] - stop: #@ trigger_times[test_index + 1] -#@ test_index += 1 -#@ end -#@ if smoke_test.test: -- name: #@ "time-" + smoke_test.name + "-test" - type: time - icon: clock-outline - source: - interval: 24h - start: #@ trigger_times[test_index] - stop: #@ trigger_times[test_index + 1] -#@ test_index += 1 -#@ end -#@ end -#@ end -jobs: -- name: build-ci-images - plan: - - get: ci-images-git-repo - trigger: true - - get: git-repo - - task: build-ci-image - privileged: true - file: git-repo/ci/tasks/build-ci-image.yml - output_mapping: - image: ci-image - vars: - ci-image-name: ci-image - - put: ci-image - params: - image: ci-image/image.tar -- name: update-pipeline - plan: - - get: ci-image - - get: git-repo - trigger: true - - do: - - task: update_pipeline - image: ci-image - file: git-repo/ci/tasks/update-pipeline.yml - - set_pipeline: self - file: git-repo/ci/pipeline.yml -#@ for group in data.values.groups: -#@ for smoke_test in group.smoke_tests: -#@ if smoke_test.app_test: -- name: #@ smoke_test.name + "-app-test" - serial: true - public: true - plan: - - get: ci-image - - get: git-repo - - get: #@ "time-" + smoke_test.name + "-app-test" - trigger: true - - do: - - task: app-test - image: ci-image - privileged: true - timeout: #@ task_timeout - file: git-repo/ci/tasks/smoke-test.yml - params: - BRANCH: #@ branch - SMOKE_TEST: #@ group.name + ":" + smoke_test.name - TASK: appTest - DOCKER_HUB_AUTH: ((docker-hub-auth)) - DOCKER_HUB_MIRROR: ((docker-hub-mirror)) - GRADLE_ENTERPRISE_ACCESS_KEY: ((gradle_enterprise_secret_access_key)) - GRADLE_ENTERPRISE_CACHE_USERNAME: ((gradle_enterprise_cache_user.username)) - GRADLE_ENTERPRISE_CACHE_PASSWORD: ((gradle_enterprise_cache_user.password)) -- name: #@ smoke_test.name + "-cr-app-test" - serial: true - public: true - plan: - - get: ci-image - - get: git-repo - - get: #@ "time-" + smoke_test.name + "-app-test" - trigger: true - - do: - - task: cr-app-test - image: ci-image - privileged: true - timeout: #@ task_timeout - file: git-repo/ci/tasks/smoke-test.yml - params: - BRANCH: #@ branch - SMOKE_TEST: #@ group.name + ":" + smoke_test.name - TASK: checkpointRestoreAppTest - DOCKER_HUB_AUTH: ((docker-hub-auth)) - DOCKER_HUB_MIRROR: ((docker-hub-mirror)) - GRADLE_ENTERPRISE_ACCESS_KEY: ((gradle_enterprise_secret_access_key)) - GRADLE_ENTERPRISE_CACHE_USERNAME: ((gradle_enterprise_cache_user.username)) - GRADLE_ENTERPRISE_CACHE_PASSWORD: ((gradle_enterprise_cache_user.password)) -#@ end -#@ if smoke_test.test: -- name: #@ smoke_test.name + "-test" - serial: true - public: true - plan: - - get: ci-image - - get: git-repo - - get: #@ "time-" + smoke_test.name + "-test" - trigger: true - - do: - - task: test - image: ci-image - privileged: true - timeout: #@ task_timeout - file: git-repo/ci/tasks/smoke-test.yml - params: - BRANCH: #@ branch - SMOKE_TEST: #@ group.name + ":" + smoke_test.name - TASK: test - DOCKER_HUB_MIRROR: ((docker-hub-mirror)) - GRADLE_ENTERPRISE_ACCESS_KEY: ((gradle_enterprise_secret_access_key)) - GRADLE_ENTERPRISE_CACHE_USERNAME: ((gradle_enterprise_cache_user.username)) - GRADLE_ENTERPRISE_CACHE_PASSWORD: ((gradle_enterprise_cache_user.password)) -#@ end -#@ end -#@ end -groups: -#@ for group in data.values.groups: -#@ app_tests = [] -#@ for smoke_test in group.smoke_tests: -#@ if smoke_test.app_test: -#@ app_tests.append(smoke_test.name + "-app-test") -#@ app_tests.append(smoke_test.name + "-cr-app-test") -#@ end -#@ end -#@ if len(app_tests) > 0: -- name: #@ group.name + "-app-tests" - jobs: -#@ for app_test in app_tests: - - #@ app_test -#@ end -#@ end -#@ tests = [] -#@ for smoke_test in group.smoke_tests: -#@ if smoke_test.test: -#@ tests.append(smoke_test.name + "-test") -#@ end -#@ end -#@ if len(tests) > 0: -- name: #@ group.name + "-tests" - jobs: -#@ for test in tests: - - #@ test -#@ end -#@ end -#@ end -- name: "infrastructure" - jobs: - - "build-ci-images" - - "update-pipeline" \ No newline at end of file diff --git a/ci/pipeline-template/schema.yml b/ci/pipeline-template/schema.yml deleted file mode 100644 index ab714f0..0000000 --- a/ci/pipeline-template/schema.yml +++ /dev/null @@ -1,8 +0,0 @@ -#@data/values-schema ---- -groups: - - name: "group name" - smoke_tests: - - name: "smoke test name" - app_test: true - test: true \ No newline at end of file diff --git a/ci/scripts/common.sh b/ci/scripts/common.sh deleted file mode 100644 index bba8ac4..0000000 --- a/ci/scripts/common.sh +++ /dev/null @@ -1,5 +0,0 @@ -source /opt/concourse-java.sh - -setup_symlinks - -echo 'systemProp.user.name=concourse' > ~/.gradle/gradle.properties diff --git a/ci/scripts/smoke-test.sh b/ci/scripts/smoke-test.sh deleted file mode 100755 index 80471e6..0000000 --- a/ci/scripts/smoke-test.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -set -e - -source $(dirname $0)/common.sh - -pushd git-repo > /dev/null -gradle --no-daemon ${SMOKE_TEST}:${TASK} -popd > /dev/null diff --git a/ci/scripts/update-pipeline.sh b/ci/scripts/update-pipeline.sh deleted file mode 100755 index 1c4a9d8..0000000 --- a/ci/scripts/update-pipeline.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -set -e - -pushd git-repo > /dev/null -ytt -f ci/pipeline-template/schema.yml -f ci/pipeline-template/pipeline.yml --data-values-file ci/smoke-tests.yml > ci/pipeline.yml -popd > /dev/null diff --git a/ci/smoke-tests.yml b/ci/smoke-tests.yml deleted file mode 100644 index 920e2b0..0000000 --- a/ci/smoke-tests.yml +++ /dev/null @@ -1,114 +0,0 @@ -groups: - - name: boot - smoke_tests: - - name: actuator-webflux - app_test: true - test: false - - name: actuator-webmvc - app_test: true - test: false - - name: cloud - smoke_tests: - - name: context-refresh - app_test: true - test: true - - name: context-refresh-hikari - app_test: true - test: false - - name: context-refresh-http - app_test: true - test: true - - name: loadbalancing - app_test: true - test: false - - name: data - smoke_tests: - - name: data-jdbc - app_test: true - test: false - - name: data-jpa - app_test: true - test: false - - name: data-redis - app_test: true - test: false - - name: framework - smoke_tests: - - name: hibernate-mysql - app_test: true - test: false - - name: resttemplate-netty - app_test: true - test: false - - name: scheduled - app_test: true - test: false - - name: webclient-netty - app_test: true - test: false - - name: webflux-netty - app_test: true - test: true - - name: webflux-undertow - app_test: true - test: true - - name: webmvc-jetty - app_test: true - test: true - - name: webmvc-tomcat - app_test: true - test: true - - name: integration - smoke_tests: - - name: integration-basic - app_test: true - test: false - - name: integration-webfux-data - app_test: true - test: false - - name: spring-amqp-rabbit - app_test: true - test: false - - name: spring-kafka - app_test: true - test: false - - name: spring-kafka-avro - app_test: true - test: false - - name: spring-kafka-streams - app_test: true - test: false - - name: spring-pulsar - app_test: true - test: false - - name: spring-pulsar-reactive - app_test: true - test: false - - name: security - smoke_tests: - - name: ldap-client - app_test: true - test: true - - name: security-ldap - app_test: true - test: true - - name: security-oauth2-authorization-server - app_test: true - test: false - - name: security-oauth2-resource-server - app_test: true - test: false - - name: security-webflux - app_test: true - test: false - - name: security-webmvc - app_test: true - test: false - - name: session - smoke_tests: - - name: session-jdbc - app_test: true - test: false - - name: session-redis-webflux - app_test: true - test: false diff --git a/ci/tasks/build-ci-image.yml b/ci/tasks/build-ci-image.yml deleted file mode 100644 index c15d029..0000000 --- a/ci/tasks/build-ci-image.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -platform: linux -image_resource: - type: registry-image - source: - repository: concourse/oci-build-task - tag: 0.9.0 - username: ((docker-hub-username)) - password: ((docker-hub-password)) -inputs: -- name: ci-images-git-repo -outputs: -- name: image -caches: -- path: ci-image-cache -params: - CONTEXT: ci-images-git-repo/ci/images - DOCKERFILE: ci-images-git-repo/ci/images/((ci-image-name))/Dockerfile - DOCKER_HUB_AUTH: ((docker-hub-auth)) -run: - path: /bin/sh - args: - - "-c" - - | - mkdir -p /root/.docker - cat > /root/.docker/config.json < /root/.docker/config.json < { @@ -41,18 +37,6 @@ public class LifecycleSmokeTestAggregatorPlugin implements Plugin { sync.into(project.getLayout().getBuildDirectory().dir("smoke-tests")); sync.from(smokeTests); }); - TaskProvider updateStatusPage = project.getTasks() - .register("updateStatusPage", UpdateStatusPage.class, (task) -> { - task.setSmokeTests(smokeTests); - task.getOutputFile().set(project.file("STATUS.adoc")); - }); - TaskProvider updateConcoursePipeline = project.getTasks() - .register("updateConcoursePipeline", UpdateConcoursePipeline.class, (task) -> { - task.setSmokeTests(smokeTests); - task.getOutputFile().set(project.file("ci/smoke-tests.yml")); - }); - project.getTasks() - .register("updateInfrastructure", (task) -> task.dependsOn(updateStatusPage, updateConcoursePipeline)); } } diff --git a/gradle/plugins/lifecycle-smoke-test-plugin/src/main/java/org/springframework/lifecycle/gradle/tasks/AbstractSmokeTestsTask.java b/gradle/plugins/lifecycle-smoke-test-plugin/src/main/java/org/springframework/lifecycle/gradle/tasks/AbstractSmokeTestsTask.java deleted file mode 100644 index e2ae5d9..0000000 --- a/gradle/plugins/lifecycle-smoke-test-plugin/src/main/java/org/springframework/lifecycle/gradle/tasks/AbstractSmokeTestsTask.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * 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 - * - * 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 org.springframework.lifecycle.gradle.tasks; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.SortedSet; -import java.util.TreeMap; -import java.util.TreeSet; -import java.util.stream.Collectors; - -import org.gradle.api.DefaultTask; -import org.gradle.api.file.FileCollection; -import org.gradle.api.tasks.InputFiles; - -/** - * Base class for tasks that work with smoke tests. - * - * @author Andy Wilkinson - * @author Sebastien Deleuze - */ -public abstract class AbstractSmokeTestsTask extends DefaultTask { - - private FileCollection smokeTestDescriptions; - - @InputFiles - public FileCollection getSmokeTests() { - return this.smokeTestDescriptions; - } - - public void setSmokeTests(FileCollection smokeTests) { - this.smokeTestDescriptions = smokeTests; - } - - Map> smokeTests() { - List smokeTests = this.smokeTestDescriptions.getFiles() - .stream() - .map(this::readProperties) - .map(SmokeTest::new) - .collect(Collectors.toList()); - Map> groupedSmokeTests = new TreeMap<>(); - for (SmokeTest smokeTest : smokeTests) { - groupedSmokeTests - .computeIfAbsent(smokeTest.group(), - (group) -> new TreeSet<>((one, two) -> one.name().compareTo(two.name()))) - .add(smokeTest); - } - return groupedSmokeTests; - } - - private Properties readProperties(File smokeTest) { - Properties properties = new Properties(); - try (InputStream input = new FileInputStream(new File(smokeTest, "smoke-tests.properties"))) { - properties.load(input); - } - catch (IOException ex) { - throw new RuntimeException(ex); - } - return properties; - } - -} diff --git a/gradle/plugins/lifecycle-smoke-test-plugin/src/main/java/org/springframework/lifecycle/gradle/tasks/UpdateConcoursePipeline.java b/gradle/plugins/lifecycle-smoke-test-plugin/src/main/java/org/springframework/lifecycle/gradle/tasks/UpdateConcoursePipeline.java deleted file mode 100644 index 7c5abd7..0000000 --- a/gradle/plugins/lifecycle-smoke-test-plugin/src/main/java/org/springframework/lifecycle/gradle/tasks/UpdateConcoursePipeline.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * 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 - * - * 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 org.springframework.lifecycle.gradle.tasks; - -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -import org.gradle.api.file.RegularFileProperty; -import org.gradle.api.tasks.OutputFile; -import org.gradle.api.tasks.TaskAction; - -/** - * Task to update the Concourse pipeline for the smoke tests. - * - * @author Andy Wilkinson - */ -public abstract class UpdateConcoursePipeline extends AbstractSmokeTestsTask { - - @OutputFile - public abstract RegularFileProperty getOutputFile(); - - @TaskAction - void updatePipeline() { - File outputFile = getOutputFile().getAsFile().get(); - try (PrintWriter writer = new PrintWriter(new FileWriter(outputFile))) { - writer.println("groups:"); - smokeTests().forEach((group, tests) -> { - writer.println(" - name: " + group); - writer.println(" smoke_tests:"); - tests.forEach((smokeTest) -> { - writer.println(" - name: " + smokeTest.name()); - writer.println(" app_test: " + smokeTest.appTests()); - writer.println(" test: " + smokeTest.tests()); - }); - }); - } - catch (IOException ex) { - throw new RuntimeException(ex); - } - } - -} diff --git a/gradle/plugins/lifecycle-smoke-test-plugin/src/main/java/org/springframework/lifecycle/gradle/tasks/UpdateStatusPage.java b/gradle/plugins/lifecycle-smoke-test-plugin/src/main/java/org/springframework/lifecycle/gradle/tasks/UpdateStatusPage.java deleted file mode 100644 index 247f8b8..0000000 --- a/gradle/plugins/lifecycle-smoke-test-plugin/src/main/java/org/springframework/lifecycle/gradle/tasks/UpdateStatusPage.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2023 the original author or authors. - * - * 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 - * - * 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 org.springframework.lifecycle.gradle.tasks; - -import java.io.IOException; -import java.nio.file.Files; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Predicate; - -import org.gradle.api.file.RegularFileProperty; -import org.gradle.api.tasks.OutputFile; -import org.gradle.api.tasks.TaskAction; - -/** - * Task to update an Asciidoctor status page for the smoke tests. - * - * @author Andy Wilkinson - * @author Sebastien Deleuze - */ -public abstract class UpdateStatusPage extends AbstractSmokeTestsTask { - - @OutputFile - public abstract RegularFileProperty getOutputFile(); - - @TaskAction - void updateStatusPage() throws IOException { - List lines = new ArrayList<>(); - lines.add("= Smoke Tests Status"); - lines.add(":toc:"); - lines.add(":toc-title: Projects"); - lines.add(""); - lines.add("Check each test for potential configuration guidance."); - lines.add(""); - smokeTests().forEach((group, tests) -> { - lines.add("== " + capitalize(group)); - lines.add(""); - lines.add("[%header,cols=\"" + (TestType.values().length + 1) + "\"]"); - lines.add("|==="); - lines.add("h|Smoke Test"); - for (TestType testType : TestType.values()) { - lines.add("h|" + testType.taskName()); - } - lines.add(""); - for (SmokeTest test : tests) { - lines.add("|" + testUrl(group, test.name()) + "[" + test.name() + "]"); - for (TestType testType : TestType.values()) { - lines.add("|" + testType.badge(test)); - } - lines.add(""); - } - lines.add("|==="); - lines.add(""); - }); - Files.write(getOutputFile().get().getAsFile().toPath(), lines); - } - - private String capitalize(String input) { - StringBuffer buffer = new StringBuffer(input.length()); - for (char c : input.toCharArray()) { - buffer.append(buffer.isEmpty() ? Character.toUpperCase(c) : c); - } - return buffer.toString(); - } - - private String testUrl(String group, String name) { - return "https://github.com/spring-projects/spring-lifecycle-smoke-tests/tree/main/" + group + "/" + name; - } - - private enum TestType { - - APP_TEST(SmokeTest::appTests, "-app-test", "appTest"), - CR_APP_TEST(SmokeTest::appTests, "-cr-app-test", "checkpointRestoreAppTest"), - TEST(SmokeTest::tests, "-test", "test"); - - private final Predicate predicate; - - private final String urlSuffix; - - private final String taskName; - - TestType(Predicate predicate, String suffix, String taskName) { - this.predicate = predicate; - this.urlSuffix = suffix; - this.taskName = taskName; - } - - String badge(SmokeTest smokeTest) { - if (!this.predicate.test(smokeTest)) { - return ""; - } - return "image:" + badgeUrl(smokeTest.name(), this.urlSuffix) + "[link=" - + jobUrl(smokeTest.name(), this.urlSuffix) + "]"; - } - - String taskName() { - return this.taskName; - } - - private String badgeUrl(String name, String suffix) { - return "https://ci.spring.io/api/v1/teams/spring-lifecycle-smoke-tests/pipelines/spring-lifecycle-smoke-tests-3.3.x/jobs/" - + name + suffix + "/badge"; - } - - private String jobUrl(String name, String suffix) { - return "https://ci.spring.io/teams/spring-lifecycle-smoke-tests/pipelines/spring-lifecycle-smoke-tests-3.3.x/jobs/" - + name + suffix; - } - - } - -}