automate updating yearly leaderboard

pull/14375/head
Steven Powell 2022-06-21 15:44:26 -07:00
parent 87caec4d58
commit 98377c37b0
19 changed files with 133 additions and 35 deletions

View File

@ -24,7 +24,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Download Dependencies
run: go mod download
- name: Build Binaries
@ -51,7 +50,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install libvirt
run: |
sudo apt-get update
@ -70,7 +68,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install libvirt
run: |
sudo apt-get update

View File

@ -19,7 +19,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Generate Docs
id: gendocs
run: |

View File

@ -38,7 +38,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Download Dependencies
run: go mod download
- name: Build Binaries
@ -118,7 +117,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Download Binaries
uses: actions/download-artifact@fdafc3f9f2e2a522dc1d230e6a03de57a1e71c95

View File

@ -20,7 +20,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Update Leaderboard
id: leaderboard
run: |

View File

@ -28,7 +28,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Download Dependencies
run: go mod download
- name: Build Binaries
@ -55,7 +54,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install libvirt
run: |
sudo apt-get update
@ -74,7 +72,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install libvirt
run: |
sudo apt-get update
@ -122,7 +119,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
@ -222,7 +218,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
@ -326,7 +321,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
run: |
@ -412,7 +406,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
@ -522,7 +515,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash

View File

@ -26,7 +26,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Download Dependencies
run: go mod download
- name: Build Binaries
@ -53,7 +52,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install libvirt
run: |
sudo apt-get update
@ -72,7 +70,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install libvirt
run: |
sudo apt-get update
@ -120,7 +117,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
run: |
@ -220,7 +216,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
@ -325,7 +320,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
run: |
@ -412,7 +406,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash
@ -523,7 +516,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install gopogh
shell: bash

View File

@ -23,7 +23,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Benchmark time-to-k8s for Docker driver with Docker runtime
run: |
./hack/benchmark/time-to-k8s/public-chart/public-chart.sh docker docker
@ -48,7 +47,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Disable firewall
run: |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off

View File

@ -19,7 +19,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: time-to-k8s Benchmark
id: timeToK8sBenchmark
run: |

View File

@ -18,7 +18,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Install libvirt
run: |
sudo apt-get update

View File

@ -18,7 +18,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Bump Golang Versions
id: bumpGolang
run: |

View File

@ -18,7 +18,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Bump Golint Versions
id: bumpGolint
run: |

View File

@ -18,7 +18,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Bump gopogh Versions
id: bumpGopogh
run: |

View File

@ -18,7 +18,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Bump Gotestsum Versions
id: bumpGotestsum
run: |

View File

@ -18,7 +18,6 @@ jobs:
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
stable: true
- name: Bump Kubeadm Constants for Kubernetes Images
id: bumpKubAdmConsts
run: |

View File

