Update Nightlies #1101
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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. | |
name: Update Nightlies | |
on: | |
schedule: | |
- cron: '0 11 * * 1-5' # 4am Pacific on weekdays | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
update-nightlies: | |
name: update nightlies | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false # Keep running if one leg fails. | |
matrix: | |
nightly: | |
- net-contour | |
- net-istio | |
- net-kourier | |
- net-gateway-api | |
- eventing-kafka-broker-eventing-kafka | |
- eventing-kafka-broker-eventing | |
- eventing-rabbitmq-eventing | |
- eventing-istio-eventing | |
- eventing-istio-eventing-kafka-broker | |
- eventing-gitlab-eventing | |
- backstage-plugins-eventing | |
# Map to nightly-specific parameters. | |
include: | |
- nightly: net-contour | |
module: knative.dev/net-contour | |
directory: ./third_party/contour-latest | |
files: net-contour.yaml contour.yaml | |
bucket: net-contour | |
repository: knative/serving | |
fork: serving | |
channel: net-contour | |
assignee: "@knative/serving-writers" | |
- nightly: net-istio | |
module: knative.dev/net-istio | |
directory: ./third_party/istio-latest | |
files: net-istio.yaml | |
bucket: net-istio | |
repository: knative/serving | |
fork: serving | |
channel: net-istio | |
assignee: "@knative/serving-writers" | |
- nightly: net-kourier | |
module: knative.dev/net-kourier | |
directory: ./third_party/kourier-latest | |
files: kourier.yaml | |
bucket: net-kourier | |
repository: knative/serving | |
fork: serving | |
channel: net-kourier | |
assignee: "@knative/serving-writers" | |
- nightly: net-gateway-api | |
module: knative.dev/net-gateway-api | |
directory: ./third_party/gateway-api-latest | |
files: net-gateway-api.yaml istio-gateway.yaml contour-gateway.yaml gateway-api.yaml | |
bucket: net-gateway-api | |
repository: knative/serving | |
fork: serving | |
channel: net-gateway-api | |
assignee: "@knative/serving-writers" | |
- nightly: eventing-kafka-broker-eventing | |
module: knative.dev/eventing | |
directory: ./third_party/eventing-latest | |
files: eventing-crds.yaml eventing-core.yaml eventing-tls-networking.yaml | |
bucket: eventing | |
repository: knative-extensions/eventing-kafka-broker | |
fork: eventing-kafka-broker | |
channel: eventing-delivery | |
assignee: "@knative-extensions/eventing-wg-leads" | |
- nightly: eventing-rabbitmq-eventing | |
module: knative.dev/eventing | |
directory: ./third_party/eventing-latest | |
files: eventing-crds.yaml eventing-core.yaml | |
bucket: eventing | |
repository: knative-extensions/eventing-rabbitmq | |
fork: eventing-rabbitmq | |
channel: eventing-delivery | |
assignee: "@knative-extensions/eventing-rabbitmq-approvers" | |
- nightly: eventing-istio-eventing | |
module: knative.dev/eventing-istio | |
directory: ./third_party/eventing-latest | |
files: eventing-core.yaml eventing-crds.yaml in-memory-channel.yaml mt-channel-broker.yaml | |
bucket: eventing | |
repository: knative-extensions/eventing-istio | |
fork: eventing-istio | |
channel: eventing | |
assignee: "@knative-extensions/eventing-wg-leads" | |
- nightly: eventing-istio-eventing-kafka-broker | |
module: knative.dev/eventing-istio | |
directory: ./third_party/eventing-kafka-broker-latest | |
files: eventing-kafka-broker.yaml eventing-kafka-controller.yaml eventing-kafka-source.yaml eventing-kafka-channel.yaml eventing-kafka-sink.yaml | |
bucket: eventing-kafka-broker | |
repository: knative-extensions/eventing-istio | |
fork: eventing-istio | |
channel: eventing | |
assignee: "@knative-extensions/eventing-wg-leads" | |
- nightly: eventing-gitlab-eventing | |
module: knative.dev/eventing | |
directory: ./third_party/eventing-latest | |
files: eventing-crds.yaml eventing-core.yaml | |
bucket: eventing | |
repository: knative-extensions/eventing-gitlab | |
fork: eventing-gitlab | |
channel: eventing | |
assignee: "@knative-extensions/eventing-wg-leads" | |
- nightly: backstage-plugins-eventing | |
module: knative.dev/eventing | |
directory: ./third_party/eventing-latest | |
files: eventing-crds.yaml eventing-core.yaml in-memory-channel.yaml mt-channel-broker.yaml | |
bucket: eventing | |
repository: knative-extensions/backstage-plugins | |
fork: backstage-plugins | |
channel: eventing | |
assignee: "@knative-extensions/backstage-plugins-writers" | |
steps: | |
- uses: knative/actions/setup-go@main | |
- name: Install Dependencies | |
run: | | |
go install github.com/dprotaso/modlog@latest | |
- name: Check out code onto GOPATH | |
uses: actions/checkout@v4 | |
with: | |
repository: ${{ matrix.repository }} | |
- name: Download nightlies | |
shell: bash | |
id: nightlies | |
run: | | |
for x in ${{ matrix.files }}; do | |
curl https://storage.googleapis.com/knative-nightly/${{ matrix.bucket }}/latest/$x --create-dirs -o ${GITHUB_WORKSPACE}/${{ matrix.directory }}/$x | |
done | |
function release_labels() { | |
# If grep matches no lines (exit code == 1) make this a noop since pipefail is on | |
git diff | { grep -E 'knative.dev/release.?:|app.kubernetes.io/version:' || [[ $? == 1 ]]; } | tr -s ' ' | |
} | |
# Prior to the 'sed' we have output in the following format: | |
# | |
# - serving.knative.dev/release: "v20210111-9f0302e4" | |
# + serving.knative.dev/release: "v20210112-9f0302e4" | |
# | |
# or | |
# | |
# - app.kubernetes.io/version: "v20210111-9f0302e4" | |
# + app.kubernetes.io/version: "v20210112-9f0302e4" | |
# | |
ref_count=$(release_labels | sed 's/.* "\(.*\)"$/\1/' | cut -d '-' -f2 | sort -u | wc -l) | |
if [[ "$ref_count" -lt 2 ]]; then | |
# For debugging | |
release_labels | sort -u | |
echo "::warning file=.github.js,line=1::${{matrix.nightly}} - skipping bump no changes" | |
exit 0 | |
fi | |
echo "create_pr=true" >> $GITHUB_ENV | |
from_sha=$(release_labels | sort -u | sed 's/^\([+-]\).* ".*-\(.*\)"$/\1 \2/' | grep '-' | cut -d ' ' -f2 | sort -u) | |
to_sha=$(release_labels | sort -u | sed 's/^\([+-]\).* ".*-\(.*\)"$/\1 \2/' | grep '+' | cut -d ' ' -f2 | sort -u) | |
if [[ -z "$from_sha" ]] || [[ -z "$to_sha" ]]; then | |
echo "::warning file=.github.js,line=1::${{matrix.nightly}} - failed to get valid shas for a diff" | |
exit 0 | |
fi | |
# capture logs for the module changes | |
echo 'deplog<<EOF' >> $GITHUB_OUTPUT | |
modlog -s ${{ matrix.module }} $from_sha $to_sha 2>&1 >> $GITHUB_OUTPUT || true | |
echo 'EOF' >> $GITHUB_OUTPUT | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
if: env.create_pr == 'true' | |
with: | |
# Who to look like | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
committer: "Knative Automation <[email protected]>" | |
author: "Knative Automation <[email protected]>" | |
# Where to stage the change. | |
push-to-fork: knative-automation/${{ matrix.fork }} | |
branch: update-nightly/${{ matrix.bucket }} | |
signoff: true | |
delete-branch: true | |
# Description of the change and PR body. | |
commit-message: | | |
Update ${{ matrix.bucket }} nightly | |
${{ steps.nightlies.outputs.deplog }} | |
title: '[Automated] Update ${{ matrix.nightly }} nightly' | |
labels: 'skip-review' | |
body: | | |
/assign ${{ matrix.assignee }} | |
/cc ${{ matrix.assignee }} | |
Produced via: | |
```shell | |
for x in ${{ matrix.files }}; do | |
curl https://storage.googleapis.com/knative-nightly/${{ matrix.bucket }}/latest/$x > ${GITHUB_WORKSPACE}/${{ matrix.directory }}/$x | |
done | |
``` | |
Details: | |
``` | |
${{ steps.nightlies.outputs.deplog }} | |
``` | |
- name: Post failure notice to Slack | |
uses: rtCamp/[email protected] | |
if: ${{ failure() }} | |
env: | |
SLACK_ICON: http://github.com/knative-automation.png?size=48 | |
SLACK_USERNAME: knative-automation | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | |
SLACK_CHANNEL: ${{ matrix.channel }} | |
SLACK_COLOR: '#8E1600' | |
MSG_MINIMAL: 'true' | |
SLACK_TITLE: Update nightly ${{ matrix.nightly }} failed. | |
SLACK_MESSAGE: | | |
For detailed logs: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |