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

task CSI-2892/add community checks to operator #157

Draft
wants to merge 55 commits into
base: develop
Choose a base branch
from

Conversation

matancarmeli7
Copy link
Contributor

No description provided.

build/ci/op-test.sh Outdated Show resolved Hide resolved
build/ci/update_csv.sh Outdated Show resolved Hide resolved
Copy link
Contributor

@oriyarde oriyarde left a comment

Choose a reason for hiding this comment

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

don't forget to add the ticket number in the PR title

@matancarmeli7 matancarmeli7 changed the title add community checks to operator task CSI-2892/add community checks to operator May 16, 2021
categories.json Outdated Show resolved Hide resolved
Copy link
Contributor

@zingero zingero left a comment

Choose a reason for hiding this comment

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

almost :)

categories.json Outdated Show resolved Hide resolved
build/ci/clean_demo_pr.sh Outdated Show resolved Hide resolved
build/ci/create_demo_pr.sh Outdated Show resolved Hide resolved
build/ci/create_demo_pr.sh Outdated Show resolved Hide resolved
build/ci/create_demo_pr.sh Outdated Show resolved Hide resolved
build/ci/prepare_env.sh Outdated Show resolved Hide resolved
gh pr checks $community_operators_branch --repo $forked_community_operators_repository
}

wait_fot_checks_to_start(){
Copy link
Contributor

Choose a reason for hiding this comment

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

why is there no for in the filename?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

the filename wasn't changed


wait_fot_checks_to_start(){
community_operators_branch=$1
forked_community_operators_repository=$2
Copy link
Contributor

@oriyarde oriyarde Aug 1, 2021

Choose a reason for hiding this comment

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

is this necessary for gh_pr_checks_command?
if so, how come community_operators_branch is passed but not this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed it,
forked_community_operators_repository is an environment variable that I set in the CI

Copy link
Contributor

Choose a reason for hiding this comment

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

if both are passed, then I think their name inside the gh_pr_checks_command function should be more general, e.g. branch and repository

Comment on lines 17 to 24
echo $github_token > github_token.txt
gh auth login --with-token < github_token.txt
gh repo fork operator-framework/community-operators --clone community-operators-fork
cd community-operators-fork
git remote set-url origin https://csiblock:[email protected]/csiblock/community-operators.git
git fetch upstream
git rebase upstream/master
git push origin master --force
Copy link
Contributor

@oriyarde oriyarde Aug 1, 2021

Choose a reason for hiding this comment

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

could this also be a function? with a name about whatever it does? something like fork_and_clone?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Contributor

Choose a reason for hiding this comment

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

update seems pretty general to me.
would something like sync_fork(_master_branch)?_from_upstream be more accurate?

@@ -1,21 +1,21 @@
#!/bin/bash -xe
set +o pipefail

export passed_k8s_checks=true
export passed_openshift_checks=true
# CSI-3172 - run rad hat bot checks
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# CSI-3172 - run rad hat bot checks
# CSI-3172 - run Red Hat bot checks

Copy link
Contributor

Choose a reason for hiding this comment

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

rad hat would have been a much cooler name for them

@@ -1,33 +1,32 @@
#!/bin/bash -xe
set +o pipefail

gh_pr_checks_command (){
Copy link
Contributor

Choose a reason for hiding this comment

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

if we run the command, I suggest naming the function accordingly:

Suggested change
gh_pr_checks_command (){
run_gh_pr_checks_command (){

Copy link
Contributor

Choose a reason for hiding this comment

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

isn't gh_pr_checks enough?

Copy link
Contributor

Choose a reason for hiding this comment

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

From this article:

In general, use nouns for classes, verbs for functions, and names that show purpose for variables, attributes and arguments. Avoid (Systems) Hungarian notation in dynamically typed languages since data types can change. Use lower Camel Case for variables and methods. Use Pascal Case for classes and their constructors. Use Screaming Case for constants.

Thus, I suggest using a verb.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with the article, though I think in this case, the function is being used more like a command alias than a function.
I think this distinction is important, otherwise we might wrap all the commands we use with a long, low-level-detail named functions of the form run_X_command.
if you still disagree, at least consider the shorter get_pr_checks

Copy link
Contributor

Choose a reason for hiding this comment

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

get_pr_checks sounds great.
If you want to continue with the discussion about naming, I suggest having a session with Arbel.

Copy link
Contributor

Choose a reason for hiding this comment

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

@matancarmeli7 let's use get_pr_checks here

Comment on lines +16 to +17
}
wait_for_checks_to_complete(){
Copy link
Contributor

@oriyarde oriyarde Aug 14, 2021

Choose a reason for hiding this comment

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

do we want to have a single line break between functions? what is the convention here?
please try to use an IDE that helps with such conventions

Comment on lines +21 to +22
repo_pr=`gh pr list --repo $forked_repository | grep $community_operators_branch`
if [[ "$repo_pr" == *"$community_operators_branch"* ]]; then
Copy link
Contributor

@oriyarde oriyarde Aug 14, 2021

Choose a reason for hiding this comment

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

could you give an example for an output of the gh pr list command that would result in the if condition being false?

Copy link
Contributor

Choose a reason for hiding this comment

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

and what does it mean if there is no pr with the required branch? shouldn't it fail?

Copy link
Contributor

Choose a reason for hiding this comment

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

in addition, I see this code in at least 3 different places in this PR.
please move it to a common location

#!/bin/bash -xel
set +o pipefail

edit_operator_image_in_csv_yaml_file (){
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO no need for _file, since it's implied by the yaml

#!/bin/bash -xe
set +o pipefail

echo $'yq() {\n docker run --rm -e operator_image_for_test=$operator_image_for_test -i -v "${PWD}":/workdir mikefarah/yq:4 "$@"\n}' >> /home/runner/.bash_profile
Copy link
Contributor

Choose a reason for hiding this comment

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

please apply conversations from other PRs where applicable

env:
original_community_operators_repository: "k8s-operatorhub/community-operators"
original_community_operators_repository_prod: "redhat-openshift-ecosystem/community-operators-prod"
forked_community_operators_repository: "csiblock/community-operators"
Copy link
Contributor

Choose a reason for hiding this comment

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

please change the forked terminology to fork wherever applicable


if [ $passed_k8s_checks == "false" ] || [ $passed_openshift_checks == "false" ]
then
echo "some test failed :("
Copy link
Contributor

Choose a reason for hiding this comment

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

it's not clear which test failed (nor if more than 1 failed)

image_version=`cat version/version.go | grep -i driverversion | awk -F = '{print $2}'`
image_version=`echo ${image_version//\"}`

echo "::set-output name=image_branch_tag::${image_version}"
Copy link
Contributor

Choose a reason for hiding this comment

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

Uploading image.png…

Copy link
Contributor

@oriyarde oriyarde left a comment

Choose a reason for hiding this comment

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

if this PR is not in plan to be merged in the near future, please change it to "draft"

@oriyarde oriyarde marked this pull request as draft February 7, 2022 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants