jenkinsci / aws-sqs-trigger-plugin

https://plugins.jenkins.io/aws-sqs-trigger/
MIT License
0 stars 9 forks source link

No able to receive message attributes values #2

Closed lewandowskim1988 closed 11 months ago

lewandowskim1988 commented 1 year ago

Jenkins and plugins versions report

Jenkins: 2.375.1 OS: Linux - 5.15.0-30-generic

ace-editor:1.1
apache-httpcomponents-client-4-api:4.5.13-138.v4e7d9a_7b_a_e61
authentication-tokens:1.4
authorize-project:1.4.0
aws-credentials:191.vcb_f183ce58b_9
aws-java-sdk-ec2:1.12.287-357.vf82d85a_6eefd
aws-java-sdk-minimal:1.12.287-357.vf82d85a_6eefd
aws-sqs-trigger:1.2
blueocean:1.25.8
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.25.8
blueocean-commons:1.25.8
blueocean-config:1.25.8
blueocean-core-js:1.25.8
blueocean-dashboard:1.25.8
blueocean-display-url:2.4.1
blueocean-events:1.25.8
blueocean-git-pipeline:1.25.8
blueocean-github-pipeline:1.25.8
blueocean-i18n:1.25.8
blueocean-jwt:1.25.8
blueocean-personalization:1.25.8
blueocean-pipeline-api-impl:1.25.8
blueocean-pipeline-editor:1.25.8
blueocean-pipeline-scm-api:1.25.8
blueocean-rest:1.25.8
blueocean-rest-impl:1.25.8
blueocean-web:1.25.8
bootstrap5-api:5.2.1-3
bouncycastle-api:2.26
branch-api:2.1051.v9985666b_f6cc
build-with-parameters:76.v9382db_f78962
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checks-api:1.8.0
cloudbees-bitbucket-branch-source:791.vb_eea_a_476405b
cloudbees-disk-usage-simple:178.v1a_4d2f6359a_8
cloudbees-folder:6.800.v71307ca_b_986b
command-launcher:1.2
commons-lang3-api:3.12.0-36.vd97de6465d5b_
commons-text-api:1.10.0-27.vb_fa_3896786a_7
configuration-as-code:1569.vb_72405b_80249
credentials:1214.v1de940103927
credentials-binding:523.vd859a_4b_122e6
display-url-api:2.3.6
durable-task:503.v57154d18d478
echarts-api:5.4.0-1
favorite:2.4.1
font-awesome-api:6.2.1-1
git:4.14.2
git-client:3.13.1
github:1.36.0
github-api:1.303-400.v35c2d8258028
github-branch-source:1696.v3a_7603564d04
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
hashicorp-vault-pipeline:1.4
hashicorp-vault-plugin:359.v2da_3b_45f17d5
htmlpublisher:1.31
instance-identity:142.v04572ca_5b_265
ionicons-api:31.v4757b_6987003
jackson2-api:2.14.1-313.v504cdd45c18b
jakarta-activation-api:2.0.1-2
jakarta-mail-api:2.0.1-2
javax-activation-api:1.2.0-5
javax-mail-api:1.6.2-5
jaxb:2.3.7-1
jdk-tool:1.0
jenkins-design-language:1.25.8
jjwt-api:0.11.5-77.v646c772fddb_0
job-dsl:1.81
jquery3-api:3.6.1-2
jsch:0.1.55.61.va_e9ee26616e7
junit:1166.va_436e268e972
kubernetes:3734.v562b_b_a_627ea_c
kubernetes-client-api:5.12.2-193.v26a_6078f65a_9
kubernetes-credentials:0.9.0
kubernetes-credentials-provider:1.206.v7ce2cf7b_0c8b
mailer:438.v02c7f0a_12fa_4
matrix-auth:3.1.5
matrix-project:785.v06b_7f47b_c631
metrics:4.2.13-420.vea_2f17932dd6
monitoring:1.91.0
oic-auth:2.3
okhttp-api:4.9.3-108.v0feda04578cf
pipeline-build-step:2.18
pipeline-graph-analysis:195.v5812d95a_a_2f9
pipeline-groovy-lib:621.vb_44ce045b_582
pipeline-input-step:466.v6d0a_5df34f81
pipeline-milestone-step:101.vd572fef9d926
pipeline-model-api:2.2118.v31fd5b_9944b_5
pipeline-model-definition:2.2118.v31fd5b_9944b_5
pipeline-model-extensions:2.2118.v31fd5b_9944b_5
pipeline-rest-api:2.28
pipeline-stage-step:296.v5f6908f017a_5
pipeline-stage-tags-metadata:2.2118.v31fd5b_9944b_5
pipeline-utility-steps:2.14.0
plain-credentials:139.ved2b_9cf7587b
plugin-util-api:2.20.0
popper2-api:2.11.6-2
prometheus:2.0.11
pubsub-light:1.17
rebuild:1.34
scm-api:621.vda_a_b_055e58f7
script-security:1218.v39ca_7f7ed0a_c
simple-theme-plugin:136.v23a_15f86c53d
snakeyaml-api:1.33-90.v80dcb_3814d35
sse-gateway:1.26
ssh-credentials:305.v8f4381501156
sshd:3.236.ved5e1b_cb_50b_2
startup-trigger-plugin:2.9.3
structs:324.va_f5d6774f3a_d
token-macro:321.vd7cc1f2a_52c8
trilead-api:2.84.v72119de229b_7
variant:59.vf075fe829ccb
workflow-aggregator:590.v6a_d052e5a_a_b_5
workflow-api:1200.v8005c684b_a_c6
workflow-basic-steps:994.vd57e3ca_46d24
workflow-cps:3565.v4b_d9b_8c29a_b_3
workflow-durable-task-step:1217.v38306d8fa_b_5c
workflow-job:1254.v3f64639b_11dd
workflow-multibranch:716.vc692a_e52371b_
workflow-scm-step:400.v6b_89a_1317c9a_
workflow-step-api:639.v6eca_cd8c04a_a_
workflow-support:839.v35e2736cfd5c

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

