Open IcewaveLJW opened 1 week ago
Try this one:
context: "${WORKSPACE}/dist/"
"${WORKSPACE}/dist/"
Thank you for quick replying, but no luck it still error like [2024-11-14T07:24:43.432Z] image "myservice" context "/${WORKSPACE}/dist/" does not exist
@IcewaveLJW it's a different error, have you passed the WORKSPACE
environment? looks like you haven't
@IcewaveLJW it's a different error, have you passed the
WORKSPACE
environment? looks like you haven't
@idsulik I saw this on the page Skaffold will automatically load these variables into the environment before running any commands.
Actually it's blur for me to pass a parameter in skaffold.yaml, here is my jenkins gvy which execute skaffold command,
mkdir dist || true
skaffold config set --global collect-metrics false
skaffold build --profile=jenkins --default-repo=${REPO} --file-output=${env.SKAFFOLD_BUILD_ARTIFACTS} ${SH_SKAFFOLD_DRY_RUN} ${SKAFFOLD_OPTIONS}
skaffold deploy --profile=${params.ENV} --build-artifacts=${env.SKAFFOLD_BUILD_ARTIFACTS} ${SKAFFOLD_OPTIONS}
, shall I do something here?
put this before the skaffold command:
echo "${WORKSPACE}/dist/" && ls "${WORKSPACE}/dist/"
Hi @idsulik I add these two new command
export WORKSPACE=${env.WORKSPACE} echo "${WORKSPACE}/dist/" && ls "${WORKSPACE}/dist/"
beforeskaffold config set
, it can show in the log but it still look like this in deployment process.
[2024-11-14T07:54:50.249Z] + export WORKSPACE=/var/lib/jenkins/workspace/mono_Skaffold
[2024-11-14T07:54:50.249Z] + echo /var/lib/jenkins/workspace/mono_Skaffold/dist/
[2024-11-14T07:54:50.249Z] /var/lib/jenkins/workspace/mono_Skaffold/dist/
[2024-11-14T07:54:50.249Z] + ls /var/lib/jenkins/workspace/mono_Skaffold/dist/
[2024-11-14T07:54:50.249Z] + skaffold config set --global collect-metrics false
[2024-11-14T07:54:50.249Z] set global value collect-metrics to false
[2024-11-14T07:54:50.249Z] + skaffold build --profile=jenkins --default-repo=xxx --file-output=skaffold-build.json --filename=xxx --namespace=xxx
[2024-11-14T07:54:50.504Z] image "myservice" context "/${WORKSPACE}/dist/" does not exist```
It seems to me that the context
field doesn't support env templating https://skaffold.dev/docs/environment/templating/#list-of-fields-that-support-templating
It seems to me that the
context
field doesn't support env templating https://skaffold.dev/docs/environment/templating/#list-of-fields-that-support-templating
Thank you for checking, I mean does there some way can help me to deal with that? Why we need to use env variable here is that we may have lots of task running in the same time which be assigned different WORKSPACE
so we have to transport it into yaml and make as absolute path.
Expected behavior
skaffold.yaml can read the env variable
WORKSPACE
and worked as expexted.Actual behavior
Error:
parsing skaffold config: error parsing skaffold configuration file: parsing api version: yaml: line 13: did not find expected key
Information
I built like this
WORKSPACE=/var/lib/jenkins/workspace/my_target_value
I saw the page here, https://skaffold.dev/docs/environment/env-file/, but seems it didn't work.