Skip to content

Commit

Permalink
Merge branch 'main' into major-changes-in-k8s-discovery-implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
wind57 committed Apr 17, 2024
2 parents a036931 + 2861ea5 commit 211b874
Show file tree
Hide file tree
Showing 39 changed files with 511 additions and 180 deletions.
1 change: 0 additions & 1 deletion .github/workflows/composites/env-variables/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ runs:
echo "BRANCH_NAME=$(echo $GITHUB_HEAD_REF)" >> $GITHUB_ENV
echo "BASE_BRANCH_NAME=$(echo $GITHUB_BASE_REF)" >> $GITHUB_ENV
echo "DOCKER_IMAGES_KEY=$(echo $GITHUB_RUN_ID)" >> $GITHUB_ENV
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ runs:
steps:

- name: restore test times cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: /tmp/sorted.txt
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
Expand Down Expand Up @@ -117,13 +117,13 @@ runs:
echo "AVERAGE_TIME_PER_INSTANCE=$(echo $average_time_per_instance_json)" >> $GITHUB_ENV
- name: upload test with times
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: tests-with-times-sorted.txt
path: /tmp/tests-with-times-sorted.txt

- name: upload test without times
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: tests-without-times.txt
path: /tmp/tests-without-times.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runs:
run: cat /tmp/tests.txt

- name: upload test
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: tests.txt
path: /tmp/tests.txt
Expand Down
9 changes: 4 additions & 5 deletions .github/workflows/composites/pre-test-actions/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ runs:
uses: ./.github/workflows/composites/setup-jdk17
if: env.BASE_BRANCH == 'main'

- name: setup project jdk-8
uses: ./.github/workflows/composites/setup-jdk1.8
if: env.BASE_BRANCH == '2.1.x'

- name: cache local maven repository
uses: ./.github/workflows/composites/cache

- name: restore common images
uses: ./.github/workflows/composites/restore-docker-images

- name: build project
shell: bash
run: |
Expand All @@ -34,7 +33,7 @@ runs:
uses: ./.github/workflows/composites/build-integration-tests-project

- name: download tests
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: tests.txt
path: /tmp
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/composites/restore-docker-images/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: restore-docker-images
description: upload docker images
runs:
using: "composite"
steps:

- name: restore images if cache matches
uses: actions/cache/restore@v4
id: images-cache
with:
path: /tmp/docker/images
key: docker-images-github-cache-${{ hashFiles('**/current-images.txt') }}

- name: pull docker images
shell: bash
if: steps.images-cache.outputs.cache-hit != 'true'
run: |
echo 'start pulling common images'
mkdir -p /tmp/docker/images
result=$(find . -name 'current-images.txt')
while read line; do
docker pull "$line"
replace_slash=$(tr '/' '-' <<< "$line")
docker save "${line}" > "/tmp/docker/images/${replace_slash}.tar"
done <$result
- name: save docker images
id: save-docker-images
uses: actions/cache/save@v4
if: steps.images-cache.outputs.cache-hit != 'true'
with:
path: |
/tmp/docker/images
- name: print images
shell: bash
run: |
echo 'printing images'
ls /tmp/docker/images
Original file line number Diff line number Diff line change
Expand Up @@ -37,39 +37,17 @@ runs:
TEST_ARG=$(echo ${sliced_array[@]} | sed 's/ /,/g')
echo "$TEST_ARG"
if [[ $baseBranch == "2.1.x" ]]; then
./mvnw -s .settings.xml -pl '-:kubernetes-leader-election-example' -pl '-:kubernetes-hello-world-example' \
-pl '-:kubernetes-reload-example' -pl '-:kubernetes-loadbalancer-example' \
-pl '-:spring-cloud-kubernetes-configserver' -pl '-:spring-cloud-kubernetes-configuration-watcher' \
-pl '-:spring-cloud-kubernetes-discoveryserver' \
-DtestsToRun=${TEST_ARG[@]} \
-e clean install \
-U -P sonar -nsu --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.http.retryHandler.class=standard \
-Dmaven.wagon.http.retryHandler.count=3 \
-Dskip.build.image=true
else
version=$(java -version)
echo "version of java: $version"
./mvnw -s .settings.xml \
-DtestsToRun=${TEST_ARG[@]} \
-DCURRENT_INSTANCE=${CURRENT_INDEX} \
-e clean install \
-P sonar -nsu --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.http.retryHandler.class=standard \
-Dmaven.wagon.http.retryHandler.count=3 \
-Dskip.build.image=true
fi
./mvnw -s .settings.xml \
-DtestsToRun=${TEST_ARG[@]} \
-DCURRENT_INSTANCE=${CURRENT_INDEX} \
-e clean install \
-P sonar -nsu --batch-mode \
-Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \
-Dhttp.keepAlive=false \
-Dmaven.wagon.http.pool=false \
-Dmaven.wagon.http.retryHandler.class=standard \
-Dmaven.wagon.http.retryHandler.count=3 \
-Dskip.build.image=true
touch /tmp/test_times_${{ env.CURRENT_INDEX }}.txt
Expand All @@ -85,12 +63,10 @@ runs:
- name: show individual test times
shell: bash
if: env.BASE_BRANCH != '2.1.x'
run: cat /tmp/test_times_${{ env.CURRENT_INDEX }}.txt

- name: upload individual tests
if: env.BASE_BRANCH != '2.1.x'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_times_${{ env.CURRENT_INDEX }}.txt
path: /tmp/test_times_${{ env.CURRENT_INDEX }}.txt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ runs:
steps:

