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

send error output when running systemctl reset-failed k3s to /dev/null #10486

Closed

Conversation

helloimalemur
Copy link

Proposed Changes

Change line 868 in uninstall script block to add '2>/dev/null' to 'systemctl reset-failed ${SYSTEM_NAME}' on line 868 of install.sh, which is the section that creates the uninstall script.
I am currently using sed to fix this and prevent build errors within Github Actions.
Screenshot from 2024-07-10 10-58-59

Types of Changes

send error output when running systemctl reset-failed k3s to /dev/null

Verification

Change will not effect functionality.

Testing

Change is not covered by unit testing. Tested manually to confirm change does not change install script or uninstall script functionality.

Linked Issues

n/a

User-Facing Change

none


Further Comments

no further comment. I'm totally fine with using sed here, I just feel as though others may have run into issues with this as well.

@helloimalemur helloimalemur requested a review from a team as a code owner July 10, 2024 15:08
@brandond
Copy link
Contributor

prevent build errors within Github Actions.

Are you sure that this is the cause of the step showing as failed? Or is it because the command exits with a non-zero exit code? If it is the latter, then just redirecting the output will not actually solve your problem.

@helloimalemur
Copy link
Author

helloimalemur commented Jul 10, 2024

My apologies, you're right. I landed on a generalized 'systemctl reset-failed' vs 'systemctl reset-failed k3s'
Not sure if that would be opposed to in the uninstall script, I'm totally fine with sed'ing it out - I just think it may cause issues for others.

I am using Github actions to clone k3s repo, scp it to my up-to-date Debian Bookworm machine, and run the install.sh. It uninstalls in the same fashion. Prior to using this sed command I was having inconsistent failures with the uninstall script, causing it to leave remains of the installation behind then cause the next run of the install.sh script to fail.

name: k3s

on:
  push:
    branches: [ "master" ]
  workflow_dispatch:
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Clean up
        uses: JimCronqvist/action-ssh@master
        with:
          hosts: 'user@host:22'
          privateKey: ${{ secrets.KEY }}
          command: if [[ -d /var/lib/k3s/ ]]; then rm -rf /var/lib/k3s/*; else mkdir /var/lib/k3s/; fi

      - name: Checkout
        uses: actions/checkout@v3
        with:
          submodules: true
      - name: Clone
        run: ls -althrs

      - name: SCP Repo
        uses: nogsantos/scp-deploy@master
        with:
          src: ./*
          host: host
          remote: /var/lib/k3s/
          port: 22
          user: root
          key: ${{ secrets.KEY }}

      - name: docker prune
        uses: JimCronqvist/action-ssh@master
        #        continue-on-error: true
        with:
          hosts: 'user@host:22'
          privateKey: ${{ secrets.KEY }}
          command: yes | docker system prune -a;

      - name: uninstall script
        uses: JimCronqvist/action-ssh@master
#        continue-on-error: true
        with:
          hosts: 'user@host:22'
          privateKey: ${{ secrets.KEY }}
          command: if [[ -f /usr/local/bin/k3s-uninstall.sh ]]; then sed -i -e 's/systemctl reset-failed k3s/systemctl reset-failed/g' /usr/local/bin/k3s-uninstall.sh && /usr/local/bin/k3s-uninstall.sh; fi;

      - name: remove /var/lib/kubelet/
        uses: JimCronqvist/action-ssh@master
        #        continue-on-error: true
        with:
          hosts: 'user@host:22'
          privateKey: ${{ secrets.KEY }}
          command: if [[ -d /var/lib/kubelet/ ]]; then rm -rf /var/lib/kubelet/; fi;

      - name: remove k3s service
        uses: JimCronqvist/action-ssh@master
        #        continue-on-error: true
        with:
          hosts: 'user@host:22'
          privateKey: ${{ secrets.KEY }}
          command: if [[ -f /etc/systemd/system/k3s.service ]]; then rm /etc/systemd/system/k3s.service && systemctl daemon-reload; fi;

      - name: k3s install
        uses: JimCronqvist/action-ssh@master
        #        continue-on-error: true
        with:
          hosts: 'user@host:22'
          privateKey: ${{ secrets.KEY }}
          command: if [[ -f /var/lib/k3s/k3s/install.sh ]]; then sed -i -e 's/systemctl reset-failed ${SYSTEM_NAME}/systemctl reset-failed/g' /var/lib/k3s/k3s/install.sh && /var/lib/k3s/k3s/install.sh; fi;

generalized reset-failed

Signed-off-by: Koonts <[email protected]>
generalized reset-failed

Signed-off-by: Koonts <[email protected]>
install.sh Outdated Show resolved Hide resolved
package/rpm/install.sh Outdated Show resolved Hide resolved
helloimalemur and others added 2 commits July 10, 2024 15:31
resolves Github actions failure

Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Koonts <[email protected]>
resolves Github actions failure

Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Koonts <[email protected]>
@helloimalemur
Copy link
Author

Your suggested changes worked great!

@brandond
Copy link
Contributor

You also need to update the sha256sum file when modifying the install script.

@brandond
Copy link
Contributor

You need to pull from our repo again, and then rebase on top of the master branch. And don't forget to sign your commits!

helloimalemur and others added 7 commits July 12, 2024 10:04
generalized reset-failed

Signed-off-by: Koonts <[email protected]>
generalized reset-failed

Signed-off-by: Koonts <[email protected]>
resolves Github actions failure

Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Koonts <[email protected]>
resolves Github actions failure

Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Koonts <[email protected]>
@helloimalemur
Copy link
Author

I believe I have re-based and amended my commits correctly, please let me know if not I can make a new pr.

helloimalemur and others added 9 commits July 12, 2024 10:11
Signed-off-by: Brad Davidson <[email protected]>
Bumps [github.com/hashicorp/go-retryablehttp](https://github.com/hashicorp/go-retryablehttp) from 0.7.4 to 0.7.7.
- [Changelog](https://github.com/hashicorp/go-retryablehttp/blob/main/CHANGELOG.md)
- [Commits](hashicorp/go-retryablehttp@v0.7.4...v0.7.7)

---
updated-dependencies:
- dependency-name: github.com/hashicorp/go-retryablehttp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Made with ❤️️ by updatecli
* chore: Bump Local Path Provisioner version

Made with ❤️️ by updatecli

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
github-actions bot and others added 4 commits July 12, 2024 10:32
Made with ❤️️ by updatecli
* Move snapshot structs and functions into pkg/etcd/snapshot
* Move s3 client code and functions into pkg/etcd/s3
* Refactor pkg/etcd to track snapshot and s3 moves
* Add support for reading s3 client config from secret
* Add minio client cache, since S3 client configuration can now be
  changed at runtime by modifying the secret, and don't want to have to
  create a new minio client every time we read config.
* Add tests for pkg/etcd/s3

Signed-off-by: Brad Davidson <[email protected]>
…-io#10461)

* For E2E upgrade test, determine the upgrade channel

Signed-off-by: Derek Nola <[email protected]>

* Fix typos

Signed-off-by: Derek Nola <[email protected]>

---------

Signed-off-by: Derek Nola <[email protected]>
@brandond
Copy link
Contributor

It looks like you pulled our master branch into your PR branch. Hence all the extra commits here. You want to rebase YOUR branch on top of ours.

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.

None yet

4 participants