#For some strange reason dagger does not

1 messages ยท Page 1 of 1 (latest)

golden umbra
#

Action not recognized

#

Hi @deft ocean,
In general, this is because of a shadowing issue in Cue

#

Could you please share your Plan ?

deft ocean
#

sure

#

    client: {
        filesystem: {
            ".": read: {
                contents: dagger.#FS
            }
            "./tests": write: {
                contents: actions.Test.testReportDir
            }
        }
        // reading the environment variables
        env: {
                // env variables here
        }
    }

    actions: {
        // presetups
        _libAuth: lib.#Auth & {
        // setup
        }
        _enterpriseNexusAuth: lib.#EnterpriseNexusAuth & {
        // setup
        }
        
        Build: lib.#Buildapp & {
            appSource:     _readSource.output
            name:          _apiName
            auth:          _libAuth
            repoAuth: _enterpriseNexusAuth
        }

        // Test app
        Test: lib.#Testapp & {
            appSource:     _readSource.output
            auth:          _libAuth
            mavenRepoAuth: _enterpriseNexusAuth
        }

        Publish: lib.#PublishappExchange & {
            appJarDir: Build.output
            name:      Build.name
            version:   Build.version
            auth:      _libAuth
        }

        Deploy: lib2.#Publishapp & {
            appJarDir:        Build.output
            name:             Build.name
            version:          Build.version
            persistentQueues: "enableEncrypt"
            auth:             _libAuth
        }

        // This isn't being recognised!
        PromoteDeploy: lib2.#Promoteapp & {
            auth:            _libAuth
            name:            Build.name
            fromEnvironment: "Sandbox"
            toEnvironment:   "Pre-Prod"
        }
    }
}  ```
#

of course this is just a snippet and

#

the issue is only with PromoteDeploy

golden umbra
#

Can you please show me lib2.Promoteapp's definition, as the issue might lie inside ?

deft ocean
#
#Promoteapp: {
    cliVersion: *"3.10.0" | lib._#DefaultCLIVersion
    auth: lib.#Auth
    name: string
    fromEnvironment: string
    toEnvironment: string
    targetName: string

    // Internal flags
    _env: strings.Replace(strings.ToLower(base64.Encode(null, toEnvironment)), "=", "", -1)
    _toEnvAppName: "\(name)-\(_env)"

    if(targetName != "_|_"){
        _toEnvAppName: targetName
    }

    runCli: lib.#_runCli & {
        cliVersion:  cliVersion
        cliCommand:  "promote_app"
        cliAuth:     auth
        ignoreCache: true
        cliEnv: {
            API_NAME:        "\(name)"
            API_NAME_TARGET: "\(_toEnvAppName)"
            FROM_ENV:        "\(name)"
            TO_ENV:          "\(name)"
        }
    }

}```
golden umbra
#

You didn't specify the targetName

deft ocean
#

my idea was if targetName isn't specificied then I'll take a replacement

#

Ah! wait, I was suppose to say targetName?:

golden umbra
#

Ok, to do that you need to change 2 things:

 targetName?: string // <== make it optional

 if(targetName != _|_){ // if targetName is different than undefined
        _toEnvAppName: targetName
    }
deft ocean
#

but, if that

#

yeah I see the issue now - but if that's the issue then why isn't that being said

#

its silently ignoring the entire action

golden umbra
#

You'll also have to change:

     _toEnvAppName: string
     if(targetName == _|_){
        _toEnvAppName: "\(name)-\(_env)"
    }
#

Which is the else equivalent of your condition

#

Some Cue errors are not easy to catch. Could you please make an issue out of it ? We'll work on it, for sure

#

We have heuristics to avoid that kind of issue, it seems that this one passed through

deft ocean
deft ocean
#

in this case
targetName?: string doesn't work

targetName: string | *" " works

golden umbra
#

And do if targetName != nil

#

Maybe a little bit cleaner ?

deft ocean
#

thank you if it works. I always chuckle at _|_

#

I find it strange usage to indicate null/nil/void

#

wait did you mean null ? or nil

golden umbra
deft ocean
#

yeah it comes from cue - again I find it strange and its bit strange explaining this to colleagues ๐Ÿคฃ

golden umbra
#

Using the bottom shall work, I did a small repro

deft ocean
#

๐Ÿค”

golden umbra
deft ocean
#

thanks! I see that it works in play - but it somehow doesn't with dagger@2.10.0

golden umbra
#

Could you please try to slim down a repro ? We might have an issue on the heuristic to detect the action then

#

Like a repro case that we could base ourselves on ๐Ÿ˜‡