From 84eb376b8adff1277800c37cd9d414c2c1c7deb8 Mon Sep 17 00:00:00 2001 From: knative-automation Date: Sun, 25 Oct 2020 22:10:41 -0700 Subject: [PATCH] Update common github actions (#1072) Signed-off-by: Knative Automation --- .github/workflows/knative-boilerplate.yaml | 2 +- .github/workflows/knative-donotsubmit.yaml | 2 +- .github/workflows/knative-go-build.yaml | 2 +- .github/workflows/knative-go-test.yaml | 2 +- .github/workflows/knative-releasability.yaml | 138 +++++++++++++++++++ .github/workflows/knative-security.yaml | 5 +- .github/workflows/knative-stale.yaml | 2 +- .github/workflows/knative-style.yaml | 5 +- .github/workflows/knative-verify.yaml | 2 +- 9 files changed, 151 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/knative-releasability.yaml diff --git a/.github/workflows/knative-boilerplate.yaml b/.github/workflows/knative-boilerplate.yaml index b45afcca57..9329fdd7ed 100644 --- a/.github/workflows/knative-boilerplate.yaml +++ b/.github/workflows/knative-boilerplate.yaml @@ -13,7 +13,7 @@ # limitations under the License. # This file is automagically synced here from github.com/knative-sandbox/.github -# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. +# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten. name: Boilerplate diff --git a/.github/workflows/knative-donotsubmit.yaml b/.github/workflows/knative-donotsubmit.yaml index 92a96636ba..d9131173d4 100644 --- a/.github/workflows/knative-donotsubmit.yaml +++ b/.github/workflows/knative-donotsubmit.yaml @@ -13,7 +13,7 @@ # limitations under the License. # This file is automagically synced here from github.com/knative-sandbox/.github -# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. +# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten. name: Do Not Submit diff --git a/.github/workflows/knative-go-build.yaml b/.github/workflows/knative-go-build.yaml index 609551157f..226eac87d5 100644 --- a/.github/workflows/knative-go-build.yaml +++ b/.github/workflows/knative-go-build.yaml @@ -13,7 +13,7 @@ # limitations under the License. # This file is automagically synced here from github.com/knative-sandbox/.github -# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. +# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten. name: Build diff --git a/.github/workflows/knative-go-test.yaml b/.github/workflows/knative-go-test.yaml index 8810ba7dbc..9a77276c17 100644 --- a/.github/workflows/knative-go-test.yaml +++ b/.github/workflows/knative-go-test.yaml @@ -13,7 +13,7 @@ # limitations under the License. # This file is automagically synced here from github.com/knative-sandbox/.github -# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. +# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten. name: Test diff --git a/.github/workflows/knative-releasability.yaml b/.github/workflows/knative-releasability.yaml new file mode 100644 index 0000000000..fd934ab759 --- /dev/null +++ b/.github/workflows/knative-releasability.yaml @@ -0,0 +1,138 @@ +# Copyright 2020 The Knative 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 +# +# http://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. + +# This file is automagically synced here from github.com/knative-sandbox/.github +# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. + +name: 'Releasability' + +on: + schedule: + - cron: '0 1 * * 1-5' # 6am Pacific, weekdays. + + workflow_dispatch: # Manual trigger. + inputs: + releaseFamily: + description: 'Release? (vX.Y)' + slackChannel: + description: 'Slack Channel? (release-#)' + +jobs: + releasability: + name: Releasability + runs-on: 'ubuntu-latest' + + env: + ######################################### + # Update this section each release. # + RELEASE: 'v0.18' + SLACK_CHANNEL: 'release-18' + ######################################### + + steps: + - name: Defaults + run: | + # If manual trigger sent releaseFamily and slackChannel, then override them + if [[ "${{ github.event.inputs.releaseFamily }}" != "" ]]; then + echo "RELEASE=${{ github.event.inputs.releaseFamily }}" >> $GITHUB_ENV + fi + if [[ "${{ github.event.inputs.slackChannel }}" != "" ]]; then + echo "SLACK_CHANNEL=${{ github.event.inputs.slackChannel }}" >> $GITHUB_ENV + fi + + - name: Set up Go 1.15.x + uses: actions/setup-go@v2 + with: + go-version: 1.15.x + + - name: Install Dependencies + run: GO111MODULE=on go get knative.dev/test-infra/buoy@master + + - name: Check out code + uses: actions/checkout@v2 + + - name: Exists + id: exists + run: | + EXISTS=0 + buoy exists go.mod --release ${RELEASE} --verbose || EXISTS=$? + if [[ "$EXISTS" -eq "0" ]]; then + EXISTS=true + else + EXISTS=false + fi + echo ::set-output name=release-branch::${EXISTS} + + - name: Check + if: steps.exists.outputs.release-branch == 'false' + run: | + # The following pushes the stdout of buoy into $CHECK_MESSAGE + CHECK=0 + echo 'CHECK_MESSAGE<> $GITHUB_ENV + buoy check go.mod --release ${RELEASE} --domain knative.dev --verbose >> $GITHUB_ENV || CHECK=$? + echo 'EOF' >> $GITHUB_ENV + + # We just captured the return code of the buoy call, test it to see + # if we should continue validating. The next steps short circuit if + # we already know we are not ready for a release. + if [[ "$CHECK" -eq "0" ]]; then + echo 'current=true' >> $GITHUB_ENV + else + echo 'current=false' >> $GITHUB_ENV + fi + + - name: Upgrade + if: steps.exists.outputs.release-branch == 'false' && env.current == 'true' + run: | + # if update deps returns un-successful, then mark current to false. + if ! ./hack/update-deps.sh --release ${RELEASE} --upgrade; then + echo "VERIFY_MESSAGE=Unable to update deps for ${{ github.repository }}." >> $GITHUB_ENV + echo 'current=false' >> $GITHUB_ENV + fi + + - name: Verify + if: steps.exists.outputs.release-branch == 'false' && env.current == 'true' + run: | + # If we see no changes after the upgrade, then we are up to date. + if [[ -z "$(git status --porcelain)" ]]; then + echo "VERIFY_MESSAGE=${{ github.repository }} up to date." >> $GITHUB_ENV + else + echo "VERIFY_MESSAGE=${{ github.repository }} is out of date." >> $GITHUB_ENV + echo 'current=false' >> $GITHUB_ENV + fi + + - name: Status GO + if: steps.exists.outputs.release-branch == 'false' && env.current == 'true' + run: | + echo 'SLACK_COLOR=#098e00' >> $GITHUB_ENV + echo 'SLACK_TITLE=Releasability for ${{ github.repository }} @ ${{ env.RELEASE }} is GO!' >> $GITHUB_ENV + + - name: Status NO-GO + if: steps.exists.outputs.release-branch == 'false' && env.current == 'false' + run: | + echo 'SLACK_COLOR=#8E1600' >> $GITHUB_ENV + echo 'SLACK_TITLE=Releasability for ${{ github.repository }} @ ${{ env.RELEASE }} is NO-GO!' >> $GITHUB_ENV + + - name: Post status to Slack + if: steps.exists.outputs.release-branch == 'false' + uses: rtCamp/action-slack-notify@v2.1.0 + env: + SLACK_ICON: http://github.com/knative.png?size=48 + SLACK_USERNAME: github-actions + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + MSG_MINIMAL: 'true' + SLACK_MESSAGE: | + ${{ env.CHECK_MESSAGE }} + ${{ env.VERIFY_MESSAGE }} + For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/.github/workflows/knative-security.yaml b/.github/workflows/knative-security.yaml index a5f7703d2b..47186ef2e1 100644 --- a/.github/workflows/knative-security.yaml +++ b/.github/workflows/knative-security.yaml @@ -13,11 +13,14 @@ # limitations under the License. # This file is automagically synced here from github.com/knative-sandbox/.github -# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. +# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten. name: 'Security' on: + push: + branches: [ 'master', 'release-*' ] + pull_request: branches: [ 'master', 'release-*' ] diff --git a/.github/workflows/knative-stale.yaml b/.github/workflows/knative-stale.yaml index 1b4e4334b1..972826971b 100644 --- a/.github/workflows/knative-stale.yaml +++ b/.github/workflows/knative-stale.yaml @@ -13,7 +13,7 @@ # limitations under the License. # This file is automagically synced here from github.com/knative-sandbox/.github -# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. +# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten. name: 'Close stale' diff --git a/.github/workflows/knative-style.yaml b/.github/workflows/knative-style.yaml index a2603b1e4d..116c5a13a4 100644 --- a/.github/workflows/knative-style.yaml +++ b/.github/workflows/knative-style.yaml @@ -13,7 +13,7 @@ # limitations under the License. # This file is automagically synced here from github.com/knative-sandbox/.github -# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. +# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten. name: Code Style @@ -93,6 +93,8 @@ jobs: uses: actions/checkout@v2 - name: Install Tools + env: + WOKE_VERSION: v0.1.15 run: | TEMP_PATH="$(mktemp -d)" cd $TEMP_PATH @@ -254,7 +256,6 @@ jobs: shell: bash env: REVIEWDOG_GITHUB_API_TOKEN: ${{ github.token }} - WOKE_VERSION: v0.1.11 run: | set -e cd "${GITHUB_WORKSPACE}" || exit 1 diff --git a/.github/workflows/knative-verify.yaml b/.github/workflows/knative-verify.yaml index 7b9664ad2d..ed5bb3a13e 100644 --- a/.github/workflows/knative-verify.yaml +++ b/.github/workflows/knative-verify.yaml @@ -13,7 +13,7 @@ # limitations under the License. # This file is automagically synced here from github.com/knative-sandbox/.github -# repo by knobots: https://github.com/mattmoor/knobots and will be overwritten. +# repo by knobots: https://github.com/knative-sandbox/knobots and will be overwritten. name: Verify