diff --git a/.github/actions/scale-runners-down/action.yml b/.github/actions/scale-runners-down/action.yml new file mode 100644 index 00000000..4b33d3ac --- /dev/null +++ b/.github/actions/scale-runners-down/action.yml @@ -0,0 +1,57 @@ +name: 'scale-down' +description: 'Scale Down Private GitHub Runners' + +inputs: + verbose: + description: 'Verbosity indicator' + required: false + default: 'false' + max_parallel: + description: 'Number of runners to shutdown' + required: true + GCP_CRED_JSON: + description: 'GCP_CRED_JSON' + required: false + TMC_API_TOKEN: + description: 'TMC_API_TOKEN' + required: false +runs: + using: composite + steps: + - name: 'Configure: Checkout' + uses: actions/checkout@v3 + with: + ref: 'main' + - name: 'Action: Ensure scripts are executable' + shell: bash + run: find . -type f -name "*.sh" -exec chmod a+x '{}' \; + - name: 'Configure: Runners Cluster provider' + shell: bash + run: | + RUNNER_TYPE=$(./scripts/determine-provider.sh stream-apps-gh-runners) + if [ "$RUNNER_TYPE" != "gke" ]; then + RUNNER_TYPE=tmc + fi + echo "RUNNER_TYPE=$RUNNER_TYPE" >> $GITHUB_ENV + - name: 'Install: gcloud cli' + if: ${{ env.RUNNER_TYPE == 'gke' }} + uses: ./.github/actions/install-gcloud + - name: 'Action: gcloud auth' + if: ${{ env.RUNNER_TYPE == 'gke' }} + id: auth_gcloud + uses: 'google-github-actions/auth@v0' + with: + create_credentials_file: true + credentials_json: ${{ inputs.GCP_CRED_JSON }} + - name: 'Configure: Install TMC' + if: ${{ env.RUNNER_TYPE == 'tmc' }} + uses: ./.github/actions/install-tmc + - name: 'Action: Login to TMC' + if: ${{ env.RUNNER_TYPE == 'tmc' }} + uses: ./.github/actions/auth-tmc + with: + tmc_api_token: '${{ inputs.TMC_API_TOKEN }}' + - name: 'Action: Decrease runners with ${{ inputs.max_parallel }}' + uses: ./.github/actions/decrease-runners + with: + dec: ${{ inputs.max_parallel }} diff --git a/.github/actions/scale-runners-up/action.yml b/.github/actions/scale-runners-up/action.yml new file mode 100644 index 00000000..00644d6b --- /dev/null +++ b/.github/actions/scale-runners-up/action.yml @@ -0,0 +1,133 @@ +name: 'scale-up' +description: 'Scale Up Private GitHub Runners' + +inputs: + max_parallel: + description: 'Number of private runners to add' + required: true + verbose: + description: 'Verbosity indicator' + required: false + default: 'false' + GCP_CRED_JSON: + description: 'GCP_CRED_JSON' + required: false + TMC_API_TOKEN: + description: 'TMC_API_TOKEN' + required: false + GH_ARC_APP_ID: + description: 'GH_ARC_APP_ID' + required: false + GH_ARC_INSTALLATION_ID: + description: 'GH_ARC_INSTALLATION_ID' + required: false + GH_ARC_PRIVATE_KEY: + description: 'GH_ARC_PRIVATE_KEY' + required: false + GH_ARC_PAT: + description: 'GH_ARC_PAT' + required: false + +outputs: + runner-type: + description: 'Type runner deployment. gke or tmc' + value: ${{ steps.configure-runner-type.outputs.runner-type }} + +runs: + using: 'composite' + steps: + - name: 'Configure: checkout stream-applications' + uses: actions/checkout@v3 + with: + ref: 'main' + - name: Ensure scripts are executable + shell: bash + run: find . -type f -name "*.sh" -exec chmod a+x '{}' \; + - name: 'Configure: Configure provider for stream-apps-gh-runners' + id: 'configure-runner-type' + shell: bash + run: | + RUNNER_TYPE=$(./scripts/determine-provider.sh stream-apps-gh-runners) + echo "RUNNER_TYPE=$RUNNER_TYPE" + echo "RUNNER_TYPE=$RUNNER_TYPE" >> $GITHUB_ENV + outputs: + runner-type: '${{ env.RUNNER_TYPE }}' + - name: 'Install: gcloud cli' + if: ${{ env.RUNNER_TYPE == 'gke' }} + uses: ./.github/actions/install-gcloud + - name: 'Action: gcloud auth' + if: ${{ env.RUNNER_TYPE == 'gke' }} + id: auth_gcloud + uses: 'google-github-actions/auth@v0' + with: + create_credentials_file: true + credentials_json: ${{ inputs.GCP_CRED_JSON }} + - name: 'Configure: Install TMC' + if: ${{ env.RUNNER_TYPE == 'tmc' }} + uses: ./.github/actions/install-tmc + - name: 'Action: Login to TMC' + if: ${{ env.RUNNER_TYPE == 'tmc' }} + uses: ./.github/actions/auth-tmc + with: + tmc_api_token: '${{ inputs.TMC_API_TOKEN }}' + fail_on_error: false + - name: 'Install: Groovy' + uses: ./.github/actions/install-groovy + with: + version: 4.0.4 + - name: 'Action: wait for cluster - stream-apps-gh-runners' + shell: bash + env: + VERBOSE: ${{ inputs.verbose && '--verbose' || '' }} + run: ./scripts/wait-for-cluster-${RUNNER_TYPE}.sh stream-apps-gh-runners + - name: 'Configure: Cluster Region' + if: ${{ env.PROVIDER == 'gke' }} + shell: bash + run: | + set +e + REGION=$(gcloud container clusters list | grep -F "stream-apps-gh-runners" | awk '{print $2}') + if [ "$REGION" == "" ]; then + echo "CREATE_CLUSTER=true" >> $GITHUB_ENV + else + REG_MT=$(./scripts/determine-default.sh stream-apps-gh-runners "machine_type") + export REGION + CUR_MT=$(./scripts/determine-machine-type.sh) + if [ "$REQ_MT" != "$CUR_MT" ]; then + echo "::notice ::Current machinetype is $CUR_MT and required is $REQ_MT" + echo "CREATE_CLUSTER=true" >> $GITHUB_ENV + fi + fi + echo "REGION=${{ inputs.region }}" >> $GITHUB_ENV + - name: 'Action: Re/Create SCDF PRO Runners' + if: ${{ env.CREATE_CLUSTER == 'true' }} + shell: bash + env: + VERBOSE: ${{ inputs.verbose && '--verbose' || '' }} + GH_ARC_APP_ID: ${{ inputs.GH_ARC_APP_ID }} + GH_ARC_INSTALLATION_ID: ${{ inputs.GH_ARC_INSTALLATION_ID }} + GH_ARC_PRIVATE_KEY: ${{ inputs.GH_ARC_PRIVATE_KEY }} + GH_ARC_PAT: ${{ inputs.GH_ARC_PAT }} + run: | + set +e + ./scripts/delete-runners-${RUNNER_TYPE}.sh + set -e + ./scripts/create-runners-cluster-${RUNNER_TYPE}.sh + - name: 'Action: scale cluster - stream-apps-gh-runners for ${{ inputs.max_parallel }} runners' + shell: bash + env: + CLUSTER_NAME: 'stream-apps-gh-runners' + VERBOSE: ${{ inputs.verbose && '--verbose' || '' }} + run: | + echo "::notice ::Scaling stream-apps-gh-runners to ${{ inputs.max_parallel }} pods" + ./scripts/scale-cluster-pods.sh stream-apps-gh-runners ${{ inputs.max_parallel }} + - name: 'Check: Wait for cluster nodes: stream-apps-gh-runners' + shell: bash + env: + VERBOSE: ${{ inputs.verbose && '--verbose' || '' }} + run: | + echo "::notice ::Waiting for cluster stream-apps-gh-runners and it's nodes" + ./scripts/wait-for-cluster-${RUNNER_TYPE}.sh stream-apps-gh-runners --nodes + - name: 'Action: Increase runners with ${{ inputs.max_parallel }}' + uses: ./.github/actions/increase-runners + with: + inc: ${{ inputs.max_parallel }} diff --git a/.github/workflows/common.yml b/.github/workflows/common.yml index e28bffc5..cc54bdd7 100644 --- a/.github/workflows/common.yml +++ b/.github/workflows/common.yml @@ -26,6 +26,9 @@ on: CI_DEPLOY_USERNAME: CI_DEPLOY_PASSWORD: +env: + VERBOSE: ${{ inputs.verbose && 'true' || '' }} + jobs: parameters: runs-on: ubuntu-latest @@ -44,8 +47,6 @@ jobs: run: find . -type f -name "*.sh" -exec chmod a+x '{}' \; - name: 'Configure: create streams applications matrix' shell: bash - env: - VERBOSE: ${{ inputs.verbose && 'true' || '' }} run: | ROOT_DIR=$(realpath $PWD) echo "::info ::checking stream-applications for apps" @@ -93,17 +94,25 @@ jobs: matrix: ${{ env.matrix }} jdk_build: ${{ env.JDK_BUILD }} jre_version: ${{ env.JRE_DEFAULT }} -# scale-runners: -# if: ${{ inputs.scale }} -# needs: -# - parameters -# concurrency: -# group: stream-apps-gh-runners -# cancel-in-progress: false -# uses: ./.github/workflows/scale-runners-up.yml -# with: -# verbose: ${{ inputs.verbose }} -# max_parallel: ${{ toJson(needs.parameters.outputs.max_parallel) }} + scale-runners: + if: ${{ inputs.scale }} + runs-on: ubuntu-latest + needs: + - parameters + concurrency: + group: stream-apps-gh-runners + cancel-in-progress: false + steps: + - name: 'Configure: checkout stream-applications' + uses: actions/checkout@v3 + with: + ref: 'main' + - name: 'Action: Scale Runners Up by ${{ needs.parameters.outputs.max_parallel }}' + uses: ./.github/actions/scale-runners-up + timeout-minutes: 45 + with: + verbose: ${{ inputs.verbose }} + max_parallel: ${{ toJson(needs.parameters.outputs.max_parallel) }} core: runs-on: ubuntu-latest needs: @@ -125,7 +134,6 @@ jobs: env: CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} - VERBOSE: ${{ inputs.verbose }} run: | ROOT_DIR=$(realpath $PWD) MAVEN_OPT="-B -T 1C -s $ROOT_DIR/.settings.xml ${{ inputs.verbose && '--debug' || '' }}" @@ -178,7 +186,6 @@ jobs: CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }} - VERBOSE: ${{ inputs.verbose }} run: ./build-app.sh "stream-applications/applications/processor/${{ matrix.app }}" - name: 'Publish: ${{ matrix.app }}' shell: bash @@ -186,7 +193,6 @@ jobs: DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }} - VERBOSE: ${{ inputs.verbose }} run: ./publish-app.sh "stream-applications/applications/processor/${{ matrix.app }}" sinks: if: ${{ needs.parameters.outputs.sinks != '' && needs.parameters.outputs.sinks != null }} @@ -230,7 +236,6 @@ jobs: DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }} - VERBOSE: ${{ inputs.verbose }} run: ./publish-app.sh "stream-applications/applications/sink/${{ matrix.app }}" sources: if: ${{ needs.parameters.outputs.sources != '' && needs.parameters.outputs.sources != null }} @@ -268,7 +273,6 @@ jobs: CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }} - VERBOSE: ${{ inputs.verbose }} run: ./build-app.sh "stream-applications/applications/source/${{ matrix.app }}" - name: 'Publish: ${{ matrix.app }}' shell: bash @@ -276,21 +280,28 @@ jobs: DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }} DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }} DEFAULT_JDK: ${{ needs.parameters.outputs.jre_version }} - VERBOSE: ${{ inputs.verbose }} run: ./publish-app.sh "stream-applications/applications/source/${{ matrix.app }}" -# scale-down-runners: -# if: ${{ inputs.scale && success() }} -# needs: -# - parameters -# - scale-runners-up -# - core -# - processors -# - sinks -# - sources -# concurrency: -# group: stream-apps-gh-runners -# cancel-in-progress: false -# uses: ./.github/workflows/scale-runners-down.yml -# with: -# verbose: ${{ inputs.verbose }} -# max_parallel: ${{ toJson(needs.parameters.outputs.max_parallel) }} + scale-down-runners: + if: ${{ inputs.scale && success() }} + runs-on: ubuntu-latest + needs: + - parameters + - scale-runners-up + - core + - processors + - sinks + - sources + concurrency: + group: stream-apps-gh-runners + cancel-in-progress: false + steps: + - name: 'Configure: checkout stream-applications' + uses: actions/checkout@v3 + with: + ref: 'main' + - name: 'Action: Scale Runners Down with ${{ needs.parameters.outputs.max_parallel }}' + uses: ./.github/actions/scale-runners-down + timeout-minutes: 15 + with: + verbose: ${{ inputs.verbose }} + max_parallel: ${{ needs.parameters.outputs.max_parallel }} diff --git a/.github/workflows/recreate-runners.yml b/.github/workflows/recreate-runners.yml index 6ab02f6d..958a2259 100644 --- a/.github/workflows/recreate-runners.yml +++ b/.github/workflows/recreate-runners.yml @@ -103,12 +103,9 @@ jobs: VERBOSE: ${{ inputs.verbose == 'true' && '--verbose' || '' }} run: | set +e - source ./scripts/use-${RUNNER_TYPE}.sh $CLUSTER_NAME - RC=$? - if (( $RC == 0 )); then - set +e - ./scripts/delete-runners-${RUNNER_TYPE}.sh - fi + ./scripts/kubeconfig-runners.sh + ./scripts/delete-runners.sh + ./scripts/delete-runners-${RUNNER_TYPE}.sh - name: 'Action: create GH Runners Cluster' shell: bash timeout-minutes: 30 diff --git a/.github/workflows/scale-runners-down.yml b/.github/workflows/scale-runners-down.yml deleted file mode 100644 index 2807a63f..00000000 --- a/.github/workflows/scale-runners-down.yml +++ /dev/null @@ -1,63 +0,0 @@ -name: 'scale-down' -description: 'Scale Down Private GitHub Runners' - -on: - workflow_call: - inputs: - verbose: - required: false - type: boolean - default: false - max_parallel: - type: number - required: true - secrets: - GCP_CRED_JSON: - required: false - TMC_API_TOKEN: - required: false -jobs: - scale-down: - runs-on: ubuntu-latest - concurrency: - group: stream-apps-gh-runners - cancel-in-progress: false - steps: - - name: 'Configure: Checkout' - uses: actions/checkout@v3 - with: - ref: 'main' - - name: 'Action: Ensure scripts are executable' - shell: bash - run: find . -type f -name "*.sh" -exec chmod a+x '{}' \; - - name: 'Configure: Runners Cluster provider' - shell: bash - run: | - RUNNER_TYPE=$(./scripts/determine-provider.sh stream-apps-gh-runners) - if [ "$RUNNER_TYPE" != "gke" ]; then - RUNNER_TYPE=tmc - fi - echo "RUNNER_TYPE=$RUNNER_TYPE" >> $GITHUB_ENV - - name: 'Install: gcloud cli' - if: ${{ env.RUNNER_TYPE == 'gke' }} - uses: ./.github/actions/install-gcloud - - name: 'Action: gcloud auth' - if: ${{ env.RUNNER_TYPE == 'gke' }} - id: auth_gcloud - uses: 'google-github-actions/auth@v0' - with: - create_credentials_file: true - credentials_json: ${{ secrets.GCP_CRED_JSON }} - - name: 'Configure: Install TMC' - if: ${{ env.RUNNER_TYPE == 'tmc' }} - uses: ./.github/actions/install-tmc - - name: 'Action: Login to TMC' - if: ${{ env.RUNNER_TYPE == 'tmc' }} - uses: ./.github/actions/auth-tmc - with: - tmc_api_token: '${{ secrets.TMC_API_TOKEN }}' - - name: 'Action: Decrease runners with ${{ inputs.max_parallel }}' - timeout-minutes: 10 - uses: ./.github/actions/decrease-runners - with: - dec: ${{ inputs.max_parallel }} diff --git a/.github/workflows/scale-runners-up.yml b/.github/workflows/scale-runners-up.yml deleted file mode 100644 index a4c121a0..00000000 --- a/.github/workflows/scale-runners-up.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: 'scale-up' -description: 'Scale Up Private GitHub Runners' - -on: - workflow_call: - inputs: - max_parallel: - type: number - required: true - verbose: - type: boolean - required: false - default: false - outputs: - runner-type: - value: ${{ jobs.scale-up.outputs.runner-type }} - secrets: - GCP_CRED_JSON: - required: false - TMC_API_TOKEN: - required: false - GH_ARC_APP_ID: - required: false - GH_ARC_INSTALLATION_ID: - required: false - GH_ARC_PRIVATE_KEY: - required: false - GH_ARC_PAT: - required: false -jobs: - scale-up: - runs-on: ubuntu-latest - concurrency: - group: stream-apps-gh-runners - cancel-in-progress: false - steps: - - name: 'Configure: checkout stream-applications' - uses: actions/checkout@v3 - with: - ref: 'main' - - name: Ensure scripts are executable - shell: bash - run: find . -type f -name "*.sh" -exec chmod a+x '{}' \; - - name: 'Configure: Configure provider for stream-apps-gh-runners' - shell: bash - timeout-minutes: 15 - run: | - RUNNER_TYPE=$(./scripts/determine-provider.sh stream-apps-gh-runners) - echo "RUNNER_TYPE=$RUNNER_TYPE" - echo "RUNNER_TYPE=$RUNNER_TYPE" >> $GITHUB_ENV - - name: 'Install: gcloud cli' - if: ${{ env.RUNNER_TYPE == 'gke' }} - uses: ./.github/actions/install-gcloud - - name: 'Action: gcloud auth' - if: ${{ env.RUNNER_TYPE == 'gke' }} - id: auth_gcloud - uses: 'google-github-actions/auth@v0' - with: - create_credentials_file: true - credentials_json: ${{ secrets.GCP_CRED_JSON }} - - name: 'Configure: Install TMC' - if: ${{ env.RUNNER_TYPE == 'tmc' }} - uses: ./.github/actions/install-tmc - - name: 'Action: Login to TMC' - if: ${{ env.RUNNER_TYPE == 'tmc' }} - uses: ./.github/actions/auth-tmc - timeout-minutes: 15 - with: - tmc_api_token: '${{ secrets.TMC_API_TOKEN }}' - fail_on_error: false - - name: 'Install: Groovy' - uses: ./.github/actions/install-groovy - with: - version: 4.0.4 - - name: 'Action: wait for cluster - stream-apps-gh-runners' - shell: bash - timeout-minutes: 5 - env: - VERBOSE: ${{ inputs.verbose && '--verbose' || '' }} - run: ./scripts/wait-for-cluster-${RUNNER_TYPE}.sh stream-apps-gh-runners - - name: 'Configure: Cluster Region' - if: ${{ env.PROVIDER == 'gke' }} - shell: bash - run: | - set +e - REGION=$(gcloud container clusters list | grep -F "stream-apps-gh-runners" | awk '{print $2}') - if [ "$REGION" == "" ]; then - echo "CREATE_CLUSTER=true" >> $GITHUB_ENV - else - REG_MT=$(./scripts/determine-default.sh stream-apps-gh-runners "machine_type") - export REGION - CUR_MT=$(./scripts/determine-machine-type.sh) - if [ "$REQ_MT" != "$CUR_MT" ]; then - echo "::notice ::Current machinetype is $CUR_MT and required is $REQ_MT" - echo "CREATE_CLUSTER=true" >> $GITHUB_ENV - fi - fi - echo "REGION=${{ inputs.region }}" >> $GITHUB_ENV - - name: 'Action: Re/Create SCDF PRO Runners' - if: ${{ env.CREATE_CLUSTER == 'true' }} - shell: bash - env: - VERBOSE: ${{ inputs.verbose && '--verbose' || '' }} - run: | - set +e - ./scripts/delete-runners-${RUNNER_TYPE}.sh - set -e - ./scripts/create-runners-cluster-${RUNNER_TYPE}.sh - - name: 'Action: scale cluster - stream-apps-gh-runners for ${{ inputs.max_parallel }} runners' - shell: bash - timeout-minutes: 30 - env: - CLUSTER_NAME: 'stream-apps-gh-runners' - VERBOSE: ${{ inputs.verbose && '--verbose' || '' }} - run: | - echo "::notice ::Scaling stream-apps-gh-runners to ${{ inputs.max_parallel }} pods" - ./scripts/scale-cluster-pods.sh stream-apps-gh-runners ${{ inputs.max_parallel }} - - name: 'Check: Wait for cluster nodes: stream-apps-gh-runners' - shell: bash - timeout-minutes: 25 - env: - VERBOSE: ${{ inputs.verbose && '--verbose' || '' }} - run: | - echo "::notice ::Waiting for cluster stream-apps-gh-runners and it's nodes" - ./scripts/wait-for-cluster-${RUNNER_TYPE}.sh stream-apps-gh-runners --nodes - - name: 'Action: Increase runners with ${{ inputs.max_parallel }}' - timeout-minutes: 10 - uses: ./.github/actions/increase-runners - with: - inc: ${{ inputs.max_parallel }} - outputs: - runner-type: '${{ env.RUNNER_TYPE }}' diff --git a/build-app.sh b/build-app.sh index 721a479c..3ff04de7 100755 --- a/build-app.sh +++ b/build-app.sh @@ -22,7 +22,7 @@ if [ "$1" == "" ]; then fi fi APP_FOLDER=$1 - +set -e check_env CI_DEPLOY_USERNAME check_env CI_DEPLOY_PASSWORD @@ -61,47 +61,47 @@ pushd $APP_FOLDER > /dev/null rm -rf apps if [ -d "src/main/java" ]; then echo "Deploying:$APP_FOLDER" - set -e $SCDIR/mvnw $MAVEN_OPT -s $SCDIR/.settings.xml clean $MAVEN_GOAL -U -Pintegration - set +e else echo "Packaging:$APP_FOLDER" - set -e $SCDIR/mvnw $MAVEN_OPT -s $SCDIR/.settings.xml clean install -U -Pintegration - set +e fi if [ ! -d apps ]; then echo "Cannot find $APP_FOLDER/apps" exit 2 fi pushd apps > /dev/null - echo "Building:$APP_FOLDER/apps" - set -e - ./mvnw $MAVEN_OPT -s $SCDIR/.settings.xml $MAVEN_GOAL -U -Pintegration - set +e APPS=$(find * -maxdepth 0 -type d) for app in $APPS; do - for v in $JDKS; do - echo "Pack:$app:$VERSION-jdk$v" - set -e - pack build \ - --path "$app/target/$app-$VERSION.jar" \ - --builder gcr.io/paketo-buildpacks/builder:base \ - --env BP_JVM_VERSION=$v \ - --env BPE_APPEND_JDK_JAVA_OPTIONS=-Dfile.encoding=UTF-8 \ - --env BPE_APPEND_JDK_JAVA_OPTIONS=-Dsun.jnu.encoding \ - --env BPE_LC_ALL=en_US.utf8 \ - --env BPE_LANG=en_US.utf8 \ - "springcloudstream/$app:$VERSION-jdk$v" - set +e - echo "Created:springcloudstream/$app:$VERSION-jdk$v" - done - if [ "$DEFAULT_JDK" == "" ]; then - set -e - docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$VERSION" - echo "Tagged:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK as springcloudstream/$app:$VERSION" - set +e - fi + echo "Removing jib-maven-plugin for:$APP_FOLDER/apps/$app" + $SCDIR/scripts/remove-jib-plugin.sh $app/pom.xml + done + for app in $APPS; do + pushd "$app" > /dev/null + echo "Building:$APP_FOLDER/apps/$app" + ./mvnw $MAVEN_OPT -s $SCDIR/.settings.xml install deploy -U -Pintegration + for v in $JDKS; do + echo "Pack:$app:$VERSION-jdk$v" + pack build \ + --path "target/$app-$VERSION.jar" \ + --builder gcr.io/paketo-buildpacks/builder:base \ + --env BP_JVM_VERSION=$v \ + --env BPE_APPEND_JDK_JAVA_OPTIONS=-Dfile.encoding=UTF-8 \ + --env BPE_APPEND_JDK_JAVA_OPTIONS=-Dsun.jnu.encoding \ + --env BPE_LC_ALL=en_US.utf8 \ + --env BPE_LANG=en_US.utf8 \ + "springcloudstream/$app:$VERSION-jdk$v" + echo "Created:springcloudstream/$app:$VERSION-jdk$v" + done + if [ "$DEFAULT_JDK" != "" ]; then + docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$VERSION" + echo "Tagged:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK as springcloudstream/$app:$VERSION" + if [ "$BRANCH" != "" ]; then + docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$BRANCH" + echo "Tagged:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK as springcloudstream/$app:$BRANCH" + fi + fi + popd > /dev/null done popd > /dev/null popd > /dev/null diff --git a/config/defaults.json b/config/defaults.json index 645296f8..1fa2a277 100644 --- a/config/defaults.json +++ b/config/defaults.json @@ -15,6 +15,8 @@ "cpu_per_pod": 1, "machine_type": "n2-standard-8", "runner_scaling": "manual", - "scale_down": 1 + "scale_down": 1, + "arc_version": "v0.26.0", + "helm_version": "0.21.0" } } diff --git a/publish-app.sh b/publish-app.sh index f0e9025b..d7ed6184 100644 --- a/publish-app.sh +++ b/publish-app.sh @@ -46,6 +46,10 @@ pushd $APP_FOLDER > /dev/null project="$APP_FOLDER-$broker" set -e docker tag "springcloudstream/$project:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$project:$VERSION" + if [ "$BRANCH" != "" ]; then + docker tag "springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK" "springcloudstream/$app:$BRANCH" + echo "Tagged:springcloudstream/$app:$VERSION-jdk$DEFAULT_JDK as springcloudstream/$app:$BRANCH" + fi docker push "springcloudstream/$project:$VERSION-jdk$DEFAULT_JDK" echo "Pushed:springcloudstream/$project:$VERSION-jdk$DEFAULT_JDK" docker push "springcloudstream/$project:$VERSION" diff --git a/scripts/check-runners.sh b/scripts/check-runners.sh index 9a917b1d..e8eef342 100755 --- a/scripts/check-runners.sh +++ b/scripts/check-runners.sh @@ -2,7 +2,7 @@ SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") SCDIR=$(realpath $SCDIR) PARENT=$(realpath $SCDIR/..) -SCALING=$(jq '.scdf_pro_gh_runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') +SCALING=$(jq '.stream-apps-gh-runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') if [ "$SCALING" == "auto" ]; then echo "Auto scaling:" kubectl get horizontalrunnerautoscalers diff --git a/scripts/decrease-runners-tmc.sh b/scripts/decrease-runners-tmc.sh index 99eae870..d3b871da 100755 --- a/scripts/decrease-runners-tmc.sh +++ b/scripts/decrease-runners-tmc.sh @@ -3,7 +3,7 @@ SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") SCDIR=$(realpath $SCDIR) function count_runners() { - kubectl get pods --namespace default | grep Running | grep -c "runners-ci" + kubectl get pods --namespace default | grep Running | grep -c "runners-stream-ci" } if [ "$1" = "" ]; then diff --git a/scripts/decrease-runners.sh b/scripts/decrease-runners.sh index 35f0c5de..21f0f504 100755 --- a/scripts/decrease-runners.sh +++ b/scripts/decrease-runners.sh @@ -4,16 +4,16 @@ SCDIR=$(realpath $SCDIR) PARENT=$(realpath $SCDIR/..) function max_replicas() { - kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-ci")) | .[] | .spec.maxReplicas' + kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-stream-ci")) | .[] | .spec.maxReplicas' } function min_replicas() { - kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-ci")) | .[] | .spec.minReplicas' + kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-stream-ci")) | .[] | .spec.minReplicas' } function count_runners() { - kubectl get rdeploy runners-ci --output=json | jq '.spec.replicas' + kubectl get rdeploy runners-stream-ci --output=json | jq '.spec.replicas' } function count_running() { - kubectl get rdeploy | grep -F "runners-ci" | awk '{print $4}' + kubectl get rdeploy | grep -F "runners-stream-ci" | awk '{print $4}' } if [ "$1" = "" ]; then @@ -24,8 +24,8 @@ echo "Checking stream-apps-gh-runners" DEC=$1 MIN_RUNNERS=$2 -SCALING=$(jq '.scdf_pro_gh_runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') -cp $SCDIR/k8s/runners-ci-${SCALING}-template.yaml runners-ci-change.yaml +SCALING=$(jq '.stream-apps-gh-runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') +cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci-change.yaml if [ "$SCALING" == "auto" ]; then MAX_RUNNERS=$(max_replicas) MAX_RUNNERS=$((MAX_RUNNERS - DEC)) @@ -68,26 +68,26 @@ IMAGE_SHA=$(wget -q -O- https://hub.docker.com/v2/repositories/summerwind/action if [ "$IMAGE_SHA" == "" ]; then IMAGE_SHA="latest" fi -sed -i 's/tag-placeholder/'"$IMAGE_SHA"'/g' runners-ci-change.yaml +sed -i 's/tag-placeholder/'"$IMAGE_SHA"'/g' runners-stream-ci-change.yaml if [ "$SCALING" == "auto" ]; then MAX_RUNNERS=$((MAX_RUNNERS - DEC)) echo "Runners: changing scaling min: $MIN_RUNNERS, max: $MAX_RUNNERS" - sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-ci-change.yaml - sed -i 's/min-replicas-placeholder/'"$MIN_RUNNERS"'/g' runners-ci-change.yaml + sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-stream-ci-change.yaml + sed -i 's/min-replicas-placeholder/'"$MIN_RUNNERS"'/g' runners-stream-ci-change.yaml else echo "Runners:$CURRENT decrease by $DEC to $TARGET" - sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-ci-change.yaml + sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-stream-ci-change.yaml fi -cmp --silent "$SCDIR/k8s/runners-ci-${SCALING}-template.yaml" runners-ci-change.yaml +cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci-change.yaml RC=$? if ((RC != 0)); then - kubectl apply -f runners-ci-change.yaml + kubectl apply -f runners-stream-ci-change.yaml echo "Runners: changed to $RUNNERS" if [ "$SCALING" != "auto" ]; then - $SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-ci --all-namespaces=true + $SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-stream-ci --all-namespaces=true fi else echo "Runners: unchanged" fi -rm -f runners-ci-change.yaml +rm -f runners-stream-ci-change.yaml $SCDIR/check-runners.sh diff --git a/scripts/delete-runners.sh b/scripts/delete-runners.sh new file mode 100755 index 00000000..3adc3ffd --- /dev/null +++ b/scripts/delete-runners.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +SCDIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")") +SCDIR=$(realpath $SCDIR) + +export CLUSTER_NAME="scdf-pro-gh-runners" +set +e +echo "Deleting scdf-pro-gh-runners" +RDEPLOY=$(kubectl get rdeploy --output=json | jq '.items | .[] | .metadata.name' | sed 's/\"//g') +for item in $RDEPLOY; do + kubectl delete rdeploy $item +done +HRA=$(kubectl get HorizontalRunnerAutoscaler --output=json | jq '.items | .[] | .metadata.name' | sed 's/\"//g') +for item in $HRA; do + kubectl delete HorizontalRunnerAutoscaler $item +done +$SCDIR/delete-k8s-ns.sh actions-runner-system +$SCDIR/delete-k8s-ns.sh cert-manager +exit 0 diff --git a/scripts/deploy-gh-runners.sh b/scripts/deploy-gh-runners.sh index af5886f3..4257208d 100755 --- a/scripts/deploy-gh-runners.sh +++ b/scripts/deploy-gh-runners.sh @@ -5,16 +5,23 @@ PARENT=$(realpath $SCDIR/..) set +e function check_env() { - eval ev='$'$1 - if [ "$ev" == "" ]; then - echo "$1 not defined" - if (( sourced != 0 )); then - return 1 - else - exit 1 - fi + eval ev='$'$1 + if [ "$ev" == "" ]; then + echo "$1 not defined" + if ((sourced != 0)); then + return 1 + else + exit 1 fi + fi } + +if [ "$1" != "" ]; then + DEPLOY_TYPE=$1 +else + DEPLOY_TYPE=helm +fi +echo "Deployment Type: $DEPLOY_TYPE" if [ "$GH_ARC_PAT" == "" ]; then check_env GH_ARC_APP_ID check_env GH_ARC_INSTALLATION_ID @@ -37,34 +44,57 @@ export SVC=controller-manager $SCDIR/ensure-ns.sh $NS kubectl apply -f $SCDIR/k8s/pod-priorities.yaml kubectl apply -f $SCDIR/k8s/pod-priorities.yaml --namespace $NS +COUNT=$(kubectl get secrets "$SVC" --namespace $NS) +if ((COUNT > 0)); then + kubectl delete secret "$SVC" --namespace $NS +fi if [ "$GH_ARC_PAT" != "" ]; then echo "Using GH_ARC_PAT as github_token" - kubectl create secret generic "$SVC-secret" \ - --namespace $NS \ - --from-literal=github_token="$GH_ARC_PAT" + kubectl create secret generic "$SVC" \ + --namespace $NS \ + --from-literal=github_token="$GH_ARC_PAT" else echo "Using GitHub App $GH_ARC_APP_ID / $GH_ARC_INSTALLATION_ID" - kubectl create secret generic "$SVC-secret" \ - --namespace $NS \ - --from-literal=github_app_id="${GH_ARC_APP_ID}" \ - --from-literal=github_app_installation_id="${GH_ARC_INSTALLATION_ID}" \ - --from-literal=github_app_private_key="${GH_ARC_PRIVATE_KEY}" + kubectl create secret generic "$SVC" \ + --namespace $NS \ + --from-literal=github_app_id="${GH_ARC_APP_ID}" \ + --from-literal=github_app_installation_id="${GH_ARC_INSTALLATION_ID}" \ + --from-literal=github_app_private_key="${GH_ARC_PRIVATE_KEY}" +fi +COUNT=$(kubectl get secrets --namespace $NS | grep -c -F "scdf-metadata-default") +if ((COUNT > 0)); then + kubectl delete secret scdf-metadata-default --namespace $NS +fi +kubectl create secret docker-registry scdf-metadata-default --namespace $NS \ + --docker-server=registry-1.docker.io \ + --docker-username=$DOCKER_HUB_USERNAME \ + --docker-password=$DOCKER_HUB_PASSWORD +COUNT=$(kubectl get secrets --namespace default | grep -c -F "scdf-metadata-default") +if ((COUNT > 0)); then + kubectl delete secret scdf-metadata-default --namespace default +fi +kubectl create secret docker-registry scdf-metadata-default --namespace default \ + --docker-server=registry-1.docker.io \ + --docker-username=$DOCKER_HUB_USERNAME \ + --docker-password=$DOCKER_HUB_PASSWORD +if [ "$DEPLOY_TYPE" == "helm" ]; then + HELM_VER=$($SCDIR/determine-default.sh stream-apps-gh-runners "helm_version") + echo "Adding Helm chart https://actions-runner-controller.github.io/actions-runner-controller" + helm repo add actions-runner-controller https://actions-runner-controller.github.io/actions-runner-controller + echo "Installing application: actions-runner-controller, Helm chart version:$HELM_VER into $NS" + helm install --version "$HELM_VER" --namespace $NS -f $SCDIR/arc/values.yml --wait actions-runner-controller actions-runner-controller/actions-runner-controller +else + ARC_VER=$($SCDIR/determine-default.sh stream-apps-gh-runners "arc_version") + echo "Deploying actions-runner-controller:$ARC_VER using kubectl" + kubectl create --save-config --namespace $NS -f https://github.com/actions-runner-controller/actions-runner-controller/releases/download/$ARC_VER/actions-runner-controller.yaml + $SCDIR/wait-deployment.sh $SVC $NS fi - -kubectl create secret docker-registry scdf-metadata-default --namespace $NS --docker-server=registry-1.docker.io --docker-username=$DOCKER_HUB_USERNAME --docker-password=$DOCKER_HUB_PASSWORD -kubectl create secret docker-registry scdf-metadata-default --namespace default --docker-server=registry-1.docker.io --docker-username=$DOCKER_HUB_USERNAME --docker-password=$DOCKER_HUB_PASSWORD - -helm repo add actions-runner-controller https://actions-runner-controller.github.io/actions-runner-controller -helm install --namespace $NS -f $SCDIR/arc/values.yml --wait actions-runner-controller actions-runner-controller/actions-runner-controller -# kubectl create -f https://github.com/actions-runner-controller/actions-runner-controller/releases/download/v0.25.2/actions-runner-controller.yaml - set -e -#$SCDIR/wait-deployment.sh $SVC $NS echo "Creating runners" -SCALING=$(jq '.scdf_pro_gh_runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') -kubectl apply -f "$SCDIR/k8s/runners-ci-${SCALING}.yaml" +SCALING=$(jq '.stream-apps-gh-runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') +kubectl apply -f "$SCDIR/k8s/runners-stream-ci-${SCALING}.yaml" kubectl apply -f "$SCDIR/k8s/runners-generic.yaml" if [ "$SCALING" != "auto" ]; then - $SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-ci + $SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-stream-ci fi $SCDIR/check-runners.sh diff --git a/scripts/increase-runners.sh b/scripts/increase-runners.sh index 35662d7a..0473460c 100755 --- a/scripts/increase-runners.sh +++ b/scripts/increase-runners.sh @@ -4,16 +4,16 @@ SCDIR=$(realpath $SCDIR) PARENT=$(realpath $SCDIR/..) function max_replicas() { - kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-ci")) | .[] | .spec.maxReplicas' + kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-stream-ci")) | .[] | .spec.maxReplicas' } function min_replicas() { - kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-ci")) | .[] | .spec.minReplicas' + kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-stream-ci")) | .[] | .spec.minReplicas' } function count_runners() { - kubectl get rdeploy runners-ci --output=json | jq '.spec.replicas' + kubectl get rdeploy runners-stream-ci --output=json | jq '.spec.replicas' } function count_running() { - kubectl get rdeploy | grep -F "runners-ci" | awk '{print $4}' + kubectl get rdeploy | grep -F "runners-stream-ci" | awk '{print $4}' } if [ "$1" = "" ]; then @@ -25,8 +25,8 @@ INC=$1 # shellcheck disable=SC2003 MAX_RUNNERS=$2 -SCALING=$(jq '.scdf_pro_gh_runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') -cp $SCDIR/k8s/runners-ci-${SCALING}-template.yaml runners-ci-change.yaml +SCALING=$(jq '.stream-apps-gh-runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') +cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci-change.yaml if [ "$SCALING" == "auto" ]; then if [ "$MAX_RUNNERS" == "" ]; then @@ -73,26 +73,26 @@ IMAGE_SHA=$(wget -q -O- https://hub.docker.com/v2/repositories/summerwind/action if [ "$IMAGE_SHA" == "" ]; then IMAGE_SHA="latest" fi -sed -i 's/tag-placeholder/'"$IMAGE_SHA"'/g' runners-ci-change.yaml +sed -i 's/tag-placeholder/'"$IMAGE_SHA"'/g' runners-stream-ci-change.yaml if [ "$SCALING" == "auto" ]; then echo "Runners: changing scaling min: $MIN_RUNNERS, max: $MAX_RUNNERS" - sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-ci-change.yaml - sed -i 's/min-replicas-placeholder/'"$MIN_RUNNERS"'/g' runners-ci-change.yaml + sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-stream-ci-change.yaml + sed -i 's/min-replicas-placeholder/'"$MIN_RUNNERS"'/g' runners-stream-ci-change.yaml else echo "Runners:$CURRENT increase by $INC to $RUNNERS" - sed -i 's/replicas-placeholder/'"$RUNNERS"'/g' runners-ci-change.yaml + sed -i 's/replicas-placeholder/'"$RUNNERS"'/g' runners-stream-ci-change.yaml fi -cmp --silent "$SCDIR/k8s/runners-ci-${SCALING}-template.yaml" runners-ci-change.yaml +cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci-change.yaml RC=$? if ((RC != 0)); then - kubectl apply -f runners-ci-change.yaml + kubectl apply -f runners-stream-ci-change.yaml echo "Runners: applied change to $RUNNERS" if [ "$SCALING" != "auto" ]; then - $SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-ci --all-namespaces=true + $SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-stream-ci --all-namespaces=true fi else echo "Runners: no changes required" fi -rm -f runners-ci-change.yaml +rm -f runners-stream-ci-change.yaml $SCDIR/check-runners.sh diff --git a/scripts/limit-runners.sh b/scripts/limit-runners.sh index 6dfd4a0e..1cb98365 100755 --- a/scripts/limit-runners.sh +++ b/scripts/limit-runners.sh @@ -4,14 +4,14 @@ SCDIR=$(realpath $SCDIR) PARENT=$(realpath $SCDIR/..) function max_replicas() { - kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-ci")) | .[] | .spec.maxReplicas' + kubectl get horizontalrunnerautoscalers --output=json | jq '.items | map(select(.spec.scaleTargetRef.name == "runners-stream-ci")) | .[] | .spec.maxReplicas' } function count_runners() { - kubectl get rdeploy | grep -F "runners-ci" | awk '{print $2}' + kubectl get rdeploy | grep -F "runners-stream-ci" | awk '{print $2}' } function count_running() { - kubectl get rdeploy | grep -F "runners-ci" | awk '{print $4}' + kubectl get rdeploy | grep -F "runners-stream-ci" | awk '{print $4}' } if [ "$1" = "" ]; then echo "Expected number to runners" @@ -45,31 +45,31 @@ IMAGE_SHA=$(wget -q -O- https://hub.docker.com/v2/repositories/summerwind/action if [ "$IMAGE_SHA" == "" ]; then IMAGE_SHA="latest" fi -SCALING=$(jq '.scdf_pro_gh_runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') -cp $SCDIR/k8s/runners-ci-${SCALING}-template.yaml runners-ci-change.yaml -sed -i 's/tag-placeholder/'"$IMAGE_SHA"'/g' runners-ci-change.yaml +SCALING=$(jq '.stream-apps-gh-runners.runner_scaling' $PARENT/config/defaults.json | sed 's/\"//g') +cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci-change.yaml +sed -i 's/tag-placeholder/'"$IMAGE_SHA"'/g' runners-stream-ci-change.yaml if [ "$SCALING" == "auto" ]; then if [ "$MAX_RUNNERS" == "" ]; then MAX_RUNNERS=$(max_replicas) fi echo "Runners: Max runners to $MAX_RUNNERS" echo "Runners: changing scaling min: $TARGET, max: $MAX_RUNNERS" - sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-ci-change.yaml - sed -i 's/min-replicas-placeholder/'"$TARGET"'/g' runners-ci-change.yaml + sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-stream-ci-change.yaml + sed -i 's/min-replicas-placeholder/'"$TARGET"'/g' runners-stream-ci-change.yaml else echo "Runners:$CURRENT change to $TARGET" - sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-ci-change.yaml + sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-stream-ci-change.yaml fi -cmp --silent "$SCDIR/k8s/runners-ci-${SCALING}-template.yaml" runners-ci-change.yaml +cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci-change.yaml RC=$? if ((RC != 0)); then - kubectl apply -f runners-ci-change.yaml + kubectl apply -f runners-stream-ci-change.yaml echo "Runners: applying changes" if [ "$SCALING" != "auto" ]; then - $SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-ci --all-namespaces=true + $SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-stream-ci --all-namespaces=true fi else echo "Runners:no changes required" fi -rm -f runners-ci-change.yaml +rm -f runners-stream-ci-change.yaml $SCDIR/check-runners.sh diff --git a/scripts/remove-jib-plugin.sh b/scripts/remove-jib-plugin.sh new file mode 100755 index 00000000..62e5ef39 --- /dev/null +++ b/scripts/remove-jib-plugin.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +SCDIR=$(realpath $(dirname "$(readlink -f "${BASH_SOURCE[0]}")" )) +if [ "$1" = "" ]; then + echo "Usage $0 " + exit 1 +fi +FILE=$(realpath $1) +TMP_FILE="$1-pom-mod.xml" +TMP_FILE="${TMP_FILE//\//-/g}" +echo "Removing jib-maven-plugin from $FILE" +xsltproc -o $TMP_FILE $SCDIR/remove-jib-plugin.xsl $FILE +RC=$? +if((RC!=0)); then + exit 1 +fi +mv -f $TMP_FILE $FILE +#rm -f $TMP_FILE diff --git a/scripts/remove-jib-plugin.xsl b/scripts/remove-jib-plugin.xsl new file mode 100644 index 00000000..651dd155 --- /dev/null +++ b/scripts/remove-jib-plugin.xsl @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file