#Unable to run conditional action based on env variable like client.env.ENVIRONMENT

1 messages · Page 1 of 1 (latest)

grizzled thunder
#
deploy: {
  if client.env.ENVIRONMENT != _|_ && client.env.ENVIRONMENT != "production" {
    app: core.#Nop & {
      input: _source
      }
    }

  if client.env.ENVIRONMENT != _|_ && client.env.ENVIRONMENT != "production" {
    app: core.#Nop & {
      input: _source
      }
    }
 }

if i run dagger do the deploy action is not visible, if i change client.env.ENVIRONMENT with a field i can run the action (but i need to change manually the field value)

lone lynx
#

Those 2 if blocks seems to have the same conditions in it? Is it just that logic that is flawed? Or am I missing something?

grizzled thunder
#

it is only an example and i put two equivalent block but i need to differentiate and replace core.#Nop with some real action

#

I need to run different action for different branch (aka environment)

lone lynx
#

Oh, I think I understand.
By having 2 conditionals, you would create 2 app that would conflict?

surreal wind
#

If the answer is "yes", could you try again by removing the default value and/or making the field non-optional?

grizzled thunder
haughty elm
grizzled thunder