Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .git-crypt/.gitattributes

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 0 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ updates:
interval: daily
labels:
- "area/dependency"
- "release-note-none"
- "ok-to-test"
open-pull-requests-limit: 10

Expand All @@ -16,6 +15,5 @@ updates:
interval: daily
labels:
- "area/dependency"
- "release-note-none"
- "ok-to-test"
open-pull-requests-limit: 10
8 changes: 3 additions & 5 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@ on:
pull_request:
push:
branches:
- main
- master

jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
with:
go-version: '1.22'
check-latest: true
go-version: v1.24.5
- name: golangci-lint
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.0
with:
version: v2.1
version: v2.5
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ linters:
- musttag
- nakedret
- nilerr
- noctx
# - noctx
- nolintlint
- nosprintfhostport
- prealloc
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

FROM debian:bookworm
MAINTAINER Stefan Schimanski <sttts@redhat.com>

Check warning on line 16 in Dockerfile

View workflow job for this annotation

GitHub Actions / docker

The MAINTAINER instruction is deprecated, use a label instead to define an image author

MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label More info: https://docs.docker.com/go/dockerfile/rule/maintainer-deprecated/
RUN apt-get update \
&& apt-get install -y -qq git=1:2.39.5-0+deb12u2 \
&& apt-get install -y -qq mercurial \
Expand All @@ -23,8 +23,8 @@
ENV GOPATH="/go-workspace"
ENV GOROOT="/go-workspace/go"
ENV PATH="${GOPATH}/bin:/go-workspace/go/bin:${PATH}"
ENV GIT_COMMITTER_NAME="Kubernetes Publisher"
ENV GIT_COMMITTER_EMAIL="k8s-publishing-bot@users.noreply.github.com"
ENV GIT_COMMITTER_NAME="kcp CI Bot"
ENV GIT_COMMITTER_EMAIL="kcp-ci-bot@xrstf.de"
ENV TERM=xterm
ENV PS1='\h:\w\$'
ENV SHELL=/bin/bash
Expand Down
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ all: build
GIT_TAG ?= $(shell git describe --tags --always --dirty)

# Image variables
IMG_REGISTRY ?= gcr.io/k8s-staging-publishing-bot
IMG_NAME = k8s-publishing-bot
IMG_REGISTRY ?= ghcr.io/kcp-dev
IMG_NAME = publishing-bot

IMG_VERSION ?= v0.0.0-2

Expand All @@ -37,6 +37,7 @@ CPU_LIMITS ?= 2
CPU_REQUESTS ?= 300m
MEMORY_REQUESTS ?= 200Mi
MEMORY_LIMITS ?= 1639Mi
STORAGE_CLASS ?= ebs-sc
GOOS ?= linux

build_cmd = mkdir -p _output && GOOS=$(GOOS) CGO_ENABLED=0 go build -o _output/$(1) ./cmd/$(1)
Expand Down Expand Up @@ -90,11 +91,11 @@ init-deploy: validate
$(KUBECTL) delete -n "$(NAMESPACE)" --ignore-not-found=true replicaset publisher
$(KUBECTL) delete -n "$(NAMESPACE)" --ignore-not-found=true pod publisher
while $(KUBECTL) get pod -n "$(NAMESPACE)" publisher -a &>/dev/null; do echo -n .; sleep 1; done
$(KUBECTL) apply -n "$(NAMESPACE)" -f artifacts/manifests/storage-class.yaml || true
$(KUBECTL) get StorageClass ssd
$(KUBECTL) get StorageClass "$(STORAGE_CLASS)"
$(KUBECTL) apply -n "$(NAMESPACE)" -f $(CONFIG)-configmap.yaml
$(KUBECTL) apply -n "$(NAMESPACE)" -f $(CONFIG)-rules-configmap.yaml; \
$(KUBECTL) apply -n "$(NAMESPACE)" -f artifacts/manifests/pvc.yaml
$(KUBECTL) apply -n "$(NAMESPACE)" -f $(CONFIG)-rules-configmap.yaml
{ cat artifacts/manifests/pvc.yaml && sed 's,SC_NAME,$(STORAGE_CLASS),g' artifacts/manifests/pvc.yaml; } | \
$(KUBECTL) apply -f -
.PHONY: init-deploy

