Closed zszen closed 7 months ago
Please describe your problem more clearly and why you think you have your pipelines configured correctly, or what you have done to try and solve the problem.
Your pipeline would need to have an earlier stage or an upstream pipeline that is publishing the artifact with ID docker-33.251
in the artifact configuration. Have you configured that correctly?
gocd-server version : v23.5.0 linux centos 7 env. artifact id docker-33.251
I want put it to the commands beginning after added it.
"Specify the pipeline, stage and job name."
I don't know how to fill it.
Now I can create fecth artifact. But the pipeline dont work well. And I don't know why the docker artifact need a before job.
format_version: 10
pipelines:
pp-docker-build-test:
group: defaultGroup
label_template: ${COUNT}
lock_behavior: none
display_order: -1
materials:
git-29a3d2a:
git: http://10.0.68.37/platform/deployment/zszen/cicd-test-docker
username: zhaoshouzheng
shallow_clone: true
auto_update: true
branch: master
encrypted_password: AES:shWgS/69PctRLTEabOLtiA==:01Pbrhr8jOquuL/2l/yAlQ==
stages:
- test:
fetch_materials: true
keep_artifacts: false
clean_workspace: false
approval:
type: success
allow_only_on_success: false
jobs:
test:
timeout: 0
tasks:
- exec:
command: ls
run_if: passed
- st-docker-build-test:
fetch_materials: true
keep_artifacts: false
clean_workspace: false
approval:
type: success
allow_only_on_success: false
jobs:
jb-docker-build-test:
timeout: 0
resources:
- network
tasks:
- exec:
arguments:
- deal.sh
command: sh
run_if: passed
- fetch:
is_file: false
source: docker
destination: ''
stage: test
job: test
artifact_origin: gocd
run_if: passed
Perhaps you are misunderstanding how fetch artifact flows work in GoCD. To put it simply, you can only "fetch" an artifact that has been "published" by an earlier pipeline or stage.
So jb-docker-build-test
would have to fetch an artifact uploaded to the external repository from a different pipeline/stage. The "artifact ID" is not the same as the "artifact store ID" - instead its the identifier that would be configured in a early "publish" task for a job.
You can't use GoCD artifact flows to download an arbitrary docker image that wasn't produced by one of your pipelines and wasn't uploaded/published using GoCD.
If you want to do a basic pull/run of an arbitrary image you should just use docker pull xxx
/docker run xx
or similar inside your pipeline as a shell script or other basic task. The purpose of GoCD's support is when you want to say "fetch the artifact version that was uploaded by an earlier pipeline/stage without configuring the specific artifact version/tag/co-ordinates"
Unfortunately, this whole process does not seem to be well documented so it's the cause of a lot of confusion :-(
I just want use GoCD pull git and build a image. I think it should be easily. But it can't work well with command "from image". it can't pull image and I don't known how to tell it auth.
I think you misunderstand how docker builds work, perhaps.
GoCD works fine with a normal docker build but you should write a script to do so based on docker/podman commands and use GoCD secure variables or secrets to make your registry credentials available to command line tools in the way they normally expect if you were running in command line.
GoCDs philosophy is to leave that power with dedicated tools you run via scripts, not via lots of custom plugins/tasks. This may be different to what you are used to via Jenkins or GitHub actions or perhaps some other tools.
Thank you for help. Maybe I need learn more about GoCD docs.
"The plugin with which the artifact is associated cannot be determined because: the pipeline, stage, job or artifact id is a parameter or is non-existent. Please choose a plugin to configure the plugin properties."