Remove Concourse support

This commit removes the Concourse support now the smoke tests have
migrated to GHA.
This commit is contained in:
Stéphane Nicoll
2024-07-16 15:54:35 +02:00
parent b96593d9b8
commit 12196656d4
25 changed files with 2 additions and 999 deletions

View File

@@ -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.

View File

@@ -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"

View File

@@ -1,9 +0,0 @@
logging:
level:
io.spring.concourse: DEBUG
spring:
main:
banner-mode: off
sonatype:
exclude:
- 'build-info\.json'

View File

@@ -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 <image-folder>/Dockerfile .
----
For example
----
$ docker build --no-cache -f ci-image/Dockerfile .
----
To test run:
----
$ docker run -it --entrypoint /bin/bash <SHA>
----

View File

@@ -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

View File

@@ -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
}

View File

@@ -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

View File

@@ -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"

View File

@@ -1,5 +0,0 @@
#!/bin/bash
set -e
VERSION="24.0.5"
echo "https://download.docker.com/linux/static/stable/$ARCH/docker-$VERSION.tgz"

View File

@@ -1,5 +0,0 @@
#!/bin/bash
set -e
VERSION="8.7"
echo "https://services.gradle.org/distributions/gradle-$VERSION-bin.zip"

View File

@@ -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

View File

@@ -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

View File

@@ -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"

View File

@@ -1,8 +0,0 @@
#@data/values-schema
---
groups:
- name: "group name"
smoke_tests:
- name: "smoke test name"
app_test: true
test: true

View File

@@ -1,5 +0,0 @@
source /opt/concourse-java.sh
setup_symlinks
echo 'systemProp.user.name=concourse' > ~/.gradle/gradle.properties

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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 <<EOF
{ "auths": { "https://index.docker.io/v1/": { "auth": "$DOCKER_HUB_AUTH" }}}
EOF
build

View File

@@ -1,28 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
outputs:
- name: distribution-repository
- name: git-repo
caches:
- path: maven
- path: gradle
params:
BRANCH:
CI: true
SMOKE_TEST:
TASK:
DOCKER_HUB_MIRROR:
run:
path: bash
args:
- -ec
- |
mkdir -p /root/.docker
cat > /root/.docker/config.json <<EOF
{ "auths": { "https://index.docker.io/v1/": { "auth": "$DOCKER_HUB_AUTH" }}}
EOF
source /docker-lib.sh
start_docker $DOCKER_HUB_MIRROR
${PWD}/git-repo/ci/scripts/smoke-test.sh

View File

@@ -1,8 +0,0 @@
---
platform: linux
inputs:
- name: git-repo
outputs:
- name: git-repo
run:
path: git-repo/ci/scripts/update-pipeline.sh

View File

@@ -20,17 +20,13 @@ import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.tasks.Sync;
import org.gradle.api.tasks.TaskProvider;
import org.springframework.lifecycle.gradle.tasks.UpdateConcoursePipeline;
import org.springframework.lifecycle.gradle.tasks.UpdateStatusPage;
/**
* Plugin for a project that aggregates the smoke tests to provide status and a CI
* pipeline.
* Plugin for a project that aggregates descriptions of the smoke tests.
*
* @author Andy Wilkinson
* @author Sebastien Deleuze
* @author Stephane Nicoll
*/
public class LifecycleSmokeTestAggregatorPlugin implements Plugin<Project> {
@@ -41,18 +37,6 @@ public class LifecycleSmokeTestAggregatorPlugin implements Plugin<Project> {
sync.into(project.getLayout().getBuildDirectory().dir("smoke-tests"));
sync.from(smokeTests);
});
TaskProvider<UpdateStatusPage> updateStatusPage = project.getTasks()
.register("updateStatusPage", UpdateStatusPage.class, (task) -> {
task.setSmokeTests(smokeTests);
task.getOutputFile().set(project.file("STATUS.adoc"));
});
TaskProvider<UpdateConcoursePipeline> 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));
}
}

View File

@@ -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<String, SortedSet<SmokeTest>> smokeTests() {
List<SmokeTest> smokeTests = this.smokeTestDescriptions.getFiles()
.stream()
.map(this::readProperties)
.map(SmokeTest::new)
.collect(Collectors.toList());
Map<String, SortedSet<SmokeTest>> 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;
}
}

View File

@@ -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);
}
}
}

View File

@@ -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<String> 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<SmokeTest> predicate;
private final String urlSuffix;
private final String taskName;
TestType(Predicate<SmokeTest> 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;
}
}
}