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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

release: Fully migrate from hub to gh #8308

Merged
merged 6 commits into from Nov 2, 2023

Conversation

gkurz
Copy link
Member

@gkurz gkurz commented Oct 24, 2023

The hub tool is deprecated. Convert the release scripts to use the official GitHub CLI gh instead.

Fixes #8303

EDIT: this also fixes this old issue

Fixes #3083

Same digits being used in both issue numbers is pure coincidence 馃槃

Signed-off-by: Greg Kurz groug@kaod.org

@katacontainersbot katacontainersbot added the size/small Small and simple task label Oct 24, 2023
@gkurz gkurz changed the title tools: Fully convert from hub to gh tools: Fully migrate from hub to gh Oct 24, 2023
@gkurz gkurz force-pushed the fully-drop-hub branch 2 times, most recently from 0dc9ffb to 9c5aefd Compare October 27, 2023 17:22
@katacontainersbot katacontainersbot added size/medium Average sized task and removed size/small Small and simple task labels Oct 27, 2023
@gkurz
Copy link
Member Author

gkurz commented Oct 27, 2023

I finally decided to test these changes against a fork of the Kata repo in my own GH org (hence the first patch).

https://github.com/groug-org/kata-containers

I could successfully check that everything works as expected when releasing dummy versions in this repo :

  • 3.3.0-alpha1 on main

groug-org#3
https://github.com/groug-org/kata-containers/releases/tag/3.3.0-alpha1

  • 3.3.0-rc0 on main

groug-org#13
groug-org#17
https://github.com/groug-org/kata-containers/releases/tag/3.3.0-rc0

  • 3.3.0-rc1 on stable-3.3

groug-org#18
https://github.com/groug-org/kata-containers/releases/tag/3.3.0-rc1

  • 3.3.0 on stable-3.3

groug-org#19
https://github.com/groug-org/kata-containers/releases/tag/3.3.0

@gkurz gkurz marked this pull request as ready for review October 27, 2023 17:38
@gkurz gkurz requested a review from fidencio October 27, 2023 17:38
@gkurz gkurz changed the title tools: Fully migrate from hub to gh release: Fully migrate from hub to gh Oct 31, 2023
@gkurz gkurz requested a review from a team as a code owner October 31, 2023 08:49
We don't want to mess with the official repo when testing a change
in the release scripts. Adapt `update-repository-version.sh` to
be able to use an alternate repo just like `tag_repos.sh` already
does.

This means that the following command :

$ OWNER="$SOME_ORG" ./update-repository-version.sh -p "$NEW_VERSION" "$BRANCH"

will only create a PR in this repo :

http://github.com/$SOME_ORG/kata-containers.git

Signed-off-by: Greg Kurz <groug@kaod.org>
Comment on lines 84 to 103
build_gh() {
info "Get gh"

if cmd=$(command -v gh); then
gh_cli="${cmd}"
return
else
gh_cli="${tmp_dir:-/tmp}/gh-cli"
fi

# FIXME: Install required go version ?
local gh_repo="github.com/cli/cli"
local gh_repo_dir="${GOPATH}/src/${gh_repo}"
[ -d "${gh_repo_dir}" ] || git clone --quiet --depth 1 "https://${gh_repo}.git" "${gh_repo_dir}"
pushd "${gh_repo_dir}" >>/dev/null
git checkout trunk
git pull
make bin/gh && mv bin/gh "${gh_cli}"
popd >>/dev/null
}
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need this?

gh provides binaries as part of its release, and those are already installed by default in the runners.

Copy link
Member Author

Choose a reason for hiding this comment

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

This script is supposed to only be run locally by the person doing the release, not by runners, right ? Or am I missing something ?

Copy link
Member

Choose a reason for hiding this comment

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

For now, yes. only running locally.
I have plans to expand this to be done automagically, hopefully.

Anyways, downloading the binary would be the way to go, and in the other comment you said you'd be addressing this, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Switched to downloading the binary.

@@ -150,9 +149,13 @@ tag_repos() {

push_tags() {
info "Pushing tags to repos"
build_hub
build_gh
Copy link
Member

Choose a reason for hiding this comment

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

Isn't easier to just download gh from https://github.com/cli/cli/releases/tag/v2.37.0?

Copy link
Member Author

Choose a reason for hiding this comment

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

This could avoid the problem of requiring a too recent golang to do the build indeed. I'll have a look.

If gh isn't installed already, download it from GitHub.

Signed-off-by: Greg Kurz <groug@kaod.org>
The hub tool is deprecated. Convert this script to use the
official GitHub CLI gh instead of hub.

A couple of adjustments had to be made :
- the notes.md temporary file is moved to ${tmp_dir} in order to silent gh,
  otherwise it complains about an untracked file,
- title of a PR no longer goes to the notes.md file since gh requires the
  title to be passed with a dedicated --title option.

Fixes kata-containers#8303

Signed-off-by: Greg Kurz <groug@kaod.org>
The hub tool is deprecated. Convert this script to use the
official GitHub CLI gh instead of hub.

A typical gh setup is able to access repos using HTTPS along with
GitHub credentials. It is only needed to patch the remote url when
using SSH.

Signed-off-by: Greg Kurz <groug@kaod.org>
Not used anymore.

Signed-off-by: Greg Kurz <groug@kaod.org>
This comment belongs to the hub tool that got sunset by 710eb8a.
Just drop it.

Signed-off-by: Greg Kurz <groug@kaod.org>
@fidencio
Copy link
Member

/test

1 similar comment
@gkurz
Copy link
Member Author

gkurz commented Oct 31, 2023

/test

Copy link
Member

@fidencio fidencio left a comment

Choose a reason for hiding this comment

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

lgtm, thanks @gkurz!

@amshinde amshinde merged commit 0046461 into kata-containers:main Nov 2, 2023
137 of 142 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok-to-test size/medium Average sized task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tools: hub CLI still being used packaging: Move away from hub and use gh instead
4 participants