Preparing for 3.1.0 release (#147)

* Upgrading spring-boot to 3.1.x

* Making main release 3.1.x

* Adding PR pipeline

* Adding integration-tests to the build step

* Update credhub-server/README.adoc

Co-authored-by: Gareth Clay <spikymonkey@users.noreply.github.com>

* Updating set-pipelines and channel name

* Removing unnecessary clean

* Adding docker mirror config and privileged tasks

---------

Co-authored-by: Gareth Clay <spikymonkey@users.noreply.github.com>
This commit is contained in:
Alberto C. Ríos
2023-09-14 14:46:44 +02:00
committed by GitHub
parent 8e706be423
commit 7fbd4a7996
20 changed files with 293 additions and 58 deletions

View File

@@ -6,6 +6,20 @@ updates:
schedule:
interval: daily
open-pull-requests-limit: 15
labels:
- "dependency-upgrade"
commit-message:
prefix: "3.1.x"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major", "version-update:semver-minor"]
- package-ecosystem: gradle
directory: "/"
target-branch: "3.0.x"
schedule:
interval: daily
open-pull-requests-limit: 15
labels:
- "dependency-upgrade"
commit-message:

3
.gitignore vendored
View File

@@ -15,6 +15,3 @@ bin
build
out
target
credhub-server/config/*.pem
credhub-server/uaa.yml

View File

@@ -33,11 +33,7 @@ Once running they can be executed with:
[source,bash]
----
./gradlew :spring-credhub-integration-tests:test -PintegrationTests
----
[source,bash]
----
./gradlew :spring-credhub-reactive-integration-tests:test -PintegrationTests
./gradlew build -PintegrationTests --no-parallel
----
=== Working with the code

View File

@@ -23,9 +23,9 @@ plugins {
description = "Spring CredHub"
ext {
springVersion = "6.0.4"
springBootVersion = "3.0.2"
springSecurityVersion = "6.0.1"
springVersion = "6.0.11"
springBootVersion = "3.1.3"
springSecurityVersion = "6.1.2"
javadocLinks = [
"https://docs.oracle.com/en/java/javase/17/docs/api/",
"https://docs.spring.io/spring-framework/docs/current/javadoc-api/"

View File

@@ -4,7 +4,7 @@ Set up the Concourse target and login:
[source]
----
$ fly -t spring-credhub login -n spring-credhub -c https://runway-ci.eng.vmware.com
$ fly -t spring-credhub login -n spring-credhub -c https://runway-ci-sfo.eng.vmware.com
----
Deploy the pipelines

View File

@@ -1,4 +1,4 @@
artifactory-server: https://repo.spring.io
build-name: spring-credhub
spring-credhub-slack-success-channel: "#sc-app-broker"
spring-credhub-slack-failure-channel: "#sc-app-broker"
spring-credhub-slack-success-channel: "#spring-cloud-app-broker"
spring-credhub-slack-failure-channel: "#spring-cloud-app-broker"

View File

@@ -1,17 +1,51 @@
FROM harbor-repo.vmware.com/dockerhub-proxy-cache/library/ubuntu:jammy
# Environment variables
ENV TERM dumb
ENV LC_ALL C.UTF-8
ARG CONCOURSE_JAVA_SCRIPTS_VERSION=0.0.4
ARG CONCOURSE_RELEASE_SCRIPTS_VERSION=0.3.4
ARG YTT_VERSION="0.45.4"
RUN apt-get update && \
apt-get install --no-install-recommends -y \
ca-certificates \
curl \
git \
jq \
net-tools \
openjdk-17-jdk-headless && \
apt-get clean
# Install packages required for bootstrapping
RUN apt-get -qy update \
&& apt-get -qy --no-install-recommends install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common \
&& apt-get clean
# Accept apt repository keys
RUN curl -q 'https://download.docker.com/linux/ubuntu/gpg' | apt-key add -
# Add custom apt repositories
RUN add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Install packages
RUN apt-get -qy update \
&& apt-get -qy --no-install-recommends install \
bsdextrautils \
containerd.io \
cgroupfs-mount \
docker-ce \
git \
jq \
make \
openjdk-17-jdk \
openssh-client \
tcpdump \
&& apt-get clean
RUN curl -Lo ytt "https://github.com/vmware-tanzu/carvel-ytt/releases/download/v$YTT_VERSION/ytt-linux-amd64" \
&& chmod u+x ytt && mv ytt /usr/local/bin/
RUN curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" \
-o /usr/local/bin/docker-compose && chmod +x /usr/local/bin/docker-compose
WORKDIR /unpack
ADD "https://raw.githubusercontent.com/spring-io/concourse-java-scripts/v$CONCOURSE_JAVA_SCRIPTS_VERSION/concourse-java.sh" /opt/
ADD "https://repo.spring.io/ui/native/snapshot/io/spring/concourse/releasescripts/concourse-release-scripts/$CONCOURSE_RELEASE_SCRIPTS_VERSION/concourse-release-scripts-$CONCOURSE_RELEASE_SCRIPTS_VERSION.jar" /opt/

View File

@@ -33,6 +33,8 @@ jobs:
- get: git-repo
trigger: true
- task: build-project
privileged: true
tags: [ btrfs ]
timeout: 1h30m
file: git-repo/ci/tasks/build-project.yml
vars:

67
ci/pr-pipeline.yml Normal file
View File

@@ -0,0 +1,67 @@
---
aliases:
- &slack-success-notification
put: alert
params:
icon_emoji: ":concourse:"
username: concourse
channel: ((spring-credhub-slack-success-channel))
text: "$BUILD_PIPELINE_NAME pipeline has succeeded with build <${ATC_EXTERNAL_URL}/builds/$BUILD_ID|$BUILD_NAME>!"
- &slack-failure-notification
put: alert
params:
icon_emoji: ":animal-1252:"
username: concourse
channel: ((spring-credhub-slack-failure-channel))
text: <!here> Build <${ATC_EXTERNAL_URL}/builds/$BUILD_ID|$BUILD_NAME> of job $BUILD_JOB_NAME in the $BUILD_PIPELINE_NAME pipeline has failed!
jobs:
- name: build
serial: true
public: true
plan:
- get: pull-request
trigger: true
version: every
- task: build-project
timeout: 1h30m
privileged: true
tags: [ btrfs ]
file: pull-request/ci/tasks/build-project.yml
input_mapping:
git-repo: pull-request
vars:
ci-image-tag: ((ci-image-tag))
on_success:
*slack-success-notification
on_failure:
*slack-failure-notification
resource_types:
- name: pull-request
type: registry-image
source:
repository: ((dockerhub-mirror-registry))/teliaoss/github-pr-resource
tag: latest
- name: slack-notification
type: registry-image
source:
repository: ((dockerhub-mirror-registry))/cfcommunity/slack-notification-resource
tag: latest
resources:
- name: pull-request
type: pull-request
check_every: 10s
source:
repository: ((spring-credhub-pr-github-pull-requests-repo))
access_token: ((spring-credhub-pr-github-pull-requests-access-token))
base_branch: ((branch))
disable_forks: true
required_review_approvals: 1
- name: alert
type: slack-notification
source:
url: ((scs-slack-webhook))

View File

@@ -2,17 +2,32 @@
set -euo pipefail
readonly SKIP_TESTS="${SKIP_TESTS:-false}"
# shellcheck source=common.sh
source "$(dirname "$0")/common.sh"
repository=$(pwd)/distribution-repository
if [ "$SKIP_TESTS" == "true" ]; then
build_task=assemble
else
build_task=build
fi
pushd git-repo >/dev/null
./gradlew clean "${build_task}" publish -PpublicationRepository="${repository}"
popd >/dev/null
start_docker() {
pushd credhub-server >/dev/null
echo '{"registry-mirrors": ["https://harbor-mirror.spring.vmware.com"]}' > /etc/docker/daemon.json
service cgroupfs-mount start
service docker start
docker-compose up --detach
trap "stop_docker" EXIT
popd >/dev/null
}
stop_docker() {
pushd credhub-server >/dev/null
docker-compose stop
service cgroupfs-mount stop
service docker stop
popd >/dev/null
}
main() {
cd git-repo >/dev/null
start_docker
./gradlew build publish -PpublicationRepository="${repository}" -PintegrationTests --no-parallel
}
main

View File

@@ -22,26 +22,34 @@ readonly FLY_TARGET="spring-credhub"
readonly GITHUB_REPO="https://github.com/spring-projects/spring-credhub"
set_pipeline() {
local pipeline_name pipeline_definition branch ci_image_tag
local pipeline_name pipeline_definition branch release_series pipeline_full_name
pipeline_name="${1:?pipeline name must be provided}"
pipeline_definition="${2:?pipeline definition file must be provided}"
branch="${3:?branch must be provided}"
ci_image_tag="${4:-$branch}"
release_series="${4:?release_series must be provided}"
pipeline_full_name="${pipeline_name}-${release_series}"
echo "Setting $pipeline_name pipeline..."
echo "Setting $pipeline_full_name pipeline..."
fly --target "$FLY_TARGET" set-pipeline \
--pipeline "$pipeline_name" \
--pipeline "$pipeline_full_name" \
--config "$pipeline_definition" \
--load-vars-from config-concourse.yml \
--var "github-repo=$GITHUB_REPO" \
--var "branch=$branch" \
--var "ci-image-tag=$ci_image_tag"
--var "ci-image-tag=$release_series"
}
set_pipelines() {
fly -t "$FLY_TARGET" sync
set_pipeline spring-credhub pipeline.yml main 3.1.x
set_pipeline spring-credhub pipeline.yml 3.0.x 3.0.x
set_pipeline spring-credhub pipeline.yml 2.3.x 2.3.x
set_pipeline spring-credhub pipeline.yml 2.2.x 2.2.x
set_pipeline spring-credhub-3.0.x pipeline.yml main spring-credhub-ci
set_pipeline spring-credhub-pr pr-pipeline.yml main 3.1.x
set_pipeline spring-credhub-pr pr-pipeline.yml 3.0.x 3.0.x
set_pipeline spring-credhub-pr pr-pipeline.yml 2.3.x 2.3.x
set_pipeline spring-credhub-pr pr-pipeline.yml 2.2.x 2.2.x
}
set_pipelines

View File

@@ -3,14 +3,6 @@
This directory contains artifacts that can be used to start UAA and CredHub servers that can be used to run tests against.
It is derived https://github.com/orange-cloudfoundry/credhub-docker and https://github.com/ampersand8/credhub-docker.
Before running the servers for the first time, UAA needs to be configured with jwt signing keys.
To generate the configuration, ensure the `openssl` and https://carvel.dev/ytt/[`ytt`] tools are installed, the run the setup script:
[source,bash]
----
$ ./setup-uaa.sh
----
From the root of this directory, start the servers using Docker Compose:
[source,bash]
@@ -18,4 +10,12 @@ From the root of this directory, start the servers using Docker Compose:
$ docker-compose up
----
After both servers have started successfully, UAA will be available at `http://localhost:8080/uaa` and CredHub will be available at `https://localhost:9000`.
After both servers have started successfully, UAA will be available at `http://localhost:8080/uaa` and CredHub will be available at `https://localhost:9000`.
To generate the test jwt signing keys, ensure the `openssl` and https://carvel.dev/ytt/[`ytt`] tools are installed, then run the setup script:
[source,bash]
----
$ ./setup-uaa.sh
----

View File

@@ -0,0 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAzmFA/hQZ8iIl2eaCW0XH1eZ2YuPNMhcaavyvGJwHUbXTUUhr
P7cYdNVgycqfRR+64qJ0ulsWpRdbdtQHCvTzzdX/KSTTepW2nxZNFKq+Re3M+L0L
GeL1maNJ3xLyJ6dvB9YmImI4k+suCOfNBEV03ZJmTxUw3CVjqCdKRpLunA48BeDq
+gQAMpBvL9jdMAXqEmsFhLYE/KWjdBzdjfgt7c29zHz4RX4/N9YS8Q8KWjWgo+Yg
HaNZpYs+6AZXrOEp25ZpTMhpseP6NgbNhgwKzsI5l9cV5cNv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prCK/BFjNIRv4ClxMcaZOQ8BxmR
CsNoSwKBgQC1KIdBUzuLkSxLAm3pEscS3F5yqpclM+eYE/ed4tT6ySqs46X2G0kQ
6VoXd5fT4YgcHszhT7PuW6j8ywNGUN2Zz3Zl8xgxkIkdEZPrL1Hq5K7uBUDeUwhn
96S9sIJEd58utQSu/FqFq14K7dFTQjMtC08T0shzTGhFnWcX85jTcA==
-----END RSA PRIVATE KEY-----

View File

@@ -0,0 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzmFA/hQZ8iIl2eaCW0XH
1eZ2YuPNMhcaavyvGJwHUbXTUUhrP7cYdNVgycqfRR+64qJ0ulsWpRdbdtQHCvTz
zdX/KSTTepW2nxZNFKq+Re3M+L0LGeL1maNJ3xLyJ6dvB9YmImI4k+suCOfNBEV0
3ZJmTxUw3CVjqCdKRpLunA48BeDq+gQAMpBvL9jdMAXqEmsFhLYE/KWjdBzdjfgt
7c29zHz4RX4/N9YS8Q8KWjWgo+YgHaNZpYs+6AZXrOEp25ZpTMhpseP6NgbNhgwK
zsI5l9cV5cNvHQjODBPPsVoPgkiC0LRBMChs5h85e6KLrnjpj4njkzmjL5L7xngM
RQIDAQAB
-----END PUBLIC KEY-----

60
credhub-server/uaa.yml Normal file
View File

@@ -0,0 +1,60 @@
scim:
users:
- credhub|password|credhub|Credhub|User|credhub.read,credhub.write
oauth:
clients:
credhub_cli:
override: true
authorized-grant-types: password,refresh_token
scope: credhub.read,credhub.write
authorities: uaa.resource
access-token-validity: 86400
refresh-token-validity: 172800
secret: ""
credhub_client:
override: true
authorized-grant-types: client_credentials
secret: secret
scope: uaa.none
authorities: credhub.read,credhub.write
access-token-validity: 86400
jwt:
token:
signing-key: |
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAzmFA/hQZ8iIl2eaCW0XH1eZ2YuPNMhcaavyvGJwHUbXTUUhr
P7cYdNVgycqfRR+64q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w
4cKH/e8ZbDad7IIYRbn7bbF2lG36fW10dKGS5YZXALogrgcBE0B1ghvsZpCUky1r
AC0tWZpd+VXhNFEsWJp9NwKBgQDAvwHLG44mGH5YgagHj4bsV4N7vdKSTEyKlYSP
0GFyP2Uqh4zziTfu9j6uzjaWwlMuEVHh5l3okWRwXVc0fmbEeyHBaWVphm+SgL/i
zAbgimCPjjsqGfftyAgVX3TXRjwNeL0vPAry1prCK/BFjNIRv4ClxMcaZOQ8BxmR
CsNoSwKBgQC1KIdBUzuLkSxLAm3pEscS3F5yqpclM+eYE/ed4tT6ySqs46X2G0kQ
6VoXd5fT4YgcHszhT7PuW6j8ywNGUN2Zz3Zl8xgxkIkdEZPrL1Hq5K7uBUDeUwhn
96S9sIJEd58utQSu/FqFq14K7dFTQjMtC08T0shzTGhFnWcX85jTcA==
-----END RSA PRIVATE KEY-----
verification-key: |
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzmFA/hQZ8iIl2eaCW0XH
1eZ2YuPNMhcaavyvGJwHUbXTUUhrP7cYdNVgycqfRR+64qJ0ulsWpRdbdtQHCvTz
zdX/KSTTepW2nxZNFKq+Re3M+L0LGeL1maNJ3xLyJ6dvB9YmImI4k+suCOfNBEV0
3ZJmTxUw3CVjqCdKRpLunA48BeDq+gQAMpBvL9jdMAXqEmsFhLYE/KWjdBzdjfgt
7c29zHz4RX4/N9YS8Q8KWjWgo+YgHaNZpYs+6AZXrOEp25ZpTMhpseP6NgbNhgwK
zsI5l9cV5cNvHQjODBPPsVoPgkiC0LRBMChs5h85e6KLrnjpj4njkzmjL5L7xngM
RQIDAQAB
-----END PUBLIC KEY-----

View File

@@ -1,3 +1,3 @@
version=3.0.1-SNAPSHOT
version=3.1.0-SNAPSHOT
org.gradle.parallel=true

View File

@@ -19,7 +19,7 @@ pluginManagement {
id 'io.spring.nohttp' version '0.0.11'
id 'io.spring.javaformat' version '0.0.35'
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.springframework.boot' version '3.0.2'
id 'org.springframework.boot' version '3.1.3'
}
repositories {
gradlePluginPortal()

View File

@@ -26,9 +26,11 @@ import javax.net.ssl.X509TrustManager;
import okhttp3.OkHttpClient.Builder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hc.client5.http.config.ConnectionConfig;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.client5.http.impl.io.BasicHttpClientConnectionManager;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager;
import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder;
import org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory;
@@ -163,8 +165,11 @@ public final class ClientHttpRequestFactoryFactory {
RequestConfig.Builder requestConfigBuilder = RequestConfig.custom().setAuthenticationEnabled(true);
if (options.getConnectionTimeout() != null) {
requestConfigBuilder
.setConnectTimeout(Timeout.ofMilliseconds(options.getConnectionTimeout().toMillis()));
BasicHttpClientConnectionManager basicHttpClientConnectionManager = new BasicHttpClientConnectionManager();
Timeout connectTimeout = Timeout.ofMilliseconds(options.getConnectionTimeout().toMillis());
ConnectionConfig.Builder connectionConfig = ConnectionConfig.custom().setConnectTimeout(connectTimeout);
basicHttpClientConnectionManager.setConnectionConfig(connectionConfig.build());
httpClientBuilder.setConnectionManager(basicHttpClientConnectionManager);
}
httpClientBuilder.setDefaultRequestConfig(requestConfigBuilder.build());

View File

@@ -26,7 +26,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.security.oauth2.client.ClientsConfiguredCondition;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesMapper;
import org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration;
import org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -73,8 +73,9 @@ public class CredHubOAuth2AutoConfiguration {
@ConditionalOnMissingBean
@ConditionalOnClass(name = "jakarta.servlet.http.HttpServletRequest")
public ClientRegistrationRepository credHubClientRegistrationRepository() {
List<ClientRegistration> registrations = new ArrayList<>(
OAuth2ClientPropertiesRegistrationAdapter.getClientRegistrations(this.properties).values());
new OAuth2ClientPropertiesMapper(this.properties).asClientRegistrations().values());
return new InMemoryClientRegistrationRepository(registrations);
}
@@ -104,7 +105,7 @@ public class CredHubOAuth2AutoConfiguration {
@ConditionalOnClass(name = "org.springframework.web.reactive.function.client.WebClient")
public ReactiveClientRegistrationRepository credHubReactiveClientRegistrationRepository() {
List<ClientRegistration> registrations = new ArrayList<>(
OAuth2ClientPropertiesRegistrationAdapter.getClientRegistrations(this.properties).values());
new OAuth2ClientPropertiesMapper(this.properties).asClientRegistrations().values());
return new InMemoryReactiveClientRegistrationRepository(registrations);
}

View File

@@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test;
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientProperties;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesRegistrationAdapter;
import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientPropertiesMapper;
import org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration;
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.test.context.FilteredClassLoader;
@@ -231,7 +231,7 @@ public class CredHubTemplateAutoConfigurationTests {
@Bean
AuthorizedClientServiceOAuth2AuthorizedClientManager clientManager(OAuth2ClientProperties properties) {
List<ClientRegistration> registrations = new ArrayList<>(
OAuth2ClientPropertiesRegistrationAdapter.getClientRegistrations(properties).values());
new OAuth2ClientPropertiesMapper(properties).asClientRegistrations().values());
ClientRegistrationRepository clientRegistrationRepository = new InMemoryClientRegistrationRepository(
registrations);
OAuth2AuthorizedClientService authorizedClientService = new InMemoryOAuth2AuthorizedClientService(
@@ -244,7 +244,7 @@ public class CredHubTemplateAutoConfigurationTests {
AuthorizedClientServiceReactiveOAuth2AuthorizedClientManager reactiveClientManager(
OAuth2ClientProperties properties) {
List<ClientRegistration> registrations = new ArrayList<>(
OAuth2ClientPropertiesRegistrationAdapter.getClientRegistrations(properties).values());
new OAuth2ClientPropertiesMapper(properties).asClientRegistrations().values());
ReactiveClientRegistrationRepository clientRegistrationRepository = new InMemoryReactiveClientRegistrationRepository(
registrations);
ReactiveOAuth2AuthorizedClientService authorizedClientService = new InMemoryReactiveOAuth2AuthorizedClientService(