Fleet variable error while creating via CLI


when I run command: balena env add EDITOR vim --fleet DEV-DC-Faxe-NodeRed-LenzeDH it is inserted:

however when I try to assign service:

balena env add EDITOR2 vim --fleet DEV-DC-Faxe-NodeRed-LenzeDH --service faxe

I receive error: “Application not found: DEV-DC-Faxe-NodeRed-LenzeDH, fleet: DEV-DC-Faxe-NodeRed-LenzeDH”

What am I missing? I’m following example: balena CLI Documentation - Balena Documentation

Hi, could you please confirm whether using the fleet slug instead of the name works? Please also check if putting the service name in quotes (and slug in quotes if a combination of everything else doesn’t work) improves anything

just to clarify by slug you mean --fleet → -f, --service ->-s?
In that case I’ve tried combinations --fleet/ -f/ --service/ -s with quotes or without, I always get the same error if I add --service/ -s.
balena env add EDITOR2 vim -f “DEV-DC-Faxe-NodeRed-LenzeDH” works fine.
I’ve also checked other fleets, but it is the same behavior.

Just to mention, commands like balena env add NewVariable --device 6a4fca63a46679a2cd5958a8d5606df1 --service faxe works fine. It seems it just doesn’t like fleet and service combination :slight_smile:

just to clarify by slug you mean --fleet → -f, --service ->-s?

No, slug is a unique identifier for your fleet composed of your org handle and the fleet’s name, like this: ORG_HANDLE/FLEET_NAME. You can find it in the dashboard when viewing a fleet/list of fleets or by fetching the fleet’s info via the CLI. I would like to make sure that the behavior you are seeing is for fleets as a whole and not just an issue with fleet name vs slug

Also, could you please tell us which CLI version you are using?

Meanwhile, I’ll try to reproduce the issue on my end

Okay I’ve managed to reproduce. I indeed see the issue, however it is as I assumed: the issue appears to only occur when using fleet name instead of slug. Let me try with a newer version of the CLI to see if it has been patched yet. If not, I will look into the issue

Okay I’ve confirmed the issue is present in the latest CLI version, looking into it

Thanks, for your help, at least there is an workaround with ORG_HANDLE/FLEET_NAME. Looking forward to see an issue being fixed.

No problem. Just an update: I have found the cause of the issue, just confirming with my colleagues before proceeding whether this was intentional or indeed a bug

A fix has been merged. Version 16.2.2 of the CLI should be available soon with the fix for the bug. It makes it possible to use fleet names for setting environment variables. However, please note that in the next major version of the CLI we plan to remove support for using fleet names in favor of only using fleet slugs.

Thanks, as long as it matches documentation - fine by me :smile:

With the new version of balena CLI, is it possible to create a fleet variable for a service that is not yet deployed in the fleet?

Unfortunately it is not possible to create a fleet variable for a service that is not yet deployed in the fleet. Could you please share your usecase for this feature? Additionally, you can raise a suggestion (or upvote one if it already exists) with a description of the feature and usecase on our roadmap so that we can learn more about our users’ usecases and how important/helpful the feature may be: https://roadmap.balena.io/

Hello I’m surprised that the feature is not deployed in balena cloud. I had already started a script start: https://github.com/MiroYld/balena-copy-envs to copy the variables from a fleet a to b. But I need to be able to deploy a variable for a specific service without it already being deployed in a fleet. I even put the request on the roadmap several months ago. here is my original question, : https://forums.balena.io/t/copy-fleets-variables/367195

Hi, I appreciate that you have created a roadmap request some time ago

The roadmap is intended to communicate features we are working on to users (as well as any progress) and to collect feedback/suggestions from users. Unfortunately this does not mean that we get around to discussing and implementing every feature, though we do hope and try to visit as many as we can. I see that your roadmap post (linking it here for reference: copy balena envs fleets · Balena Roadmap ) does not have many upvotes, especially compared to some of the most wanted suggestions. Although a high number of votes does not guarantee that the suggestion gets addressed, it does help us figure out which suggestions are more urgent to explore.

With that said, I assume the lack of votes on the suggestion is likely related to why we have not yet discussed it. This is not intended to discourage you from requesting this and other features, (as a matter of fact, continued shouting about it let’s us know it’s still important to someone :slight_smile: ). I’m just trying to communicate a potential reason this feature request has not been discussed/implemented yet. Perhaps if it gains more traction or another feature we’re working on along the way relates to it, we may discuss it. If any discussion does take place or any decisions are made, we will be sure to update you via the roadmap suggestion you have created.

If you have any questions please feel free to ask, and if you have anymore suggestions please do let us know and post/upvote them on the roadmap.