- name: download tests with times
if: env.BASE_BRANCH != '2.1.x'
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: tests-with-times-sorted.txt
path: /tmp/

- name: download tests without times
if: env.BASE_BRANCH != '2.1.x'
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: tests-without-times.txt
path: /tmp/
Expand Down Expand Up @@ -187,12 +185,10 @@ runs:

- name: show individual test times
shell: bash
if: env.BASE_BRANCH != '2.1.x'
run: cat /tmp/test_times_${{ env.CURRENT_INDEX }}.txt

- name: upload individual tests
if: env.BASE_BRANCH != '2.1.x'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: test_times_${{ env.CURRENT_INDEX }}.txt
path: /tmp/test_times_${{ env.CURRENT_INDEX }}.txt
9 changes: 0 additions & 9 deletions .github/workflows/composites/setup-jdk1.8/action.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/composites/setup-jdk17/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: setup project with jdk-17
runs:
using: "composite"
steps:
- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
9 changes: 2 additions & 7 deletions .github/workflows/composites/test-times/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,15 @@ runs:

# we omit the name, as such all artifacts are downloaded
- name: download all artifacts
if: env.BASE_BRANCH != '2.1.x'
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: /tmp/all-artifacts

- name: show all artifacts
if: env.BASE_BRANCH != '2.1.x'
shell: bash
run: ls -l /tmp/all-artifacts

- name: merge all artifacts into a single file and sort by time
if: env.BASE_BRANCH != '2.1.x'
shell: bash
run: |
arr=($(find /tmp/all-artifacts/ -type f -name "test_times*"))
Expand All @@ -41,7 +38,6 @@ runs:
cat /tmp/sorted.txt
- name: show all tests in a sorted manner
if: env.BASE_BRANCH != '2.1.x'
shell: bash
run: cat /tmp/sorted.txt

Expand All @@ -51,8 +47,7 @@ runs:
# meaning there could be many of them already present and this is not an exact match
# github in this case will pick up the latest one, exactly what we want.
- name: save test times in cache
uses: actions/cache/save@v3
if: env.BASE_BRANCH != '2.1.x'
uses: actions/cache/save@v4
with:
path: /tmp/sorted.txt
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
19 changes: 0 additions & 19 deletions .github/workflows/composites/upload-docker-images/action.yaml

This file was deleted.

32 changes: 8 additions & 24 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: github-workflow

on:
push:
branches: [ main, 2.1.x, 3.0.x ]
branches: [ main, 3.0.x ]
pull_request:
branches: [ main, 2.1.x, 3.0.x ]
branches: [ main, 3.0.x ]

jobs:
build:
Expand All @@ -27,7 +27,7 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: set env variables
uses: ./.github/workflows/composites/env-variables
Expand All @@ -37,10 +37,6 @@ jobs:
uses: ./.github/workflows/composites/setup-jdk17
if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x'

- name: setup project jdk-8
uses: ./.github/workflows/composites/setup-jdk1.8
if: env.BASE_BRANCH == '2.1.x'

- name: cache local maven repository
uses: ./.github/workflows/composites/cache

Expand All @@ -61,8 +57,7 @@ jobs:

- name: restore test times cache if it exists
id: restore_test_times_cache
if: env.BASE_BRANCH != '2.1.x'
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
path: /tmp/sorted.txt
key: ${{ runner.os }}-spring-cloud-k8s-existing-test-times-cache-${{ github.run_id }}
Expand Down Expand Up @@ -110,7 +105,7 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: clean space
uses: ./.github/workflows/composites/clean-space
Expand All @@ -122,10 +117,6 @@ jobs:
uses: ./.github/workflows/composites/setup-jdk17
if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x'

- name: setup project jdk-8
uses: ./.github/workflows/composites/setup-jdk1.8
if: env.BASE_BRANCH == '2.1.x'

- name: pre-test-actions
uses: ./.github/workflows/composites/pre-test-actions

Expand Down Expand Up @@ -158,7 +149,7 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: clean space
uses: ./.github/workflows/composites/clean-space
Expand All @@ -170,10 +161,6 @@ jobs:
uses: ./.github/workflows/composites/setup-jdk17
if: env.BASE_BRANCH == 'main' || env.BASE_BRANCH == '3.0.x'

- name: setup project jdk-8
uses: ./.github/workflows/composites/setup-jdk1.8
if: env.BASE_BRANCH == '2.1.x'

- name: pre-test-actions
uses: ./.github/workflows/composites/pre-test-actions

Expand All @@ -190,7 +177,6 @@ jobs:
- name: run and save individual test times
env:
CURRENT_INDEX: ${{ matrix.current_index }}
if: env.BASE_BRANCH != '2.1.x'
uses: ./.github/workflows/composites/run-and-save-test-times-when-cache-missing

save_test_times_when_cache_missing:
Expand All @@ -200,10 +186,9 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: compute and save running time of tests
if: env.BASE_BRANCH != '2.1.x'
uses: ./.github/workflows/composites/test-times

save_test_times_when_cache_present:
Expand All @@ -213,8 +198,7 @@ jobs:
steps:

- name: checkout project
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: compute and save running time of tests
if: env.BASE_BRANCH != '2.1.x'
uses: ./.github/workflows/composites/test-times
Loading

0 comments on commit 211b874

Please sign in to comment.