run: init-deploy
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
> [!IMPORTANT]
> This is a fork of the [Kubernetes publishing-bot project](https://github.com/kubernetes/publishing-bot).
>
> The reason for this fork is that the upstream publishing-bot project has a lot of hardcoded values that are
> not compatible with kcp. These hardcoded values are project-specific, so the only option was to fork the
> project and change these values to make it compatible with kcp and its infrastructure.
>
> For any inquires, see [our web page](https://docs.kcp.io/kcp/main/#getting-in-touch) for information on how to
> get in touch with us.

# Kubernetes Publishing Bot

[![sig-release-publishing-bot/build](https://testgrid.k8s.io/q/summary/sig-release-publishing-bot/build/tests_status?style=svg)](https://testgrid.k8s.io/sig-release-publishing-bot#build)
Expand Down
2 changes: 1 addition & 1 deletion artifacts/manifests/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: batch/v1beta1
apiVersion: batch/v1
kind: CronJob
metadata:
name: publisher
Expand Down
2 changes: 1 addition & 1 deletion artifacts/manifests/pvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ spec:
resources:
requests:
storage: 100Gi
storageClassName: ssd
storageClassName: "SC_NAME"
7 changes: 0 additions & 7 deletions artifacts/manifests/storage-class.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion configs/kubernetes → configs/kcp-dev
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DOCKER_REPO = gcr.io/k8s-staging-publishing-bot/k8s-publishing-bot
DOCKER_REPO = ghcr.io/kcp-dev/publishing-bot
NAMESPACE = publishing-bot
SCHEDULE = * */4 * * *
INTERVAL = 14400
Expand Down
13 changes: 13 additions & 0 deletions configs/kcp-dev-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: publisher-config
data:
config: |
source-org: kcp-dev
source-repo: kcp
target-org: kcp-dev
rules-file: https://raw.githubusercontent.com/kcp-dev/kcp/refs/heads/main/staging/publishing/rules.yaml
git-default-branch: main
github-issue: 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: this needs to be changed.

dry-run: false
8 changes: 8 additions & 0 deletions configs/kcp-nightly
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
DOCKER_REPO = ghcr.io/kcp-dev/publishing-bot
NAMESPACE = publishing-bot-nightly
SCHEDULE = * */4 * * *
INTERVAL = 14400
CPU_LIMITS = 2
CPU_REQUESTS = 300m
MEMORY_REQUESTS = 2Gi
MEMORY_LIMITS = 2Gi
13 changes: 13 additions & 0 deletions configs/kcp-nightly-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: publisher-config
data:
config: |
source-org: kcp-nightly
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: this needs to be changed after configuring publishing-bot for kcp-dev.

source-repo: kcp
target-org: kcp-nightly
rules-file: https://raw.githubusercontent.com/kcp-nightly/kcp/refs/heads/main/staging/publishing/rules.yaml
git-default-branch: main
github-issue: 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: this needs to be changed.

dry-run: false
12 changes: 0 additions & 12 deletions configs/kubernetes-configmap.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions configs/kubernetes-nightly

This file was deleted.

12 changes: 0 additions & 12 deletions configs/kubernetes-nightly-configmap.yaml

This file was deleted.

Binary file removed configs/kubernetes-nightly-token
Binary file not shown.
Binary file removed configs/kubernetes-token
Binary file not shown.
8 changes: 4 additions & 4 deletions hack/create-repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if [ "$#" = 0 ] || [ "$#" -gt 2 ]; then
exit 1
fi

FROM="kubernetes"
FROM="kcp-dev"
TO="${1}"
if [ "$#" -ge 2 ]; then
FROM="${TO}"
Expand All @@ -39,8 +39,8 @@ GITHUB_HOST=${GITHUB_HOST:-github.com}
repo_count=${#repos[@]}

# safety check
if [ "${TO}" = "kubernetes" ]; then
echo "Cannot operate on kubernetes directly" 1>&2
if [ "${TO}" = "kcp-dev" ]; then
echo "Cannot operate on kcp-dev directly" 1>&2
exit 1
fi

Expand Down Expand Up @@ -69,6 +69,6 @@ for (( i=0; i<${repo_count}; i++ )); do
echo "repository found: ${repos[i]}"
else
echo "repository not found: ${repos[i]}"
gh repo fork "kubernetes/${repos[i]}" --org "${TO}" --remote --clone=false
gh repo fork "kcp-dev/${repos[i]}" --org "${TO}" --remote --clone=false
fi
done
8 changes: 4 additions & 4 deletions hack/fetch-all-latest-and-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if [ "$#" = 0 ] || [ "$#" -gt 2 ]; then
exit 1
fi

FROM="kubernetes"
FROM="kcp-dev"
TO="${1}"
if [ "$#" -ge 2 ]; then
FROM="${TO}"
Expand All @@ -46,8 +46,8 @@ function delete() {
trap delete EXIT INT

# safety check
if [ "${TO}" = "kubernetes" ]; then
echo "Cannot operate on kubernetes directly" 1>&2
if [ "${TO}" = "kcp-dev" ]; then
echo "Cannot operate on kcp-dev directly" 1>&2
exit 1
fi

Expand All @@ -61,7 +61,7 @@ for (( i=0; i<${repo_count}; i++ )); do

# delete all tags and branches in origin
rm -f .git/refs/tags/*
branches=$(git branch -r | grep "^ *origin" | sed 's,^ *origin/,,' | grep -v HEAD | grep -v '^master' || true)
branches=$(git branch -r | grep "^ *origin" | sed 's,^ *origin/,,' | grep -v HEAD | grep -v '^master' | grep -v '^main' || true)
tags=$(git tag | sed 's,^,refs/tags/,')
if [ -n "${branches}${tags}" ]; then
git push --atomic --delete origin ${branches} ${tags}
Expand Down
29 changes: 0 additions & 29 deletions hack/repos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,7 @@ set -o pipefail

# shellcheck disable=SC2034
repos=(
api
apiextensions-apiserver
apimachinery
apiserver
cli-runtime
client-go
cloud-provider
cluster-bootstrap
code-generator
component-base
component-helpers
controller-manager
cri-api
cri-client
csi-translation-lib
dynamic-resource-allocation
externaljwt
endpointslice
kms
kube-aggregator
kube-controller-manager
kube-proxy
kube-scheduler
kubectl
kubelet
legacy-cloud-providers
metrics
mount-utils
pod-security-admission
sample-apiserver
sample-cli-plugin
sample-controller
)
2 changes: 1 addition & 1 deletion hack/verify-golangci-lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

VERSION=v1.55.2
VERSION=v2.5.0
URL_BASE=https://raw.githubusercontent.com/golangci/golangci-lint
URL=$URL_BASE/$VERSION/install.sh

Expand Down
12 changes: 6 additions & 6 deletions test/k8s-gen-bot-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set -o nounset
set -o pipefail
set -o xtrace

# This script generates the config and rules required for testing the master branch of k/k
# This script generates the config and rules required for testing the main branch of kcp-dev/kcp
# with publishing bot

BOT_CONFIG_DIRECTORY="${1:-bot-configs}"
Expand All @@ -28,7 +28,7 @@ mkdir "${BOT_CONFIG_DIRECTORY}"

## generate the required config
# use the content from configmap in the data section
sed -e '1,/config: |/d' configs/kubernetes-configmap.yaml > "${BOT_CONFIG_DIRECTORY}"/config
sed -e '1,/config: |/d' configs/kcp-dev-configmap.yaml > "${BOT_CONFIG_DIRECTORY}"/config
# The additional .tmp extension is used after -i to make it portable across *BSD and GNU.
# Ref: https://unix.stackexchange.com/a/92907
# Also \t is not recognized in non GNU sed implementation. Therefore a tab is used as is.
Expand All @@ -41,12 +41,12 @@ sed -i.tmp -e 's/dry-run: false/dry-run: true/g' "${BOT_CONFIG_DIRECTORY}"/confi

## generate the required rules
# get the rules file from the k/k repo
wget https://raw.githubusercontent.com/kubernetes/kubernetes/master/staging/publishing/rules.yaml -O "${BOT_CONFIG_DIRECTORY}"/rules
wget https://raw.githubusercontent.com/kcp-dev/kcp/main/staging/publishing/rules.yaml -O "${BOT_CONFIG_DIRECTORY}"/rules
# change permission so that yq container can make changes to the rules file
chmod 666 "${BOT_CONFIG_DIRECTORY}"/rules
# only work on master branch
# yq is used to remove non master branch related rules
# only work on main branch
# yq is used to remove non main branch related rules
docker run \
--rm \
-v "${PWD}/${BOT_CONFIG_DIRECTORY}":/workdir \
mikefarah/yq:4.32.2 -i 'del( .rules.[].branches.[] | select (.name != "master"))' rules
mikefarah/yq:4.32.2 -i 'del( .rules.[].branches.[] | select (.name != "main"))' rules
6 changes: 3 additions & 3 deletions test/run-bot-local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ set -o xtrace

# This script expects a config and rules file in the BOT_CONFIG_DIRECTORY which will be used for running
# the publishing bot
# The image gcr.io/k8s-staging-publishing-bot/k8s-publishing-bot:latest should be available locally
# The image ghcr.io/kcp-dev/publishing-bot:latest should be available locally
# in the docker daemon

BOT_CONFIG_DIRECTORY="${1:-bot-configs}"
Expand All @@ -34,7 +34,7 @@ docker run --rm \
-v local-go-workspace:/go-workspace \
-v cache:/.cache \
-v "${PWD}/${BOT_CONFIG_DIRECTORY}":/etc/bot-configs \
gcr.io/k8s-staging-publishing-bot/k8s-publishing-bot:latest \
ghcr.io/kcp-dev/publishing-bot:latest \
/init-repo \
--alsologtostderr \
--config=/etc/bot-configs/config \
Expand All @@ -45,7 +45,7 @@ docker run --rm \
-v local-go-workspace:/go-workspace \
-v cache:/.cache \
-v "${PWD}/${BOT_CONFIG_DIRECTORY}":/etc/bot-configs \
gcr.io/k8s-staging-publishing-bot/k8s-publishing-bot:latest \
ghcr.io/kcp-dev/publishing-bot:latest \
/publishing-bot \
--alsologtostderr \
--config=/etc/bot-configs/config \
Expand Down