Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtraVars with value not recognized anymore. #111

Open
juergen-albert opened this issue Aug 11, 2023 · 3 comments
Open

ExtraVars with value not recognized anymore. #111

juergen-albert opened this issue Aug 11, 2023 · 3 comments
Labels

Comments

@juergen-albert
Copy link

Jenkins and plugins versions report

Environment
Jenkins: 2.401.2
OS: Linux - 5.15.0-76-generic
Java: 17.0.7 - Private Build (OpenJDK 64-Bit Server VM)
---
adoptopenjdk:1.5
analysis-model-api:11.3.0
ansible:240.vc26740a_625c0
ansicolor:1.0.2
ant:497.v94e7d9fffa_b_9
antisamy-markup-formatter:159.v25b_c67cd35fb_
apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5
apache-httpcomponents-client-5-api:5.2.1-1.0
authentication-tokens:1.53.v1c90fd9191a_b_
authorize-project:1.7.0
bootstrap4-api:4.6.0-6
bootstrap5-api:5.3.0-1
bouncycastle-api:2.28
branch-api:2.1122.v09cb_8ea_8a_724
build-timeout:1.31
caffeine-api:3.1.6-115.vb_8b_b_328e59d8
checks-api:2.0.0
cloud-stats:267.v577e3742c282
cloudbees-folder:6.815.v0dd5a_cb_40e0e
command-launcher:100.v2f6722292ee8
commons-httpclient3-api:3.1-3
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-36.vc008c8fcda_7b_
conditional-buildstep:1.4.2
config-file-provider:938.ve2b_8a_591c596
credentials:1254.vb_96f366e7b_a_d
credentials-binding:604.vb_64480b_c56ca_
cvs:2.19.1
data-tables-api:1.13.4-3
display-url-api:2.3.7
docker-commons:422.v9d1a_89cede51
docker-java-api:3.3.1-79.v20b_53427e041
docker-plugin:1.4
docker-workflow:563.vd5d2e5c4007f
durable-task:507.v050055d0cb_dd
echarts-api:5.4.0-5
email-ext:2.99
external-monitor-job:206.v9a_94ff0b_4a_10
font-awesome-api:6.4.0-1
forensics-api:2.3.0
git:5.1.0
git-changelog:3.30
git-client:4.4.0
git-parameter:0.9.18
git-server:99.va_0826a_b_cdfa_d
github:1.37.1
github-api:1.314-431.v78d72a_3fe4c3
github-branch-source:1728.v859147241f49
gitlab-api:5.3.0-91.v1f9a_fda_d654f
gitlab-branch-source:664.v877fdc293c89
gitlab-plugin:1.7.14
gradle:2.8.1
greenballs:1.15.1
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
instance-identity:173.va_37c494ec4e5
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.2-350.v0c2f3f8fc595
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:233.vdc1a_ec702cff
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.8-1
jdk-tool:66.vd8fa_64ee91b_d
jersey2-api:2.40-1
jjwt-api:0.11.5-77.v646c772fddb_0
jquery:1.12.4-1
jquery3-api:3.7.0-1
jsch:0.2.8-65.v052c39de79b_2
junit:1214.va_2f9db_3e6de0
ldap:682.v7b_544c9d1512
lockable-resources:1172.v4b_8fc8eed570
mailer:457.v3f72cb_e015e5
mapdb-api:1.0.9-28.vf251ce40855d
matrix-auth:3.1.8
matrix-project:789.v57a_725b_63c79
maven-plugin:3.22
mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_
mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_
multibranch-scan-webhook-trigger:1.0.9
nexus-artifact-uploader:2.14
nexus-jenkins-plugin:3.16.501.ve3d6b_58f1d37
nodejs:1.6.0
okhttp-api:4.11.0-145.vcb_8de402ef81
pam-auth:1.10
parameterized-trigger:2.46
pipeline-build-step:496.v2449a_9a_221f2
pipeline-github-lib:42.v0739460cda_c4
pipeline-graph-analysis:202.va_d268e64deb_3
pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7
pipeline-input-step:468.va_5db_051498a_4
pipeline-milestone-step:111.v449306f708b_7
pipeline-model-api:2.2141.v5402e818a_779
pipeline-model-definition:2.2141.v5402e818a_779
pipeline-model-extensions:2.2141.v5402e818a_779
pipeline-rest-api:2.33
pipeline-stage-step:305.ve96d0205c1c6
pipeline-stage-tags-metadata:2.2141.v5402e818a_779
pipeline-stage-view:2.33
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.3.0
popper-api:1.16.1-3
popper2-api:2.11.6-2
prism-api:1.29.0-7
resource-disposer:0.22
role-strategy:633.v836e5b_3e80a_5
run-condition:1.6
scm-api:676.v886669a_199a_a_
script-security:1251.vfe552ed55f8d
snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4
ssh-credentials:305.v8f4381501156
ssh-slaves:2.877.v365f5eb_a_b_eec
sshd:3.303.vefc7119b_ec23
structs:324.va_f5d6774f3a_d
subversion:2.17.2
thinBackup:1.17
timestamper:1.25
token-macro:359.vb_cde11682e0c
translation:1.16
trilead-api:2.84.v72119de229b_7
variant:59.vf075fe829ccb
warnings-ng:10.2.0
workflow-aggregator:596.v8c21c963d92d
workflow-api:1219.v05cd837ea_249
workflow-basic-steps:1017.vb_45b_302f0cea_
workflow-cps:3697.vb_470e454c232
workflow-durable-task-step:1247.v7f9dfea_b_4fd0
workflow-job:1316.vd2290d3341a_f
workflow-multibranch:756.v891d88f2cd46
workflow-scm-step:415.v434365564324
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c
ws-cleanup:0.45

