#For some strange reason dagger does not
1 messages ยท Page 1 of 1 (latest)
Action not recognized
Hi @deft ocean,
In general, this is because of a shadowing issue in Cue
Could you please share your Plan ?
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
Can you please show me lib2.Promoteapp's definition, as the issue might lie inside ?
#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)"
}
}
}```
You didn't specify the targetName
my idea was if targetName isn't specificied then I'll take a replacement
Ah! wait, I was suppose to say targetName?:
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
}
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
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
Why should I declare explictly - per my usage its implict based on the value
Ah I thought so - also ? never worked in my testing
in this case
targetName?: string doesn't work
targetName: string | *" " works
You could set it as: targetName: string | *nil
And do if targetName != nil
Maybe a little bit cleaner ?
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
Awesome if it works.
Yes, sometimes using the bottom value (_|_) is tricky in Cue. I generally play with it in the playground
PS: null, sorry, my bad ๐
yeah it comes from cue - again I find it strange and its bit strange explaining this to colleagues ๐คฃ
๐ค
Link updated, sorry ๐คฃ
thanks! I see that it works in play - but it somehow doesn't with dagger@2.10.0