@ -0,0 +1,47 @@
name: "update-yearly-leaderboard"
on:
workflow_dispatch:
schedule:
# The 2nd of every month
- cron: "0 0 2 * *"
env:
GOPROXY: https://proxy.golang.org
GO_VERSION: '1.18.3'
permissions:
contents: read
jobs:
update-yearly-leaderboard:
if: github.repository == 'kubernetes/minikube'
runs-on: ubuntu-20.04
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-west-1'
steps:
- uses: actions/checkout@629c2de402a417ea7690ca6ce3f33229e27606a5
- uses: actions/setup-go@b22fbbc2921299758641fab08929b4ac52b32923
with:
go-version: ${{env.GO_VERSION}}
- name: Update Yearly Leaderboard
id: yearly-leaderboard
run: |
make update-yearly-leaderboard
env:
GITHUB_TOKEN: ${{ secrets.MINIKUBE_BOT_PAT }}
- name: Create PR
if: ${{ steps.leaderboard.outputs.changes != '' }}
uses: peter-evans/create-pull-request@923ad837f191474af6b1721408744feb989a4c27
with:
token: ${{ secrets.MINIKUBE_BOT_PAT }}
commit-message: Update yearly leaderboard
committer: minikube-bot <minikube-bot@google.com>
author: minikube-bot <minikube-bot@google.com>
branch: yearly-leaderboard
push-to-fork: minikube-bot/minikube
base: master
delete-branch: true
title: 'Update Yearly Leaderboard'
body: |
Committing changes resulting from `make update-yearly-leaderboard`.
This PR is auto-generated by the [update-yearly-leaderboard](https://github.com/kubernetes/minikube/blob/master/.github/workflows/yearly-leaderboard.yml) CI workflow.

View File

@ -813,6 +813,10 @@ release-notes:
update-leaderboard:
hack/update_contributions.sh
.PHONY: update-yearly-leaderboard
update-yearly-leaderboard:
hack/yearly-leaderboard.sh
out/docker-machine-driver-kvm2: out/docker-machine-driver-kvm2-$(GOARCH)
$(if $(quiet),@echo " CP $@")
$(Q)cp $< $@

View File

@ -58,6 +58,11 @@ var (
`GO_VERSION: .*`: `GO_VERSION: '{{.StableVersion}}'`,
},
},
".github/workflows/yearly-leaderboard.yml": {
Replace: map[string]string{
`GO_VERSION: .*`: `GO_VERSION: '{{.StableVersion}}'`,
},
},
".github/workflows/translations.yml": {
Replace: map[string]string{
`GO_VERSION: .*`: `GO_VERSION: '{{.StableVersion}}'`,

View File

@ -70,7 +70,7 @@ while read -r tag_index tag_name tag_start tag_end; do
echo "Generating leaderboard for" "$tag_name" "(from $tag_start to $tag_end)"
# Print header for page.
printf -- "---\ntitle: \"$tag_name - $tag_end\"\nlinkTitle: \"$tag_name - $tag_end\"\nweight: $tag_index\n---\n" > "$destination/$tag_name.html"
# Add pullsheet content (deleting the lines consisting of the command used to generate it).
$DIR/pullsheet leaderboard --token-path "$TMP_TOKEN" --repos kubernetes/minikube --since "$tag_start" --until "$tag_end" --logtostderr=false --stderrthreshold=2 \
| sed -r -e "/Command\-line/,/pullsheet/d" >> "$destination/$tag_name.html"
# Add pullsheet content
$DIR/pullsheet leaderboard --token-path "$TMP_TOKEN" --repos kubernetes/minikube --since "$tag_start" --until "$tag_end" --hide-command --logtostderr=false --stderrthreshold=2 \
>> "$destination/$tag_name.html"
done <<< "$tags_with_range"

74
hack/yearly-leaderboard.sh Executable file
View File

@ -0,0 +1,74 @@
#!/bin/bash
# Copyright 2022 The Kubernetes Authors All rights reserved.
#
# 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.
set -eu -o pipefail
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DESTINATION="$DIR/../site/content/en/docs/contrib/leaderboard"
TMP_TOKEN=$(mktemp)
BUCKET="s3://minikube-leaderboard"
YEAR=$(date +"%Y" --date "last month")
MONTH=$(date +"%m" --date "last month")
DAYS_IN_MONTH=$(cal $(date +"%m %Y" --date "last month") | awk 'NF {DAYS = $NF}; END {print DAYS}')
install_pullsheet() {
echo >&2 'Installing pullsheet'
go install github.com/google/pullsheet@latest
}
verify_gh_auth() {
gh auth status -t 2>&1 | sed -n -r 's/^.*Token: ([a-zA-Z0-9_]*)/\1/p' > "$TMP_TOKEN"
if [ ! -s "$TMP_TOKEN" ]; then
echo "Failed to acquire token from 'gh auth'. Ensure 'gh' is authenticated." 1>&2
exit 1
fi
}
# Ensure the token is deleted when the script exits, so the token is not leaked.
cleanup_token() {
rm -f "$TMP_TOKEN"
}
copy() {
aws s3 cp "$1" "$2"
}
generate_leaderboard() {
echo "Generating leaderboard for" "$YEAR"
# Print header for page
printf -- "---\ntitle: \"$YEAR\"\nlinkTitle: \"$YEAR\"\nweight: -9999$YEAR\n---\n" > "$DESTINATION/$YEAR.html"
# Add pullsheet content
pullsheet leaderboard --token-path "$TMP_TOKEN" --repos kubernetes/minikube --since-display "$YEAR-01-01" --since "$YEAR-$MONTH-01" --until "$YEAR-$MONTH-$DAYS_IN_MONTH" --json-files "./$YEAR.json" --json-output "./$YEAR.json" --hide-command --logtostderr=false --stderrthreshold=2 >> "$DESTINATION/$YEAR.html"
}
cleanup() {
rm "$YEAR.json"
}
install_pullsheet
verify_gh_auth
trap cleanup_token EXIT
copy "$BUCKET/$YEAR.json" "$YEAR.json" || printf -- "{}" > "$YEAR.json"
generate_leaderboard
copy "$YEAR.json" "$BUCKET/$YEAR.json"
copy "$YEAR.json" "$BUCKET/$YEAR-$MONTH.json"
cleanup