-
Notifications
You must be signed in to change notification settings - Fork 505
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
Verify non dirty or mismatched k/release checkouts #1284
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
Hmmmm... $ krel gcbmgr --stage
INFO Verifying repository state
INFO Repository is in clean state
FATA verifying repository state: branch "master" expected but got "verify-check"
$ TOOL_ORG=saschagrunert TOOL_BRANCH=verify-check krel gcbmgr --stage
INFO Verifying repository state
INFO Repository is in clean state
INFO Found matching branch "verify-check"
INFO Found matching organization "saschagrunert" and repository "release" in remote: sascha (https://github.com/saschagrunert/release.git)
INFO Verifying remote HEAD commit
INFO Got remote commit: c111a6cb7ce15c9573dfcd8ac038bc70d23e1acf
INFO Verifying that remote commit is equal to the local one
FATA verifying repository state: Local HEAD (5b7c84a83c10e8827b58bbf783ef884d7aed36a3) is not equal to latest remote commit (c111a6cb7ce15c9573dfcd8ac038bc70d23e1acf)
|
We now verify that the worktree is neither dirty nor diverged from the latest remote commit. This introduces a new API function `git.IsDirty()` as well as updates all surrounding tests. Signed-off-by: Sascha Grunert <sgrunert@suse.com>
That's a good catch, if the branch is not master, then we have to run
and not always |
@@ -131,7 +143,7 @@ func (r *Repo) CheckState(expOrg, expRepo, expBranch string) error { | |||
|
|||
logrus.Info("Verifying remote HEAD commit") | |||
lsRemoteOut, err := r.repo.LsRemote( | |||
"--heads", foundRemote.Name(), "refs/heads/master", | |||
"--heads", foundRemote.Name(), "refs/heads/"+expBranch, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the issue.
Looks better! Wrong branch: $ krel gcbmgr --stage
INFO Verifying repository state
INFO Repository is in clean state
FATA verifying repository state: branch "master" expected but got "verify-check" Correct branch / org: $ TOOL_ORG=saschagrunert TOOL_BRANCH=verify-check krel gcbmgr --stage
INFO Verifying repository state
INFO Repository is in clean state
INFO Found matching branch "verify-check"
INFO Found matching organization "saschagrunert" and repository "release" in remote: sascha (https://github.com/saschagrunert/release.git)
INFO Verifying remote HEAD commit
INFO Got remote commit: 595dfec1803e960adf29430123bf94dbf3d673cf
INFO Verifying that remote commit is equal to the local one
INFO Repository is up-to-date
INFO Running gcbmgr with the following options: &{Stage:true Release:false Stream:false Branch:master ReleaseType:prerelease BuildVersion: GcpUser: LastJobs:5 Repo:0xc000405920 Version:0xc000405930}
INFO Build options: { cloudbuild.yaml kubernetes-release-test false false false }
INFO Retrieving Kubernetes release version for ci/latest on branch master
INFO Retrieving Kubernetes build version from https://dl.k8s.io/ci/latest.txt...
INFO Retrieved Kubernetes version: v1.19.0-alpha.3.208+3b024339bd67b8
INFO Trying to get the kube-cross version for master...
INFO Found the following kube-cross version: v1.13.9-5
INFO Listing GCB substitutions prior to build submission...
INFO RC:
INFO RELEASE_BRANCH: master
INFO BUILD_AT_HEAD:
INFO TOOL_REPO: release
INFO NOMOCK:
INFO RC_TAG:
INFO OFFICIAL:
INFO BUILDVERSION: --buildversion=v1.19.0-alpha.3.208+3b024339bd67b8
INFO KUBE_CROSS_VERSION: v1.13.9-5
INFO NOMOCK_TAG:
INFO TOOL_ORG: saschagrunert
INFO GCP_USER_TAG: stephen-k8s-at-agst-us
INFO OFFICIAL_TAG:
INFO BUILD_POINT: v1.19.0-alpha.3.208-3b024339bd67b8
INFO TOOL_BRANCH: verify-check
INFO Build directory: /home/augustus/go/src/k8s.io/release/gcb/stage
INFO Config directory: /home/augustus/go/src/k8s.io/release/gcb/stage
INFO cd-ing to build directory: /home/augustus/go/src/k8s.io/release/gcb/stage
ID CREATE_TIME DURATION SOURCE IMAGES STATUS
6ec7fe0d-e0f7-41e6-b204-e938731bc3be 2020-05-13T14:47:49+00:00 - - - QUEUED
INFO: Refreshing access_token
Created [https://cloudbuild.googleapis.com/v1/projects/kubernetes-release-test/builds/6ec7fe0d-e0f7-41e6-b204-e938731bc3be].
Logs are available at [https://console.cloud.google.com/cloud-build/builds/6ec7fe0d-e0f7-41e6-b204-e938731bc3be?project=648026197307].
INFO: Display format: "
table(
id,
createTime.date('%Y-%m-%dT%H:%M:%S%Oz', undefined='-'),
duration(start=startTime,end=finishTime,precision=0,calendar=false,undefined=" -").slice(2:).join(""):label=DURATION,
build_source(undefined="-"):label=SOURCE,
build_images(undefined="-"):label=IMAGES,
status
)
" Local ahead of remote tip: $ TOOL_ORG=saschagrunert TOOL_BRANCH=verify-check krel gcbmgr --stage
INFO Verifying repository state
INFO Repository is in clean state
INFO Found matching branch "verify-check"
INFO Found matching organization "saschagrunert" and repository "release" in remote: sascha (https://github.com/saschagrunert/release.git)
INFO Verifying remote HEAD commit
INFO Got remote commit: 595dfec1803e960adf29430123bf94dbf3d673cf
INFO Verifying that remote commit is equal to the local one
FATA verifying repository state: Local HEAD (bab3c4933ef5be249bd00efe05bb6f3ef7107500) is not equal to latest remote commit (595dfec1803e960adf29430123bf94dbf3d673cf) /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpanato, justaugustus, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind feature
What this PR does / why we need it:
We now verify that the worktree is neither dirty nor diverged from the
latest remote commit. This introduces a new API function
git.IsDirty()
as well as updates all surrounding tests.Which issue(s) this PR fixes:
Fixes #1278
Special notes for your reviewer:
Requires #1283
/hold
Does this PR introduce a user-facing change?