Hello Carlos,
I tried it already with all *plain hard code*. And insert in the execution
of pipeline.
Something like this below:
podTemplate(
label: "pod",
containers: [
containerTemplate(
name: "*worker*",
image: "myregistry:5000/jenkins-worker:latest",
envVars:[
containerEnvVar( key: "PGUSER", value: "pguser" ),
containerEnvVar( key: "PGPASSWORD", value: "pgpassword" )
],
alwaysPullImage: true,
ttyEnabled: true,
command: "cat"
)
]
)
{
node( "pod" ) {
container( "*worker*" ) {
stage( "DB Tests" ) {
* containers: [ containerTemplate( name:
"db", image: "myregistry:5000/postgresql-server:1.0",
alwaysPullImage: true, ttyEnabled: true ) ]*
container( "*db*" ) {
sh "psql --host=127.0.0.1 --dbname=$project --echo-all
--command='SELECT timestamp FROM info'"
}
}
}
}
}
And I got the error message result below:
*Waiting for container container [db] of pod [slave-87s57-3zc4x] to become
ready.*
Do I make something wrong in script?
Or that need to be implemented by other form or syntax?
Thanks very much.
BR
Hong
Am Freitag, 11. August 2017 14:57:50 UTC+2 schrieb Carlos Sanchez:
>
> Have you tried?
>
> On Fri, Aug 11, 2017, 12:14 WANG, YAN-HONG <[email protected]
> <javascript:>> wrote:
>
>> Hello all,
>>
>> I saw the tutorial with jenkins-kubernetes-plugin.
>> https://github.com/jenkinsci/kubernetes-plugin
>>
>> The examples of containerTemplate are all created in the *beginning *of
>> groovy file.
>> And the *image name with version number *are *fixed*, too.
>> Example like this below.
>>
>> containerTemplate(
>> name: 'maven',
>> image: 'maven:3.3.9-jdk-8-alpine',
>> ttyEnabled: true,
>> command: 'cat'
>> )
>>
>> Is that possible or some *syntax *can implement container created during
>> *execution
>> of pipeline*?
>> So this container could also run in *the same Pod*.
>> Maybe the syntax looks like below.
>>
>> //////////////////////////////////////////////////////////////////////
>>
>> ......
>> ......
>>
>> containerTemplate(
>> name: 'maven',
>> image: 'myregistry:5000/*$ImageName*:*$VersionNumber*',
>> ttyEnabled: true,
>> command: 'cat'
>> )
>>
>> ......
>> ......
>>
>> //////////////////////////////////////////////////////////////////////
>>
>> Thanks very much.
>>
>> BR
>> Hong
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jenkinsci-users/CADLWyO3katWvkMezE80XJ8u%3DFna_QW5%2BjWT12PYa%3Dar_BUgAxQ%40mail.gmail.com
>>
>> <https://groups.google.com/d/msgid/jenkinsci-users/CADLWyO3katWvkMezE80XJ8u%3DFna_QW5%2BjWT12PYa%3Dar_BUgAxQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/6d679b02-1099-45a8-a35b-c89e25fae0a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.