Linux

Reproduction steps

  1. Install and configure plugin with doc triggers
  2. Configure proper parameters in Jenkins job params
  3. Send payload to SQS with command
    aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/11111111111/dummy --message-body "Test trigger jenkins" --message-attributes file://send-message.json --region us-east-1

    send-message.json

    {
    "test": {
    "DataType": "String",
    "StringValue": "test"
    }
    }
  4. Jenkins will trigger proper job but parameters that are send miss sqs_test from message attributes params_receive

Expected Results

Job should receive parameter sqs_test with value test

Actual Results

Looks like message attributes are not parsed properly

Anything else?

No response

sopeal commented 1 year ago

Hi @lewandowskim1988,

Because of the SECURITY-170, the job must explicitly define the parameters to used in the job.

Did you explicitly define sqs_test parameter?

canidam commented 1 year ago

@sopeal I'm experiencing the same behavior. I did configure the parameter explicitly, yet I don't get it as a job parameter.

Are the message attribute params should be configured as string as well? (in case they're defined as string of course).

I can send my message as json and parse it as a WA, but it would have been nicer to have attributes working

tolleiv commented 1 year ago

+1 same here, setup and trigger itself is straight forward, passing parameters doesn't work as expected.

serbaniuliuscezar commented 1 year ago

You need to ".withMessageAttributeNames("All");" to https://github.com/jenkinsci/aws-sqs-trigger-plugin/blob/eb3a98f05c65f1f6950064fc8162dc131f91f7fe/src/main/java/io/jenkins/plugins/sqs/SqsPollerImpl.java#L73

lewandowskim1988 commented 11 months ago

Thank you @serbaniuliuscezar! Adding this parameter resolved my problem with receiving parameters.