Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync upstream 2025-01-20 #306

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
9cd5367
Change OWNERS file
nirarg Dec 16, 2021
f390ca9
Change OWNERS file
nirarg Dec 16, 2021
d967dc4
Merge pull request #3 from nunnatsa/sync-with-upstream-2021.12.20
nunnatsa Dec 21, 2021
b093f7f
Change OWNERS file
nirarg Dec 16, 2021
3e08364
Merge pull request #4 from nunnatsa/sync-with-upstream-2021.12.21
nunnatsa Dec 21, 2021
09bac6c
Change OWNERS file
nirarg Dec 16, 2021
10e4986
Merge pull request #5 from nunnatsa/sync-with-upstream-2021.12.22
nunnatsa Dec 22, 2021
ece741d
Change OWNERS file
nirarg Dec 16, 2021
ef64d5f
Merge pull request #7 from nunnatsa/sync-with-upstream-2021.12.23
openshift-merge-robot Dec 23, 2021
0087a9e
Change OWNERS file
nirarg Dec 16, 2021
5475005
Merge pull request #10 from nunnatsa/sync
openshift-merge-robot Jan 30, 2022
b902ca0
Change OWNERS file
nirarg Dec 16, 2021
5f96cf3
Merge pull request #12 from nunnatsa/sync-upstream-2022-2-3
openshift-merge-robot Feb 3, 2022
769d670
Change OWNERS file
nirarg Dec 16, 2021
d15f210
Merge pull request #15 from nunnatsa/os-main
openshift-merge-robot Feb 28, 2022
51e1a65
Automatic sync with upstream
nunnatsa Feb 27, 2022
dbdc825
Merge pull request #14 from nunnatsa/auto-sync-upstream
openshift-merge-robot Mar 1, 2022
d0ddb83
add script to sync with upstream
nunnatsa Mar 2, 2022
f160e5f
create PR
nunnatsa Mar 3, 2022
6820c0a
Merge pull request #16 from nunnatsa/sync-script
openshift-merge-robot Mar 7, 2022
4f88c71
Change OWNERS file
nirarg Dec 16, 2021
7372603
Automatic sync with upstream
nunnatsa Feb 27, 2022
23f8969
add script to sync with upstream
nunnatsa Mar 2, 2022
15507d5
create PR
nunnatsa Mar 3, 2022
ab8dc6f
Merge pull request #22 from nunnatsa/auto_sync_upstream_2022-03-09
openshift-merge-robot Mar 9, 2022
9efb50f
Change OWNERS file
nirarg Dec 16, 2021
e77c820
Automatic sync with upstream
nunnatsa Feb 27, 2022
db36d7d
add script to sync with upstream
nunnatsa Mar 2, 2022
e9096d9
create PR
nunnatsa Mar 3, 2022
0eaaac7
Merge pull request #23 from nunnatsa/auto_sync_upstream_2022-03-09
openshift-merge-robot Mar 9, 2022
23727f2
Change OWNERS file
nirarg Dec 16, 2021
86301ce
Automatic sync with upstream
nunnatsa Feb 27, 2022
0fc1461
add script to sync with upstream
nunnatsa Mar 2, 2022
aecd954
create PR
nunnatsa Mar 3, 2022
f148a9e
Merge pull request #28 from nunnatsa/auto_sync_upstream_2022-03-17
openshift-merge-robot Mar 17, 2022
004c1a5
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
davidvossel Apr 20, 2022
8bd4fe1
Update the sync script to use merge instead of rebase
davidvossel Apr 20, 2022
a278f8d
Merge pull request #32 from davidvossel/auto_sync_upstream_2022-04-20…
openshift-merge-robot May 1, 2022
8554732
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
nunnatsa Jan 8, 2023
9c053af
Merge pull request #40 from nunnatsa/auto_sync_upstream_2023-01-08-20-06
openshift-merge-robot Jan 10, 2023
3632a96
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
davidvossel Jan 23, 2023
4786167
Merge pull request #44 from davidvossel/auto_sync_upstream_2023-01-23…
openshift-merge-robot Jan 26, 2023
14a3a24
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
nunnatsa Mar 29, 2023
9cf502c
Merge pull request #45 from nunnatsa/auto_sync_upstream_2023-03-29-12-55
openshift-merge-robot May 6, 2023
23b9d01
Merge branch 'main' into 2023-06-27-09-21
nunnatsa Jun 27, 2023
6211845
Merge pull request #46 from nunnatsa/auto_sync_upstream_2023-06-27-09-21
openshift-merge-robot Jun 27, 2023
dd6bf14
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
davidvossel Sep 15, 2023
efe05e3
Merge pull request #47 from davidvossel/auto_sync_upstream_2023-09-15…
openshift-merge-robot Sep 16, 2023
09626e5
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
nunnatsa Oct 22, 2023
a5c21d0
Merge pull request #49 from nunnatsa/auto_sync_upstream_2023-10-22-06-29
openshift-ci[bot] Oct 24, 2023
885d8b8
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
nunnatsa Nov 14, 2023
31fd29a
Merge pull request #50 from nunnatsa/auto_sync_upstream_2023-11-14-09-31
openshift-merge-bot[bot] Nov 14, 2023
811d589
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
nunnatsa Dec 24, 2023
b24379c
Update the OWNERS file
nunnatsa Dec 24, 2023
fd9b11b
Merge pull request #51 from nunnatsa/auto_sync_upstream_2023-12-24-07-25
openshift-merge-bot[bot] Dec 25, 2023
5b2a2c5
Merge remote-tracking branch 'auto-sync-script-upstream/main' into au…
nunnatsa Jan 8, 2024
f7eac3c
Merge pull request #52 from nunnatsa/auto_sync_upstream_2024-01-08-09-36
openshift-merge-bot[bot] Jan 13, 2024
6fb0b62
Merge branch 'main' into sync_upstream_2024-04-17
nunnatsa Apr 17, 2024
0d5c8e7
Merge pull request #54 from nunnatsa/sync_upstream_2024-04-17
openshift-merge-bot[bot] Apr 17, 2024
74f6961
Add Dockerfile.rhtap for konflux builds
davidvossel Jun 13, 2024
71d2ca4
Merge pull request #60 from davidvossel/dockerfile.rhtap
openshift-merge-bot[bot] Jun 14, 2024
2d41c4f
sync upstream 2024-06-20
nunnatsa Jun 20, 2024
b987a82
Merge pull request #65 from nunnatsa/sync_upstream_2024-06-20
openshift-merge-bot[bot] Jun 25, 2024
ed61eb2
Merge branch 'main' into sync_upstream_2024-07-21
nunnatsa Jul 21, 2024
95af225
Merge pull request #79 from nunnatsa/sync_upstream_2024-07-21
openshift-merge-bot[bot] Jul 21, 2024
d12dec6
Merge branch 'main' into sync_upstream_2025-01-13
nunnatsa Jan 13, 2025
93f92fe
Merge pull request #100 from nunnatsa/sync_upstream_2025-01-13
openshift-merge-bot[bot] Jan 15, 2025
8a4b9ce
Merge branch 'main' into sync_upstream_2025-01-20
nunnatsa Jan 20, 2025
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
26 changes: 26 additions & 0 deletions Dockerfile.rhtap
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
FROM brew.registry.redhat.io/rh-osbs/openshift-golang-builder:rhel_9_1.22 as builder

# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
ARG goproxy=https://proxy.golang.org
ENV GOPROXY=$goproxy
ENV GOFLAGS="-mod=readonly"

WORKDIR /workspace

# Copy the sources
COPY ./ ./
RUN go mod download

# Build
ARG package=.
ARG ARCH
ARG LDFLAGS
RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -ldflags "${LDFLAGS} -extldflags '-static'" -o manager ${package}

# Copy the controller-manager into a thin image
FROM registry.redhat.io/rhel9-4-els/rhel:9.4
WORKDIR /
COPY --from=builder /workspace/manager .
# Use uid of nonroot user (65532) because kubernetes expects numeric user when applying pod security policies
USER 65532
ENTRYPOINT ["/manager"]
19 changes: 10 additions & 9 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# See the OWNERS docs at https://go.k8s.io/owners
# See the OWNERS docs: https://git.k8s.io/community/contributors/guide/owners.md

approvers:
- agradouski
- cchengleo
- rmohr
- davidvossel
- nirarg
- nunnatsa
- sig-cluster-lifecycle-leads
- davidvossel
- nunnatsa
- nirarg
- orenc1
options: {}
reviewers:
- qinqon
- davidvossel
- nunnatsa
- nirarg
- orenc1

100 changes: 100 additions & 0 deletions hack/sync-upstream.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
#!/bin/bash -ex

