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

Feat/shellcheck #1517

Closed
wants to merge 2 commits into from
Closed

Feat/shellcheck #1517

wants to merge 2 commits into from

Conversation

CASABECI
Copy link

@CASABECI CASABECI commented Jun 9, 2022

Thanks for resource available

Copy link
Contributor

@Fleshgrinder Fleshgrinder left a comment

Choose a reason for hiding this comment

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

I am working on rewriting the scripts to be proper Bash, and pass all shellcheck tests. Hence, I would prefer it if this PR is not merged. For instance, the logger.sh script already does not exist anymore and was replaced by logger.bash in #1246. Similarly, the startup.sh script saw a total rewrite in #1454 (which was reverted in #1561 but actually already has a proper fix in #1560 so that it can be merged again).

- name: Setup Docker Environment
- name: Lint shell
run: |
make -C runner lint-scripts
Copy link
Collaborator

@mumoshu mumoshu Sep 25, 2022

Choose a reason for hiding this comment

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

Hey @CASABECI! Thanks for a lot for your contribution.
I finally managed to revisit this PR and have some time to integrate your work into the project,
and realized that we now have an exclusion rulle for runner/Makefile:
https://github.com/actions-runner-controller/actions-runner-controller/blob/f3fcb428ae56ee0a526cfffd35b7b24acd6e6704/.github/workflows/runners.yaml#L13

so if we added this lint-scripts target to the this file, it won't get triggered when the Makefile has changed.
Probably we'd better roll a new workflow dedicated for running spellcheck... Let me try.

mumoshu added a commit that referenced this pull request Sep 25, 2022
I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort to a major enhancement to the runner entrypoints being made in #1759.
This commit adds the makefile target to run shellformat locally, so that any contributor can use it before submitting a pull request.
mumoshu added a commit that referenced this pull request Sep 25, 2022
I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort to a major enhancement to the runner entrypoints being made in #1759.

This change is a counterpart of #1852. #1852 enables you to easily run shellcheck locally. This enables you to automatically run shellcheck on every pull request.

Currently, any shellcheck error does not result in failing the workflow job. Once we addressed all the shellcheck findings, we can flip the fail_on_error option to true and let jobs start failing on pull requests that introduces invalid or suspicious bash code.

# SC1091: source /opt/bash-utils/logger.sh won't exist when shellcheck is ran
# shellcheck disable=SC1091

Copy link
Collaborator

Choose a reason for hiding this comment

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

FYI TIL that you can tell shellcheck the path to look from the scripts.
shellcheck --source-path runner made this mark unnecessary.

mumoshu added a commit that referenced this pull request Sep 25, 2022
I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort for a major enhancement to the runner entrypoints being made in #1759.

This change updates and reintroduces #1517 contributed by @CASABECI in a way it becomes applicable to today's code-base.
mumoshu added a commit that referenced this pull request Sep 25, 2022
I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort for a major enhancement to the runner entrypoints being made in #1759.
This commit adds the makefile target to run shellformat locally, so that any contributor can use it before submitting a pull request.
mumoshu added a commit that referenced this pull request Sep 25, 2022
I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort to a major enhancement to the runner entrypoints being made in #1759.

This change is a counterpart of #1852. #1852 enables you to easily run shellcheck locally. This enables you to automatically run shellcheck on every pull request.

Currently, any shellcheck error does not result in failing the workflow job. Once we addressed all the shellcheck findings, we can flip the fail_on_error option to true and let jobs start failing on pull requests that introduces invalid or suspicious bash code.
mumoshu added a commit that referenced this pull request Oct 4, 2022
I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort for a major enhancement to the runner entrypoints being made in #1759.

This change updates and reintroduces #1517 contributed by @CASABECI in a way it becomes applicable to today's code-base.
mumoshu added a commit that referenced this pull request Oct 4, 2022
I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort for a major enhancement to the runner entrypoints being made in #1759.
This commit adds the makefile target to run shellformat locally, so that any contributor can use it before submitting a pull request.
mumoshu added a commit that referenced this pull request Oct 9, 2022
* Add workflow for validating runner scripts with shellcheck

I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort to a major enhancement to the runner entrypoints being made in #1759.

This change is a counterpart of #1852. #1852 enables you to easily run shellcheck locally. This enables you to automatically run shellcheck on every pull request.

Currently, any shellcheck error does not result in failing the workflow job. Once we addressed all the shellcheck findings, we can flip the fail_on_error option to true and let jobs start failing on pull requests that introduce invalid or suspicious bash code.
@mumoshu
Copy link
Collaborator

mumoshu commented Nov 3, 2022

@CASABECI Hey! Sorry for the massive delay, but we finally managed to introduce shellcheck into our CI workflow and fixed many lint errors along the way. See linked pull requests for more information. Your contribution enabled me to get started with shellcheck very quickly. Thanks a lot for your work!

@mumoshu mumoshu closed this Nov 3, 2022
@mumoshu mumoshu deleted the feat/shellcheck branch November 3, 2022 04:27
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.

4 participants