What Operating System are you using (both controller, and any agents involved in the problem)?

Ubuntu, not sure what Version but it should be latest LTS

Reproduction steps

  stage ('Fancy Ansible') {
        steps {
            wrap([$class: 'AnsiColorBuildWrapper', colorMapName: "xterm"]) {
                step([$class: 'AnsiblePlaybookBuilder',
                      credentialsId: 'cd-docker-compose',
                      playbook: 'deploy-docker-compose.yml',
                      inventory: [$class: 'InventoryContent',
                                  content: '''[project_devel]
                                              ${DEPLOY_HOST_ADDRESS}''',
                                  dynamic: false],
                      limit: 'project_devel',
                      extraVars: [[$class: 'ExtraVar', key: 'ansible_port', value: "${DEPLOY_HOST_PORT}"],
                                  [$class: 'ExtraVar', key: 'image_tag', value: "${IMAGE_TAG}"],
                                  [$class: 'ExtraVar', key: 'restore_from_dump', value: "${RESTORE_FROM_DUMP}"],
                                  [$class: 'ExtraVar', key: 'exclude_immutable_collections', value: "${EXCLUDE_IMMUTABLE_COLLECTIONS}"]],
                      disableHostKeyChecking: true,
                      colorizedOutput: true,
                      additionalParameters: '-v'])
            }
        }
    }

Expected Results

The script running utilizing the defined extraVars.

Actual Results

WARNING: Unknown parameter(s) found for class type 'org.jenkinsci.plugins.ansible.ExtraVar': value
WARNING: Unknown parameter(s) found for class type 'org.jenkinsci.plugins.ansible.ExtraVar': value
WARNING: Unknown parameter(s) found for class type 'org.jenkinsci.plugins.ansible.ExtraVar': value
WARNING: Unknown parameter(s) found for class type 'org.jenkinsci.plugins.ansible.ExtraVar': value
[WARN] Omitting extra var ansible_port: check value is a supported type.
[WARN] Omitting extra var image_tag: check value is a supported type.
[WARN] Omitting extra var restore_from_dump: check value is a supported type.
[WARN] Omitting extra var exclude_immutable_collections: check value is a supported type.

Anything else?

I don't know enough about how jenkins plugins work, but looking at the Code of the plugin I found 4cbc486#diff-63e2588a63bc0ffffd5eb82b66dd8ab4c588b277b7abbda76be684c2e0ef94a0

Here value in ExtraVars has been declared transient and all setters have been replaced by secretValue. I have no clue though how I should use this now.

The job is running rarely, so I'm not 1005 sure, but I believe we did an update round of jenkins and all its plugins between the last time it ran successfully in June and now.

@guilngou
Copy link
Contributor

guilngou commented Sep 5, 2023

Hello, try to change value: "${DEPLOY_HOST_PORT}" by secretValue: hudson.util.Secret.fromString("${DEPLOY_HOST_PORT}") and do the same for all your other values.

@jonesbusy
Copy link
Contributor

Don't use directly Jenkins internal like hudson.util.Secret. It will bypass the sandbox

There are some test/example on how to use extra vars

https://github.com/jenkinsci/ansible-plugin/tree/main/src/test/resources/pipelines

ansiblePlaybook(
    playbook: 'playbook.yml',
    extraVars: [foo: 'bar'],
)

or by map

ansiblePlaybook(
    playbook: 'playbook.yml',
    extraVars: [foo1: [value: 'bar1', hidden: false]],
)

Also why using step([$class: 'AnsiblePlaybookBuilder' on a pipeline and not the pipeline step ?

@jonesbusy jonesbusy added question and removed bug labels Sep 5, 2023
@juergen-albert
Copy link
Author

thanks heaps, we'll give it a try and will get back to you.

Also why using step([$class: 'AnsiblePlaybookBuilder' on a pipeline and not the pipeline step ?

Because the Syntax gives too many options and all we do till now is cargo cult with try and error...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants