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

Container continues to run silently when cos-alerter fails #70

Merged
merged 8 commits into from
Mar 8, 2024

Conversation

IbraAoad
Copy link
Contributor

@IbraAoad IbraAoad commented Mar 7, 2024

Issue

Fixes #38

Solution

If no configuration file is passed, the code now catches a FileNotFoundError and exits with a non-zero exit status.

Testing Instructions

  1. Run the following command:
    docker run -p 8080:8080 ghcr.io/canonical/cos-alerter:latest
  2. Verify that cos-alerter fails to start and observe the following output:
2024-03-07T17:09:29.587Z [pebble] Started daemon.
2024-03-07T17:09:29.601Z [pebble] POST /v1/services 7.02659ms 202
2024-03-07T17:09:29.602Z [pebble] Started default services with change 1.
2024-03-07T17:09:29.611Z [pebble] Service "cos-alerter" starting: /usr/bin/cos-alerter
2024-03-07T17:09:29.915Z [cos-alerter] Config file not found. Exiting...
2024-03-07T17:09:29.960Z [pebble] [change 1 "Start service \"cos-alerter\"" task] failed: cannot start service: exited quickly with code 1

Copy link
Contributor

@lucabello lucabello left a comment

Choose a reason for hiding this comment

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

CI's failing because it's checking for the line you removed in rockcraft.yaml.
Before merging, can you first fix it (pull-request.yaml) by replacing the line:

rock_pkg_version=$(grep -P -o 'cos-alerter==\d+\.\d+\.\d+' rockcraft.yaml | grep -P -o '\d+\.\d+\.\d+')

with

rock_pkg_version=$(grep -P -o -m 1 'version: "\d+\.\d+\.\d+"' rockcraft.yaml | grep -P -o '\d+\.\d+\.\d+')

(note: it's likely gonna fail on this PR again, but at least the next ones will be okay)

rockcraft.yaml Outdated Show resolved Hide resolved
@IbraAoad
Copy link
Contributor Author

IbraAoad commented Mar 8, 2024

CI's failing because it's checking for the line you removed in rockcraft.yaml. Before merging, can you first fix it (pull-request.yaml) by replacing the line:

rock_pkg_version=$(grep -P -o 'cos-alerter==\d+\.\d+\.\d+' rockcraft.yaml | grep -P -o '\d+\.\d+\.\d+')

with

rock_pkg_version=$(grep -P -o -m 1 'version: "\d+\.\d+\.\d+"' rockcraft.yaml | grep -P -o '\d+\.\d+\.\d+')

(note: it's likely gonna fail on this PR again, but at least the next ones will be okay)

I think it's safe to remove the line entirely since this check is already implemented in rock_version?

@lucabello
Copy link
Contributor

True! Approving :)

@IbraAoad IbraAoad merged commit 55114fa into main Mar 8, 2024
7 checks passed
@IbraAoad IbraAoad deleted the absent-config-handling branch March 8, 2024 14:55
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.

Container keeps running if cos-alerter fails.
2 participants