Skip to content

Commit

Permalink
Pin to 17, but check releasability against 18
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmoor committed Oct 7, 2020
1 parent 79adee8 commit 63072f2
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 27 deletions.
109 changes: 109 additions & 0 deletions .github/workflows/knative-releasability.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# 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 5 * * 1-5' # 5am, robot time, weekdays.

workflow_dispatch: # Manual trigger.

jobs:
releasability:
name: Releasability
runs-on: 'ubuntu-latest'

env:
#########################################
# Update this section each release. #
RELEASE: v0.18
SLACK_CHANNEL: 'mattmoor-slack-test'
#########################################

steps:
- 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 tableflip.dev/buoy@master

- name: Check out code
uses: actions/checkout@v2
with:
path: ./src/knative.dev/${{ github.event.repository.name }}

- name: Check
run: |
# The following pushes the stdout of buoy into $CHECK_MESSAGE
echo 'CHECK_MESSAGE<<EOF' >> $GITHUB_ENV
(buoy check go.mod --release ${RELEASE} --domain knative.dev --verbose || CHECK=$?) >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
# We just captured the return code of the buoy call, test it to see
# if we should contiue 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: 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 'current=false' >> $GITHUB_ENV
fi
- name: Verify
if: 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: env.current == 'true'
run: |
echo 'SLACK_COLOR=#098e00' >> $GITHUB_ENV
echo 'SLACK_TITLE=Releasability for ${{ github.repository }} @ ${RELEASE} is GO!' >> $GITHUB_ENV
- name: Status NO-GO
if: env.current == 'false'
run: |
echo 'SLACK_COLOR=#8E1600' >> $GITHUB_ENV
echo 'SLACK_TITLE=Releasability for ${{ github.repository }} @ ${RELEASE} is NO-GO!' >> $GITHUB_ENV
- name: Post notice to Slack
uses: rtCamp/[email protected]
env:
SLACK_ICON: http://github.com/knative.png?size=48
SLACK_USERNAME: github-actions
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
MSG_MINIMAL: 'true'
SLACK_MESSAGE: |
${CHECK_MESSAGE}
${VERIFY_MESSAGE}
For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
45 changes: 18 additions & 27 deletions hack/update-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,42 +26,33 @@ cd ${ROOT_DIR}
# We need these flags for things to work properly.
export GO111MODULE=on

# This controls the release branch we track.
VERSION="release-0.17"

# The list of dependencies that we track at HEAD and periodically
# float forward in this repository.
FLOATING_DEPS=(
"knative.dev/pkg@${VERSION}"
"knative.dev/test-infra@${VERSION}"

"knative.dev/serving@${VERSION}"
"knative.dev/networking@${VERSION}"
"knative.dev/caching@${VERSION}"
"knative.dev/net-http01@${VERSION}"
"knative.dev/net-contour@${VERSION}"

"github.com/projectcontour/[email protected]"

"knative.dev/eventing@${VERSION}"

"github.com/tektoncd/[email protected]"
"github.com/tektoncd/cli@master"
)

# Parse flags to determine any we should pass to dep.
GO_GET=0
UPGRADE=0
VERSION="v0.17"
while [[ $# -ne 0 ]]; do
parameter=$1
case ${parameter} in
--upgrade) GO_GET=1 ;;
--upgrade) UPGRADE=1 ;;
--release) shift; VERSION="$1" ;;
*) abort "unknown option ${parameter}" ;;
esac
shift
done
readonly GO_GET
readonly UPGRADE
readonly VERSION

# The list of dependencies that we track at HEAD and periodically
# float forward in this repository.
FLOATING_DEPS=( $(run_go_tool tableflip.dev/buoy buoy float ${ROOT_DIR}/go.mod --release ${VERSION} --domain knative.dev) )

FLOATING_DEPS=(
"github.com/projectcontour/[email protected]"

# "github.com/tektoncd/[email protected]"
# "github.com/tektoncd/cli@master"
)

if (( GO_GET )); then
if (( UPGRADE )); then
go get -d ${FLOATING_DEPS[@]}
fi

Expand Down

0 comments on commit 63072f2

Please sign in to comment.