I have a microservice app on GKE
, Docker images for it are built in pipeline and pushed to Container Registry
, I wanted before the job - that deploys x
microservice, to get list of latest (lets say 20) images available to use (with command gcloud container images list-tags x
) and then pass it as some env and deploy it in pipeline. My question is how would I run that gcloud command before job is executed?
Asked
Active
Viewed 108 times
0

potatopotato
- 1,024
- 2
- 16
- 38
-
Hi there. What pluggins are you using in your job/pipeline? Are you running declarative pipelines or jobs? Is your Jenkins inside a container or directly installed on your VM? Where it is running your Jenkins (at Google Cloud or On Prem)? Are you aware about [Cloud Builder](https://cloud.google.com/cloud-build/docs/cloud-builders) containers? – Armando Cuevas Aug 13 '20 at 12:08
-
I found this [similar discussion thread](https://stackoverflow.com/questions/48641973/jenkins-add-prebuild-step) which is believe is useful for you. I also found this [other thread](https://stackoverflow.com/questions/9704677/jenkins-passing-variables-between-jobs) where they have discussed an option to passing variables between jobs while using jenkins. – Digil Aug 13 '20 at 14:29
-
You may also refer [this thread](https://stackoverflow.com/questions/28356497/use-gcloud-with-jenkins), where they have discussed a issue connected with using gcloud with Jenkins. – Digil Aug 13 '20 at 14:47
-
@ArmandoCuevas, plugins, the jenkins itself have 150+ insatlled so whichever is needed can simply add, ye we run declarative pipelines with jenkinsfiles, jenkins is on GKE so on containers with EmptyDir storage attached to each job - so fresh run each job and output is sent to master disc after finish, I am aware but we decided not to use it yet - other priorities, maybe in the future – potatopotato Aug 14 '20 at 07:30
-
And to others, thanks for the links but they all are similar stuff but not what I'm looking for, passing variables to 2 jobs, or using gcloud command INSIDE the job itself I already accomplished, the authentication with Service Account etc. but I'd like to have it done before the job is even run - to pick version of image from list and pass that to a job – potatopotato Aug 14 '20 at 07:35