cluster-api-provider-azure icon indicating copy to clipboard operation
cluster-api-provider-azure copied to clipboard

Simplify and reuse variables in hack/*.sh scripts

Open lakshkeswani opened this issue 2 years ago • 20 comments

What type of PR is this? This is a kind of Code clean PR, In this PR I have simplified and reused the variable before that were declared multiple times hack/*.sh scripts moving some of variables into common-vars.sh . This PR Fixes issue #2499

TODOs:

  • [ ] Squash commits

lakshkeswani avatar Jul 30 '22 22:07 lakshkeswani

@lakshkeswani: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jul 30 '22 22:07 k8s-ci-robot

Welcome @lakshkeswani!

It looks like this is your first PR to kubernetes-sigs/cluster-api-provider-azure 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api-provider-azure has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. :smiley:

k8s-ci-robot avatar Jul 30 '22 22:07 k8s-ci-robot

Hi @lakshkeswani. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jul 30 '22 22:07 k8s-ci-robot

Thanks for the PR @lakshkeswani !

  • There some more variables in the hack/tools/*.sh scripts, root YQ, envsubst, REPO_ROOT, etc which could be pulled into the common_vars.sh.

~I did not mention the following in the original issue but now that I think of it, would we want to install the binaries too through common_vars.sh? If yes, then common_vars.sh would also run make --directory=<go_to_repo_root> <binary_names> for all the binary variables.~

nawazkh avatar Aug 02 '22 09:08 nawazkh

I updated the comment above @lakshkeswani

nawazkh avatar Aug 07 '22 18:08 nawazkh

/ok-to-test

mboersma avatar Aug 10 '22 19:08 mboersma

Looks like common-vars.sh needs to add the standard copyright header:

#!/bin/bash
# Copyright 2022 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

mboersma avatar Aug 10 '22 19:08 mboersma

@nawazkh should we use one variable for root,KUBE_ROOT, ROOT? because all are referring to the same thing

lakshkeswani avatar Aug 14 '22 11:08 lakshkeswani

@nawazkh should we use one variable for root, KUBE_ROOT, ROOT ?

That seems like it's worth simplifying. Maybe use REPO_ROOT or just ROOT? Thanks for noticing that!

(And thanks for your patience on this PR, it's really appreciated. @nawazkh is out for a couple weeks, btw.)

mboersma avatar Aug 22 '22 18:08 mboersma

/reopen

lakshkeswani avatar Sep 12 '22 12:09 lakshkeswani

@lakshkeswani: Reopened this PR.

In response to this:

/reopen

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Sep 12 '22 12:09 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign justinsb for approval by writing /assign @justinsb in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Sep 12 '22 12:09 k8s-ci-robot

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Once this PR has been reviewed and has the lgtm label, please assign justinsb for approval by writing /assign @justinsb in a comment. For more information see:The Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Sep 12 '22 12:09 k8s-ci-robot

@nawazkh above you stated the envsubt and YQ should be moved into common-vars but these are only used once

lakshkeswani avatar Sep 12 '22 12:09 lakshkeswani

@nawazkh above you stated the envsubt and YQ should be moved into common-vars but these are only used once

You are right that they are used just once. But for consistency and any future scope of reusing envsubst and yq we would want to get envsubst and YQ into common_vars.sh.

nawazkh avatar Sep 14 '22 13:09 nawazkh

It be nice to have the PR description as per the template. k8s-ci-robot tracks the contents of the description (as per the PR template) to update the labels on the PR.

nawazkh avatar Sep 14 '22 16:09 nawazkh

/retest-required

lakshkeswani avatar Sep 18 '22 21:09 lakshkeswani

/test pull-cluster-api-provider-azure-coverage

lakshkeswani avatar Sep 18 '22 21:09 lakshkeswani

/retest

nawazkh avatar Sep 27 '22 18:09 nawazkh

~~@nawazkh one test make verify-shellcheck which is failing is the errors in test logs we have some variables which are in common-vars file that are unused according to error message. I guess this test is checking the variables usability in common-vars so as a reviewer please look at failed test logs we can ignore this too and other solution I tried to use the directive to skip the shell check but coverage test failed. Have look at test logs let me know what we can do.~~

lakshkeswani avatar Oct 02 '22 13:10 lakshkeswani

@nawazkh Now all the tests have are passed so should I move to squashing comments?

lakshkeswani avatar Oct 16 '22 12:10 lakshkeswani

/test pull-cluster-api-provider-azure-e2e

lakshkeswani avatar Nov 04 '22 15:11 lakshkeswani

You'd also want to fix your Release Note section for the do-not-merge/release-note-label-needed label to go away.

nawazkh avatar Nov 08 '22 01:11 nawazkh

/lifecycle active

CecileRobertMichon avatar Nov 08 '22 22:11 CecileRobertMichon

Done added release-notes in PR description.

lakshkeswani avatar Nov 16 '22 11:11 lakshkeswani

Thanks! /lgtm

nawazkh avatar Nov 17 '22 02:11 nawazkh

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CecileRobertMichon

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:
  • ~~OWNERS~~ [CecileRobertMichon]

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

k8s-ci-robot avatar Nov 18 '22 00:11 k8s-ci-robot

/retest

likely a flake

CecileRobertMichon avatar Nov 18 '22 01:11 CecileRobertMichon