set -e


# This script should be executed from within your fork of capk
#
# The script will...
# 1. automatically create remote branches for upstream and the openshift capk fork
# 2. create a new branch using the latest openshift capk fork's main
# 3. Merge upstream/main into the new branch, which layers in any upstream changes.
# 4. automatically resolve conflicts for expected file changes
# 5. validate upstream and downstream diff only contains expected file changes
# 6. push the new branch and automatically create a PR.
#
# The script assumes the the gh cli is installed and authorized (download from here: https://cli.github.com/).
# The gh cli is required in order to auto create the PR

UPSTREAM_REMOTE="auto-sync-script-upstream"
OPENSHIFT_REMOTE="auto-sync-script-openshift-fork"

UPSTREAM_BRANCH="${UPSTREAM_REMOTE}/main"
OPENSHIFT_BRANCH="${OPENSHIFT_REMOTE}/main"

TODAY=$(date -u +%Y-%m-%d-%H-%M)
NEW_BRANCH_NAME="auto_sync_upstream_${TODAY}"

function verify_merge() {
echo "Verifying merge only has expected differences with upstream branch"

git checkout $NEW_BRANCH_NAME

DS_FILES=(OWNERS hack/sync-upstream.sh)
diff=$(git diff upstream/main --stat | awk '{ print $1 }')

for file in ${diff[@]}; do
# This if statment skips the final row of the diff --stat
# that is just printing out the number of files that changed
if [ "${#DS_FILES[@]}" = "$file" ]; then
continue
fi

verified="false"
for ds_file in ${DS_FILES[@]}; do
if [ "$ds_file" = "$file" ]; then
verified="true"
fi
done
if [ "$verified" = "false" ]; then
echo "Unexpected diff, file $file should not be different from upstream"
exit 1
fi

echo "verified diff file $file is allowed"
done
}

DS_FILES=(OWNERS hack/sync-upstream.sh)

set +e
git remote add $UPSTREAM_REMOTE https://github.com/kubernetes-sigs/cluster-api-provider-kubevirt.git
git remote add $OPENSHIFT_REMOTE [email protected]:openshift/cluster-api-provider-kubevirt.git
set -e

git fetch $UPSTREAM_REMOTE
git fetch $OPENSHIFT_REMOTE

git checkout $OPENSHIFT_BRANCH
git checkout -b $NEW_BRANCH_NAME

# backup the downstream files
for ds_file in ${DS_FILES[@]}; do
cp ${ds_file} "${ds_file}.untracked"
done

set +e
git merge $UPSTREAM_BRANCH
set -e

# restore the downstream files, if they are conflicting
for ds_file in ${DS_FILES[@]}; do
mv "${ds_file}.untracked" ${ds_file}
git add ${ds_file}
done

git -c core.editor=true merge --continue

verify_merge

git push origin $NEW_BRANCH_NAME

# the gh CLI does not support choosing the remote repository from command line. Setting the default one
sed -i "/gh-resolved = base/d" .git/config
sed -i "/^\[remote \"${OPENSHIFT_REMOTE}\"\]/a \ gh-resolved = base" .git/config

gh pr create -B main -t "auto sync ${TODAY}" -b "auto sync upstream ${TODAY}" -R openshift/cluster-api-provider-kubevirt

# remove the default target repository, so gh cli will ask next time
sed -i "/gh-resolved = base/d" .git/config

Loading