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

Option to find apps/devices running a release #2732

Open
shaunco opened this issue Feb 24, 2024 · 0 comments
Open

Option to find apps/devices running a release #2732

shaunco opened this issue Feb 24, 2024 · 0 comments

Comments

@shaunco
Copy link

shaunco commented Feb 24, 2024

Expected Behavior

The balena CLI is great for CI/CD pipelines to post new releases to open-balena or balena-cloud, but it seems to be lacking some required options to be able to automate the cleanup of old releases. The specific things that would be useful are:

  1. Fleets/applications that should be running a release - Ideally this would be an option on the releases command, such as balena releases myorg/myfleet --include-fleet-use -j. Alternatively, this could either be a new option on the apps command, such as balena apps --on-release 1030.

  2. Devices that should be running a release - Ideally this would be an option on the releases command, such as balena releases myorg/myfleet --include-device-use -j. Alternatively, this could either be a new option on the devices command, such as balena devices should-be-running 1030.

  3. Devices that ARE running a release - Ideally this would be an option on the releases command, such as balena releases myorg/myfleet --include-device-use -j. Alternatively, this could either be a new option on the devices command, such as balena devices is-running 1030.

  4. Filter by release age - this could simply be an option on the balena releases command, perhaps something like -minimum-age 10 to get everything over 10 days old. That said, this one is not super important since both the text form and the json form of the releases command gives easily parseable dates, but when there are hundreds or thousands of releases, this could reduce response size.

Actual Behavior

None of the above are available.

Steps to Reproduce the Problem

Try to use the balena CLI to figure out what release are, or should be, running on fleets or devices in order to produce a list of releases over 10 days old that are not deployed to any devices or fleets.

Additional References

The current workaround we are using is to make direct API queries using the contents of the token file that is produced after balena login succeeds. This works, but it would be really nice to have this in the CLI.

For anyone else looking to do the same, this is the current query we run to get the list of releases with is running/should be running info so that we can make cleanup decisions:
curl -H "Authorization: Bearer $(cat ./token)" 'https://api.balena-cloud.com/v6/release?$orderby=created_at%20desc&$select=id,status,commit,source,created_at,start_timestamp,update_timestamp,end_timestamp,raw_version,is_invalidated,is_final&$expand=is_running_on__device/$count,should_be_running_on__application($select=id),should_be_running_on__device($select=id)'

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

No branches or pull requests

1 participant