Open IcewaveLJW opened 1 year ago
the path was changed and it will bring error because of it wrong path of build.artifact.context. like ' image "A" context "root/ope/skaffold/A/dist" does not exist '
Can you specify which properties are being set differently here, and from which directory you're running Skaffold when invoking A/skaffold.yaml
directly, and E/skaffold.yaml
?
Sorry for such late reply because of my vacation.
Currently we review this issue and find some different expectation about solution.
The key points is In imported configurations, files are resolved relative to the location of imported Skaffold configuration file.
and we use relative path to define our build.artifact.context
.
So problem is we have a jenkins pipeline(goovy file) to control this. Here is a command in goovy file
If we set A as target.
sh """ skaffold build --profile=jenkins --default-repo=xxx --file-output=xxx.json --filename=ope/skaffold/A/skaffold.yaml --namespace=xxx"""
And it worked.
if we set E as target(which use a integrate skaffold.yaml include A).
sh """ skaffold build --profile=jenkins --default-repo=xxx --file-output=xxx.json --filename=ope/skaffold/E/skaffold.yaml --namespace=xxx"""
And it will return a error like image "A" context "${WORKSPACE}/ope/skaffold/A/dist/" does not exist
What we want context is "${WORKSPACE}/dist/"
Problem is like above. So we consider a new fix way is to use environment variables in jenkins and hardcode as absolute path . In the jenkins(goovy files),we can use ${env,WORKSPACE} to check current workspace. As a part of path, we want to sent it into skaffold.yaml so that we can re-code skaffold.yaml
kind: Config
metadata:
name: A
build:
tagPolicy:
gitCommit: {}
local:
push: true
useDockerCLI: true
artifacts:
- image: A
context: ${env,WORKSPACE}/dist/
docker:
dockerfile: ../ope/docker/A/Dockerfile
deploy:
~~~
profiles:
~~~
But current we can't find a way to read environment variables from jenkins? context: ${env,WORKSPACE}/dist/
this is not work.
What we can sure is in jenkins pipeline goovy file
sh "ws: ${env.WORKSPACE}"
is working.
How to sent or pass this value into "ope/skaffold/A/skaffold.yaml" is the most efficient way for solving issues.
the path was changed and it will bring error because of it wrong path of build.artifact.context. like ' image "A" context "root/ope/skaffold/A/dist" does not exist '
Can you specify which properties are being set differently here, and from which directory you're running Skaffold when invoking
A/skaffold.yaml
directly, andE/skaffold.yaml
?
Addtion: I found the feature I want but seems it not be improved well XD https://github.com/GoogleCloudPlatform/cloud-code-vscode/issues/378 Also some other ticket https://github.com/GoogleContainerTools/skaffold/pull/295 But still I didn't find exact way or doc for how to use skaffold.yaml. especially how to pass the values from platform(like Jenkins pipeline groovy) through the command or some other way.
Does this any update on this issues XD
Expected behavior
I have 4 micro-services and set 4 skaffold.yaml(A,B,C,D) for each of them, and I want to create an integrate for all of them so I create a. new skaffold.yaml(E) to handle this. I expect I can test this 4(A,B,C,D) individually and integrately(E). In the E/skaffold.yaml I need to use local config dependency. and In the (A,B,C,D) build part, I need to set
build.artifact.context
.Actual behavior
Currently, A,B,C,D worked well, but when I want to run the E (which calls A,B,C,B by local config dependency) Due to
the path was changed and it will bring error because of it wrong path of
build.artifact.context
. like ' image "A" context "root/ope/skaffold/A/dist" does not exist ' Structure as follow.Information
E/skaffold.yaml
A/skaffold.yaml
Conflict
Are there some ways I can override in E to reset the path ? I think I can just set the context by using absolute path but I can't do that because it will change by our different servers.