Merge branch '2.0.x'
This commit is contained in:
@@ -17,31 +17,34 @@
|
||||
orbs:
|
||||
kube-orb: circleci/kubernetes@0.11.0
|
||||
version: 2.1
|
||||
workflows:
|
||||
version: 2
|
||||
build-then-test:
|
||||
jobs:
|
||||
- build
|
||||
- test:
|
||||
requires:
|
||||
- build
|
||||
jobs:
|
||||
build:
|
||||
test:
|
||||
parallelism: 5 # parallel containers to split the tests among
|
||||
machine: true
|
||||
environment:
|
||||
_JAVA_OPTIONS: "-Xms1024m -Xmx2048m"
|
||||
_SERVICE_OCCURENCE: 5
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- spring-cloud-kubernetes-{{ .Branch }}-{{ checksum "pom.xml" }}
|
||||
- spring-cloud-kubernetes-{{ .Branch }}
|
||||
- spring-cloud-kubernetes
|
||||
- run:
|
||||
name: dependencies
|
||||
command: |
|
||||
./mvnw -s .settings.xml -U --fail-never dependency:go-offline -Dservice.occurence=${_SERVICE_OCCURENCE} || true
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.m2
|
||||
key: spring-cloud-kubernetes-{{ .Branch }}-{{ checksum "pom.xml" }}
|
||||
- run:
|
||||
name: Run regular tests
|
||||
command: |
|
||||
./mvnw -s .settings.xml clean install -Dservice.occurence=${_SERVICE_OCCURENCE} #org.jacoco:jacoco-maven-plugin:prepare-agent install -U -P sonar -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
|
||||
CLASSNAMES=$(circleci tests glob "**/src/test/**/**.java" | grep -v 'spring-cloud-kubernetes-integration-tests' \
|
||||
| sed 's/.*src.test.java.//g' | sed 's@/@.@g' \
|
||||
| sed 's/.\{5\}$//' \
|
||||
| circleci tests split --split-by=timings --timings-type=classname)
|
||||
echo $CLASSNAMES
|
||||
TEST_ARG=$(echo $CLASSNAMES | sed 's/ /,/g')
|
||||
echo $TEST_ARG
|
||||
./mvnw -s .settings.xml -DfailIfNoTests=false -Dtest=$TEST_ARG -e clean org.jacoco:jacoco-maven-plugin:prepare-agent test -U -P sonar -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
|
||||
mkdir -p $HOME/artifacts/junit/
|
||||
find . -type f -regex ".*/spring-cloud-*.*/target/*.*" -exec cp {} $HOME/artifacts/ \;
|
||||
find . -type f -regex ".*/target/.*-reports/.*" -exec cp {} $HOME/artifacts/junit/ \;
|
||||
@@ -52,6 +55,12 @@ jobs:
|
||||
sudo apt update
|
||||
sudo apt install snapd
|
||||
- kube-orb/install-kubectl
|
||||
- attach_workspace:
|
||||
at: ./
|
||||
- run:
|
||||
name: Load Controller Images From Workspace
|
||||
command: |
|
||||
docker load -i ./docker-images/spring-cloud-kubernetes-configuration-watcher.tar
|
||||
- run:
|
||||
name: Run Kind Integration Tests
|
||||
command: |
|
||||
@@ -125,6 +134,40 @@ jobs:
|
||||
- store_test_results:
|
||||
path: ~/junit/
|
||||
destination: testartifacts
|
||||
build:
|
||||
machine: true
|
||||
environment:
|
||||
_JAVA_OPTIONS: "-Xms1024m -Xmx2048m"
|
||||
_SERVICE_OCCURENCE: 5
|
||||
steps:
|
||||
- checkout
|
||||
- restore_cache:
|
||||
keys:
|
||||
- spring-cloud-kubernetes-{{ .Branch }}-{{ checksum "pom.xml" }}
|
||||
- spring-cloud-kubernetes-{{ .Branch }}
|
||||
- spring-cloud-kubernetes
|
||||
- run:
|
||||
name: dependencies
|
||||
command: |
|
||||
./mvnw -s .settings.xml -U --fail-never dependency:go-offline -Dservice.occurence=${_SERVICE_OCCURENCE} || true
|
||||
- run:
|
||||
name: build
|
||||
command: |
|
||||
./mvnw -s .settings.xml clean install -Dservice.occurence=${_SERVICE_OCCURENCE} -DskipTests
|
||||
- run:
|
||||
name: save docker images
|
||||
command: |
|
||||
TAG=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
|
||||
echo $TAG
|
||||
mkdir docker-images
|
||||
docker save -o docker-images/spring-cloud-kubernetes-configuration-watcher.tar docker.io/springcloud/spring-cloud-kubernetes-configuration-watcher:${TAG}
|
||||
- persist_to_workspace:
|
||||
root: ./
|
||||
paths: docker-images
|
||||
- save_cache:
|
||||
paths:
|
||||
- ~/.m2
|
||||
key: spring-cloud-kubernetes-{{ .Branch }}-{{ checksum "pom.xml" }}
|
||||
notify:
|
||||
webhooks:
|
||||
- url: https://webhooks.gitter.im/e/22e6bb4eb945dd61ba54
|
||||
|
||||
50
pom.xml
50
pom.xml
@@ -202,10 +202,8 @@
|
||||
<version>${maven-surefire-plugin.version}</version>
|
||||
<inherited>true</inherited>
|
||||
<configuration>
|
||||
<forkCount>1</forkCount>
|
||||
<parallel>all</parallel>
|
||||
<reuseForks>false</reuseForks>
|
||||
<!-- Workaround for https://issues.apache.org/jira/browse/SUREFIRE-1588 -->
|
||||
<useSystemClassLoader>false</useSystemClassLoader>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
@@ -319,5 +317,51 @@
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>sonar</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>pre-unit-test</id>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<propertyName>surefireArgLine</propertyName>
|
||||
<destFile>${project.build.directory}/jacoco.exec
|
||||
</destFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>post-unit-test</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<!-- Sets the path to the file which contains the execution data. -->
|
||||
<dataFile>${project.build.directory}/jacoco.exec
|
||||
</dataFile>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<parallel>all</parallel>
|
||||
<reuseForks>false</reuseForks>
|
||||
<!-- Sets the VM argument line used when unit tests are run. -->
|
||||
<argLine>${surefireArgLine}</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
||||
@@ -119,17 +119,33 @@ main() {
|
||||
#"${ISTIOCTL}" install --set profile=demo
|
||||
|
||||
# running tests..
|
||||
for p in "${INTEGRATION_PROJECTS[@]}"; do
|
||||
echo "Running test: $p"
|
||||
cd $p
|
||||
${MVN} spring-boot:build-image \
|
||||
-Dspring-boot.build-image.imageName=docker.io/springcloud/$p:${MVN_VERSION} -Dspring-boot.build-image.builder=paketobuildpacks/builder
|
||||
"${KIND}" load docker-image docker.io/springcloud/$p:${MVN_VERSION}
|
||||
${MVN} clean install -P it
|
||||
cd ..
|
||||
done
|
||||
if [[ $CIRCLECI ]]; then
|
||||
#This splits projects across all circleci instances, it returns a list of projects separated by a space
|
||||
SPLIT_PROJECTS=$(printf "%s\n" "${INTEGRATION_PROJECTS[@]}" | circleci tests split)
|
||||
SPLIT_PROJECTS=$(echo $SPLIT_PROJECTS | sed 's/ /,/g')
|
||||
echo "split tests $SPLIT_PROJECTS"
|
||||
#This splits the projects back into an array so we can iterate over them
|
||||
IFS=',' read -ra PROJECTS <<< "$SPLIT_PROJECTS"
|
||||
echo "projects $PROJECTS"
|
||||
run_tests "${PROJECTS[@]}"
|
||||
else
|
||||
run_tests "${INTEGRATION_PROJECTS[@]}"
|
||||
fi
|
||||
|
||||
# teardown will happen automatically on exit
|
||||
}
|
||||
|
||||
run_tests() {
|
||||
arr=("$@")
|
||||
for p in "${arr[@]}"; do
|
||||
echo "Running test: $p"
|
||||
cd $p
|
||||
${MVN} spring-boot:build-image \
|
||||
-Dspring-boot.build-image.imageName=docker.io/springcloud/$p:${MVN_VERSION} -Dspring-boot.build-image.builder=paketobuildpacks/builder
|
||||
"${KIND}" load docker-image docker.io/springcloud/$p:${MVN_VERSION}
|
||||
${MVN} clean install -P it
|
||||
cd ..
|
||||
done
|
||||
}
|
||||
|
||||
main
|
||||
|
||||
Reference in New Issue
Block a user