Giter VIP home page Giter VIP logo

aws-codecommit-trigger-plugin's People

Contributors

bitcalibrator avatar github-actions[bot] avatar matteopierro avatar phuonghuynh avatar recena avatar ronaldtse avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

aws-codecommit-trigger-plugin's Issues

Test access doesn't work

Test access is throwing 504 Gateway timeout error

Versions:

  • Jenkins ver. 2.153 (one EC2 instance behind ALB, doing SSL offloading, no IAM roles attached)
  • AWS CodeCommit Trigger Plugin ver. 2.0.1 (latest)

Steps to reproduce:

  • Created IAM policy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "sqs:DeleteMessage",
                "sqs:DeleteMessageBatch",
                "sqs:ReceiveMessage",
                "sqs:GetQueueAttributes",
                "sqs:GetQueueUrl"
            ],
            "Resource": "arn:aws:sqs:myRegion:myAccountID:myQueue"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "sqs:ListQueues",
            "Resource": "*"
        }
    ]
}
  • Attached this policy to user and created keys
  • Created SNS topic and SQS queue, and verified SQS subscription (I have SNS messages in queue from CodeCommit triggers, test works fine in AWS console)
  • Jenkins > Manage Jenkins > Configure System > AWS Code Commit Trigger SQS Plugin
  • Select the right AWS Credential (newly created user, but I've also tried keys from Administrator account)
  • Select the right AWS Region
  • Select the right SQS Queue available from the dropdown (the one from Resource in IAM policy, here called myQueue)

Screenshot plugin

I am able to use CLI commands such as aws sqs get-queue-url --queue-name myQueue from the Jenkins EC2 instance with keys from the user with attached policy, and I am getting replies back, so Jenkins EC2 can definitely reach the queue

Any idea what's wrong here?

Some UX issues with the new selection box

screen shot 2017-08-18 at 10 51 34 pm

Enabling SQS monitor should by default select "Defined in SCM / Pipeline script".

Currently it defaults to "Manually enter it" but should default select "Defined in SCM".

Test SQS Queue access

@ronaldtse Atm the validation of the SQS connection only do one simple task (original version): read queue url from queue selected. It doesnt make sense if the credential has permission to read queue lists but has no access right to read & delete queue items which is required by the plugin, check the SQS permission list http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-api-permissions-reference.html

The plugin should ask user to send an item to the queue. When the item is verified by the user, it should be deleted. The validation should return success value if all operations are successful.

Travis auto release/deploy support?

@ronaldtse Travis would listen on a branch "release" or branch "master"... and do deploy if any commit on that branch.
We should grant Travis credentials to do make a new release/deployment.

Single message should be able to trigger multiple jobs

Currently, only the first matching job will be triggered, then the message deleted and other matching jobs are not even looked at.

The plugin should trigger ALL jobs on an SQS message that matches the subscriptions.

Documentation incomplete: SQS access requires also sqs:GetQueueAttributes

I configured my user with an IAM policy allowing only the following actions:

sqs:ReceiveMessage
sqs:ListQueues (for configure page)
sqs:DeleteMessageBatch

The "Test Access" function reported the following error:

"User not has permission sqs:ReceiveMessage"

Allow also the following actions to resolve the problem:

sqs:GetQueueAttributes

After configuring the aws-codecommit-trigger-plugin, build dose not triggered with the new commits.

Please find my configurations below,

Queue configuration :
image

Build Trigger Configuration :

image

Jenkins Logs :

Aug 14, 2018 5:26:54 PM [c.r.j.p.a.t.SQSQueueMonitorImpl][thread-000096]
WARNING: Monitor for https://sqs.eu-west-2.amazonaws.com/383325518584/aws_codecommit_queue stopped, error: java.lang.NullPointerException
at com.ribose.jenkins.plugin.awscodecommittrigger.model.entities.codecommit.Records.size(Records.java:38)
at com.ribose.jenkins.plugin.awscodecommittrigger.model.CodeCommitMessageParser.parseRecords(CodeCommitMessageParser.java:71)
at com.ribose.jenkins.plugin.awscodecommittrigger.model.CodeCommitMessageParser.parseMessage(CodeCommitMessageParser.java:61)
at com.ribose.jenkins.plugin.awscodecommittrigger.SQSTrigger.handleMessage(SQSTrigger.java:178)
at com.ribose.jenkins.plugin.awscodecommittrigger.SQSTrigger.handleMessages(SQSTrigger.java:153)
at com.ribose.jenkins.plugin.awscodecommittrigger.threading.SQSQueueMonitorImpl.notifyListeners(SQSQueueMonitorImpl.java:166)
at com.ribose.jenkins.plugin.awscodecommittrigger.threading.SQSQueueMonitorImpl.processMessages(SQSQueueMonitorImpl.java:155)
at com.ribose.jenkins.plugin.awscodecommittrigger.threading.SQSQueueMonitorImpl.run(SQSQueueMonitorImpl.java:110)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

Any idea why this issue occurs?

Builds Not Triggering

I have installed the plugin, and deployed my queues and repo's using the provided terraform modules.

aws-codecommit-trigger 2.0.5

reponame: cicd-mgmt
repo url: https://git-codecommit.us-east-1.amazonaws.com/v1/repos/cicd-mgmt
eventSourceARN: arn:aws:codecommit:us-east-1:178164978985:cicd-mgmt

This is from a test Message.

[DEBUG] Parse and do match against events, message: {"Records":[{"awsRegion":"us-east-1","codecommit":{"references":[{"commit":"c013644482f36464045f706bf13be5ed512c326f","ref":"refs/heads/master"}]},"customData":"","eventId":"42b3f81f-6e9a-4385-9c86-2d645a9b8c36","eventName":"TriggerEventTest","eventPartNumber":1,"eventSource":"aws:codecommit","eventSourceARN":"arn:aws:codecommit:us-east-1:178164978985:cicd-mgmt","eventTime":"2018-10-04T14:31:25.717+0000","eventTotalParts":1,"eventTriggerConfigId":"42b3f81f-6e9a-4385-9c86-2d645a9b8c36","eventTriggerName":"notifications","eventVersion":"1.0","userIdentityARN":"arn:aws:sts::178164978985:assumed-role/SAML-CICD-Administrator/jseiser"}]}
Oct 04, 2018 2:32:55 PM CONFIG [c.r.j.p.a.m.CodeCommitMessageParser][thread-00012E] 
[DEBUG] Parse message null
Oct 04, 2018 2:32:55 PM WARNING [c.r.j.p.a.m.CodeCommitMessageParser][thread-00012E] 
Message contains no text
Oct 04, 2018 2:32:55 PM CONFIG [c.r.j.p.a.m.AndEventTriggerMatcher][thread-00012E] 
[DEBUG] Test if any event not match using c.r.j.p.a.m.i.ScmJobEventTriggerMatcher
Oct 04, 2018 2:32:55 PM CONFIG [c.r.j.p.a.m.i.ScmJobEventTriggerMatcher][thread-00012E][job-cicd_cicd-mgmt] 
[DEBUG] Events size: 0, SCMs size: 1
Oct 04, 2018 2:32:55 PM CONFIG [c.r.j.p.a.m.i.ScmJobEventTriggerMatcher][thread-00012E][job-cicd_cicd-mgmt] 
[DEBUG] No event matched
Oct 04, 2018 2:32:55 PM CONFIG [c.r.j.p.a.m.EventTriggerMatcherImpl][thread-00012E][job-cicd_cicd-mgmt] 
[DEBUG] Finally, events match status is false
Oct 04, 2018 2:32:55 PM INFO [c.r.j.p.a.SQSTrigger][thread-00012E][job-cicd_cicd-mgmt] 
Any event matched? false. Message: null
Oct 04, 2018 2:32:55 PM CONFIG [c.r.j.p.a.t.SQSQueueMonitorImpl][thread-00012E] 
[DEBUG] Received 1 messages, proceed 0 messages
Oct 04, 2018 2:32:55 PM CONFIG [c.r.j.p.a.n.SQSChannelImpl][thread-00012E] 
[DEBUG] Send request to delete messages from queue https://sqs.us-east-1.amazonaws.com/178164978985/codecommit-notifications-queue
Oct 04, 2018 2:32:55 PM CONFIG [c.r.j.p.a.n.SQSChannelImpl][thread-00012E] 
[DEBUG] Delete 1 message(s) (0 failed) from https://sqs.us-east-1.amazonaws.com/178164978985/codecommit-notifications-queue

This is from a git push

[DEBUG] Start monitor for https://sqs.us-east-1.amazonaws.com/178164978985/codecommit-notifications-queue
Oct 04, 2018 3:24:47 PM CONFIG [c.r.j.p.a.n.SQSChannelImpl][thread-00012E] 
[DEBUG] Star polling messages
Oct 04, 2018 3:24:47 PM CONFIG [c.r.j.p.a.n.SQSChannelImpl][thread-00012E] 
[DEBUG] Requests count 1658 for https://sqs.us-east-1.amazonaws.com/178164978985/codecommit-notifications-queue
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.n.SQSChannelImpl][thread-00012E] 
[DEBUG] Send request to receive messages from queue https://sqs.us-east-1.amazonaws.com/178164978985/codecommit-notifications-queue
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.SQSTrigger][thread-00012E][job-cicd_cicd-mgmt] 
[DEBUG] Parse and do match against events, message: {"Records":[{"awsRegion":"us-east-1","codecommit":{"references":[{"commit":"ee36dc002055a40d9660b2bb19fd8d6ef2d77cd0","ref":"refs/heads/master"}]},"customData":"","eventId":"aa9a9713-ca98-476e-ba25-2bc9938c574b","eventName":"ReferenceChanges","eventPartNumber":1,"eventSource":"aws:codecommit","eventSourceARN":"arn:aws:codecommit:us-east-1:178164978985:cicd-mgmt","eventTime":"2018-10-04T15:23:22.589+0000","eventTotalParts":1,"eventTriggerConfigId":"fc39fcfe-39d6-4634-a51c-f6139d32549d","eventTriggerName":"notifications","eventVersion":"1.0","userIdentityARN":"arn:aws:sts::178164978985:assumed-role/role_idauto_assume_cicd/cicd-mfa-session"}]}
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.m.CodeCommitMessageParser][thread-00012E] 
[DEBUG] Parse message null
Oct 04, 2018 3:24:52 PM WARNING [c.r.j.p.a.m.CodeCommitMessageParser][thread-00012E] 
Message contains no text
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.m.AndEventTriggerMatcher][thread-00012E] 
[DEBUG] Test if any event not match using c.r.j.p.a.m.i.ScmJobEventTriggerMatcher
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.m.i.ScmJobEventTriggerMatcher][thread-00012E][job-cicd_cicd-mgmt] 
[DEBUG] Events size: 0, SCMs size: 1
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.m.i.ScmJobEventTriggerMatcher][thread-00012E][job-cicd_cicd-mgmt] 
[DEBUG] No event matched
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.m.EventTriggerMatcherImpl][thread-00012E][job-cicd_cicd-mgmt] 
[DEBUG] Finally, events match status is false
Oct 04, 2018 3:24:52 PM INFO [c.r.j.p.a.SQSTrigger][thread-00012E][job-cicd_cicd-mgmt] 
Any event matched? false. Message: null
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.t.SQSQueueMonitorImpl][thread-00012E] 
[DEBUG] Received 1 messages, proceed 0 messages
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.n.SQSChannelImpl][thread-00012E] 
[DEBUG] Send request to delete messages from queue https://sqs.us-east-1.amazonaws.com/178164978985/codecommit-notifications-queue
Oct 04, 2018 3:24:52 PM CONFIG [c.r.j.p.a.n.SQSChannelImpl][thread-00012E] 
[DEBUG] Delete 1 message(s) (0 failed) from https://sqs.us-east-1.amazonaws.com/178164978985/codecommit-notifications-queue

Can't list aws queues

I'm having an issue using aws-codecommit-trigger-plugin. I'm following the instructions in the README to configure a queue, however when I open the Configure System menu in jenkins, jenkins presents me the following stack trace: stack trace gist, in the AWS Code Commit Trigger Plugin section.

Currently I have these plugins installed:

Display URL API (display-url-api): 2.0
Gradle Plugin (gradle): 1.27.1
Pipeline: Nodes and Processes (workflow-durable-task-step): 2.14
JUnit Plugin (junit): 1.21
Subversion Plug-in (subversion): 2.9
Git plugin (git): 3.5.1
Pipeline: API (workflow-api): 2.20
Folders Plugin (cloudbees-folder): 6.1.2
JavaScript GUI Lib: Moment.js bundle plugin (momentjs): 1.1.1
Jackson 2 API Plugin (jackson2-api): 2.7.3
Script Security Plugin (script-security): 1.33
Branch API Plugin (branch-api): 2.0.11
Pipeline: Basic Steps (workflow-basic-steps): 2.6
AWS CodeCommit Trigger Plugin (aws-codecommit-trigger): 1.13
Locale plugin (locale): 1.2
Docker Commons Plugin (docker-commons): 1.8
Matrix Project Plugin (matrix-project): 1.11
Resource Disposer Plugin (resource-disposer): 0.7
Timestamper (timestamper): 1.8.8
GitHub plugin (github): 1.28.0
Mailer Plugin (mailer): 1.20
Pipeline: Job (workflow-job): 2.14.1
Email Extension Plugin (email-ext): 2.58
Authentication Tokens API Plugin (authentication-tokens): 1.3
Structs Plugin (structs): 1.10
Pipeline: Model Definition (pipeline-model-definition): 1.1.9
Pipeline: Input Step (pipeline-input-step): 2.8
SSH Credentials Plugin (ssh-credentials): 1.13
Javadoc Plugin (javadoc): 1.4
JavaScript GUI Lib: jQuery bundles (jQuery and jQuery UI) plugin (jquery-detached): 1.2.1
OWASP Markup Formatter Plugin (antisamy-markup-formatter): 1.5
Pipeline: Declarative Agent API (pipeline-model-declarative-agent): 1.1.1
Pipeline: Groovy (workflow-cps): 2.39
Pipeline (workflow-aggregator): 2.5
Pipeline: Declarative Extension Points API (pipeline-model-extensions): 1.1.9
GitHub Branch Source Plugin (github-branch-source): 2.2.3
Pipeline: Shared Groovy Libraries (workflow-cps-global-lib): 2.8
GitHub API Plugin (github-api): 1.86
JavaScript GUI Lib: Handlebars bundle plugin (handlebars): 1.1.1
Pipeline: REST API Plugin (pipeline-rest-api): 2.8
Pipeline: Milestone Step (pipeline-milestone-step): 1.3.1
SSH Slaves plugin (ssh-slaves): 1.21
Pipeline: Build Step (pipeline-build-step): 2.5.1
Pipeline: Stage Step (pipeline-stage-step): 2.2
Pipeline Graph Analysis Plugin (pipeline-graph-analysis): 1.5
Matrix Authorization Strategy Plugin (matrix-auth): 1.7
Credentials Binding Plugin (credentials-binding): 1.13
Ant Plugin (ant): 1.7
Durable Task Plugin (durable-task): 1.14
JavaScript GUI Lib: ACE Editor bundle plugin (ace-editor): 1.1
GIT server Plugin (git-server): 1.7
PAM Authentication plugin (pam-auth): 1.3
Pipeline: Multibranch (workflow-multibranch): 2.16
Pipeline: Supporting APIs (workflow-support): 2.14
bouncycastle API Plugin (bouncycastle-api): 2.16.2
LDAP Plugin (ldap): 1.16
Credentials Plugin (credentials): 2.1.14
Pipeline: Stage View Plugin (pipeline-stage-view): 2.8
build timeout plugin (build-timeout): 1.18
Jackson Databind Plugin (jackson-databind): 1.2
Pipeline: Step API (workflow-step-api): 2.12
Windows Slaves Plugin (windows-slaves): 1.3.1
SCM API Plugin (scm-api): 2.2.1
Pipeline: Stage Tags Metadata (pipeline-stage-tags-metadata): 1.1.9
Docker Pipeline (docker-workflow): 1.12
Token Macro Plugin (token-macro): 2.2
Pipeline: GitHub Groovy Libraries (pipeline-github-lib): 1.0
Pipeline: SCM Step (workflow-scm-step): 2.6
MapDB API Plugin (mapdb-api): 1.0.9.0
Git client plugin (git-client): 2.5.0
External Monitor Job Type Plugin (external-monitor-job): 1.7
Pipeline: Model API (pipeline-model-api): 1.1.9
Plain Credentials Plugin (plain-credentials): 1.4
Amazon Web Services SDK (aws-java-sdk): 1.11.119
Workspace Cleanup Plugin (ws-cleanup): 0.34
Icon Shim Plugin (icon-shim): 2.0.3
Multiple SCMs plugin (multiple-scms): 0.6

Note: I can add the Access Key ID and the Secret Access Key, but the plugin is already broken in the momento that I open the Configure System page and I can't list my queues.

Automated builds occasionally do not trigger?

From: @Kamidu
#58 (comment)

I have noticed time to time the automated builds doesn't trigger as expected. That can be recovered executing a build manually. Then the automation will resume for days as expected. There were one or two times during the last months where we had to trigger a manual job to resume the automation. Any idea what can cause this?

Should work with Pipeline Jobs

Currently on pipeline jobs the line "Build when a Aws Code Commit SNS is published to an Amazon SQS queue" is not present.

It will be very useful to use this plugin on pipeline jobs too.

Correct description of trigger in project page

project-trigger

The description on the checkbox line should be:
"Build when a CodeCommit repository is updated and notifies a SQS queue."

Then:
"This job will be triggered whenever the SQS queue receives an SNS message that any of the following CodeCommit repositories are updated"

Integration test updates

  • Using the same SQS queue for multiple CodeCommit repositories
  • Update Integration test for multi projects

java.lang.NoClassDefFoundError:

Jenkins ver. 2.150.2

Started getting the below errors in my logs.

Error while serving https://jenkins.cicd.domain.com/descriptorByName/com.ribose.jenkins.plugin.awscodecommittrigger.SQSTriggerQueue/fillUrlItems
java.lang.NoClassDefFoundError: Could not initialize class com.amazonaws.auth.internal.AWS4SignerUtils
	at com.amazonaws.auth.internal.AWS4SignerRequestParams.<init>(AWS4SignerRequestParams.java:99)
	at com.amazonaws.auth.AWS4Signer.sign(AWS4Signer.java:225)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1209)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1055)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:743)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:717)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:699)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:667)
	at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:649)
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:513)
	at com.amazonaws.services.sqs.AmazonSQSClient.doInvoke(AmazonSQSClient.java:1740)
	at com.amazonaws.services.sqs.AmazonSQSClient.invoke(AmazonSQSClient.java:1716)
	at com.amazonaws.services.sqs.AmazonSQSClient.executeListQueues(AmazonSQSClient.java:1185)
	at com.amazonaws.services.sqs.AmazonSQSClient.listQueues(AmazonSQSClient.java:1162)
	at com.amazonaws.services.sqs.AmazonSQSClient.listQueues(AmazonSQSClient.java:1197)
	at com.amazonaws.services.sqs.buffered.AmazonSQSBufferedAsyncClient.listQueues(AmazonSQSBufferedAsyncClient.java:350)
	at com.ribose.jenkins.plugin.awscodecommittrigger.SQSTriggerQueue$DescriptorImpl.doFillUrlItems(SQSTriggerQueue.java:380)
	at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627)
	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:396)
Caused: java.lang.reflect.InvocationTargetException
	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:400)
	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:408)
	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:212)
	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:145)
	at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:537)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:739)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:870)
	at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:282)
	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:739)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:870)
	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668)
	at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
	at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:243)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:128)
	at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
	at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:99)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
	at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
	at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
	at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
	at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
	at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1642)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1340)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1242)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:503)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:748)

check existing IAM role permissions rather than enforcing the use of an AWS key ID and secret

I have a Jenkins EC2 instance with an IAM role attached to it that has full SQS access. However the CodeCommit Trigger Plugin is forcing me to specify an AWS Key ID and Secret to authenticate against the AWS SQS that I set up. It would be nice if the plugin could somehow check the existing IAM role permissions rather than forcing me to use an AWS key ID and secret when the actual instance already has permissions to access SQS.

image

AWS Code Commit Trigger SQS Plugin section does not appear in Configure System

After installing the aws-codecommit-trigger-plugin there is no configuration options that appear under Configure System, where I would expect to enter the Queue anme, Access key ID and Secret Key information.

My environment:

AWS EC2 t2.micro instance built from us-west-2 ami-6e1a0117 ubuntu
Linux jenkins 4.4.0-1022-aws #31-Ubuntu SMP Tue Jun 27 11:27:55 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Fresh first-time jenkins 2.76 installed with "apt-get install jenkins"
Only plug-in added after fresh install: aws-codecommit-trigger-plugin version 1.15

I tried several things to get it to work:

  • Upgraded jenkins package to 2.77 with "apt-get install jenkins" tonight
  • Installed additional Plug-ins:
    o Amazon S3 Bucket Credentials Plugin | 0.1.1 |
    o CloudBees Amazon Web Services Credentials Plugin | 1.22 |
    o CloudBees Credentials Plugin | 3.3 |

None of those steps enabled me to see the SQS Queue config options in Configure System. Just to make sure I wasn't having a general Jenkins plug-ins problem, I also installed the older AWS SQS Build Trigger Plugin version 1.005, and I WAS indeed able to see its similar configuration options now appearing in the Configure System screen under a section called "Configuration of Amazon SQS queues". So I seem to have proven that my installation is valid and other plug-ins are able to present their configuration sections under Configure System.

Please let me know if I can take any additional configuration or troubleshooting steps to assist you, I am happy to do so. This was all set up in an automated fashion using packer and terraform so I can easily re-create the environment. I will end my post with my packer configuration used to build my ami. Thank you very much for your assistance.

{
    "builders": [{
        "type": "amazon-ebs",
        "access_key": "",
        "secret_key": "",
        "region": "us-west-2",
        "source_ami": "ami-6e1a0117",
        "instance_type": "t2.micro",
        "ssh_username": "ubuntu",
        "ami_name": "packer-jenkins {{timestamp}}"
    }],
    "provisioners": [{
        "type": "shell",
        "inline": [
            "sudo apt-get update",
            "sudo apt-get install -y openjdk-8-jdk",
            "wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -",
            "sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'",
            "sudo apt-get update",
            "sudo apt-get install -y jenkins"
        ]
    }]
}

Suddenly the plugin stop working

Hi there,

This plugin used to work very well for me. thanks for that.

But somehow, it stops working. When I take a look at the log, it reported:
Any event matched? false. Message: 2f6a712a-6490-5245-bf60-239f7bc4b89f

I found that the message from SQS was delivered. But it cannot be matched in the configured jobs. This happened after I upgraded Jenkins to 2.95 or later.

Can you help?

rgds,
Chris

Log output review

Sample log messages for one SQS like bellow, INFO level is enabled by default
Which log entries are redundant?

Aug 10, 2017 12:27:59 PM [log] 
INFO: [c.r.j.p.a.SQSTrigger][thread-0000B1] [job-testjenkins-pipeline] Parse and do match against events, message: {
  "Type" : "Notification",
  "MessageId" : "179b21d9-b49d-5d3d-9d22-73dc458228b2",
  "TopicArn" : "arn:aws:sns:us-west-2:239062223385:testjenkins-topic",
  "Subject" : "UPDATE: AWS CodeCommit us-west-2 push: testjenkins2",
  "Message" : "{\"Records\":[{\"awsRegion\":\"us-west-2\",\"codecommit\":{\"references\":[{\"commit\":\"95a0dc394aa840c441d0734fb6f0307e42ebebec\",\"ref\":\"refs/heads/master\"}]},\"eventId\":\"c0646674-cd6a-4095-baea-5888c6a4d829\",\"eventName\":\"ReferenceChanges\",\"eventPartNumber\":1,\"eventSource\":\"aws:codecommit\",\"eventSourceARN\":\"arn:aws:codecommit:us-west-2:239062223385:testjenkins2\",\"eventTime\":\"2017-08-10T05:27:59.217+0000\",\"eventTotalParts\":1,\"eventTriggerConfigId\":\"98c0360d-86ef-495d-a91b-21f6f5294ff7\",\"eventTriggerName\":\"All\",\"eventVersion\":\"1.0\",\"userIdentityARN\":\"arn:aws:iam::239062223385:user/ext-phuong-huynh\"}]}",
  "Timestamp" : "2017-08-10T05:27:59.274Z",
  "SignatureVersion" : "1",
  "Signature" : "DzYsyV6BHaQZei0jJzrCMq4zwAWIjbY3x7qGSSzEm+UiRItMR+fw3nOxkIyvj4zOUyD3HRrydz2SA1DGaOvAoyQKtF3xwEBD/S8QZe/ZcgQ0zkcoNNBOevzRHCPVNCqqcq9XADHys0whrOr7Vl78Pt/hqMd4XxsGP9UFj/GK5TgiQ0BYU6pF21ylsBl7b6k9Sk2k7BKhRVYb33rTY9MGQzZrJmTmrW3ysWUiDvpHz2yvA/l3adATOzboyn+Kxltepn40Yn4HE7ic7/JhaMyhaxIMnuUUhsINbLX6oe5QM6hXL9QlPouIm1mR89DH7i0dDMvm0qMGZlTxnzHFCMSOvw==",
  "SigningCertURL" : "https://sns.us-west-2.amazonaws.com/SimpleNotificationService-b95095beb82e8f6a046b3aafc7f4149a.pem",
  "UnsubscribeURL" : "https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:239062223385:testjenkins-topic:cbae7177-c37e-411e-a5e8-ee9a4b871ff8"
}
Aug 10, 2017 12:27:59 PM [log] 
INFO: [c.r.j.p.a.m.i.ScmJobEventTriggerMatcher][thread-0000B1] [job-testjenkins-pipeline] Hurray! Event arn:aws:codecommit:us-west-2:239062223385:testjenkins2 matched SCM git https://git-codecommit.us-west-2.amazonaws.com/v1/repos/testjenkins2
Aug 10, 2017 12:27:59 PM [log] 
INFO: [c.r.j.p.a.m.i.SubscribeBranchEventTriggerMatcher][thread-0000B1] [job-testjenkins-pipeline] Hurray! Event arn:aws:codecommit:us-west-2:239062223385:testjenkins2 matched branch master
Aug 10, 2017 12:27:59 PM [log] 
INFO: [c.r.j.p.a.m.AndEventTriggerMatcher][thread-0000B1] OK! At least one event matched
Aug 10, 2017 12:27:59 PM [log] 
INFO: [c.r.j.p.a.m.EventTriggerMatcherImpl][thread-0000B1] [job-testjenkins-pipeline] Finally, events match status is true
Aug 10, 2017 12:27:59 PM [log] 
INFO: [c.r.j.p.a.SQSTrigger][thread-0000B1] [job-testjenkins-pipeline] Hurray! Execute it
Aug 10, 2017 12:27:59 PM [log] 
INFO: Try to trigger the build for message: 179b21d9-b49d-5d3d-9d22-73dc458228b2
Aug 10, 2017 12:28:00 PM [log] 
INFO: [c.r.j.p.a.n.SQSChannelImpl][thread-0000B1] Delete 1 message(s) (0 failed) from https://sqs.us-west-2.amazonaws.com/239062223385/testjenkinssqs
Aug 10, 2017 12:28:02 PM [log] 
INFO: Any code changes found in SCM? true
Aug 10, 2017 12:28:02 PM [log] 
INFO: Finally! The build is scheduled? true

Does not trigger build?

Hi @phuonghuynh

After creating a new pipeline job, the plugin does not seem to be receiving any events from AWS codecommit (checked via Jenkins's "All Jenkins Log").

Jenkins version: 2.103

Any ideas why? Thanks!

CodeCommit username in BuildCause shortDescription

It would be great if the username that triggered the notification in code commit was part of the BuildCause shortDescription. Right now, it contains the SQS message GUID which isn't useful for anyone no the Jenkins side.

This should be doable as the arn:Username is included in the message body of the SQS notification.

Otherwise, great plugin. It is working seamlessly.

When configured a pipeline with the pug-in always provides "Cancel the build since no change found"

I have created a pipeline in Jenkins which is listing to a queue. Other than the initial commit all the other commit triggers are ignored with the log "INFO: Cancel the build since no change found".

Please find the SQS Activity Log below,

Sep 04, 2018 12:16:34 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000BA]
INFO: Try to trigger the build for message: d35280d6-ee9f-5faf-8548-d4dea12d490e
no previous build to compare to
Sep 04, 2018 12:16:34 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000BA]
INFO: The build is scheduled? true by Message: d35280d6-ee9f-5faf-8548-d4dea12d490e
Sep 04, 2018 12:27:04 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000B6]
INFO: Try to trigger the build for message: f9d43617-0bc1-520e-9540-621f59e931ae
Sep 04, 2018 12:27:04 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000B6]
INFO: Cancel the build since no change found
Sep 04, 2018 2:18:07 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000B4]
INFO: Try to trigger the build for message: 29b3b5ff-35aa-55d6-92de-e1f75985a676
Sep 04, 2018 2:18:07 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000B4]
INFO: Cancel the build since no change found
Sep 04, 2018 2:24:15 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000BA]
INFO: Try to trigger the build for message: 902b3ff4-6b57-5289-bd42-6bfc06c89856
Sep 04, 2018 2:24:15 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000BA]
INFO: Cancel the build since no change found
Sep 04, 2018 2:30:42 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000B4]
INFO: Try to trigger the build for message: 0a9eeeb2-e075-5aef-8717-baba8f57e90a
Sep 04, 2018 2:30:42 PM [c.r.j.p.a.SQSTriggerBuilder][thread-0000B4]
INFO: Cancel the build since no change found

Am I doing something wrong?

Thanks and Best Regards,

User not has permission sqs:DeleteMessageBatch

Obviously your IAM user also needs the not mentioned sqs:DeleteMessage permission to get it work. Otherwise you will get the wrong error message "User not has permission sqs:DeleteMessageBatch" on test.
This is just a hint.

Unable to trigger job

0005B0 Body of the message:
{ "Records":[
  {
    "awsRegion":"us-east-1",
    "codecommit":{
      "references":[{"commit":"7f11f3be165b50cedf920cdb804709af84e621dd","ref":"refs/heads/master"}]
    },
    "customData":"",
    "eventId":"e02cd013-7731-413f-a1de-a3058fffc1f2",
    "eventName":"ReferenceChanges",
    "eventPartNumber":1,
    "eventSource":"aws:codecommit",
    "eventSourceARN":"arn:aws:codecommit:us-east-1:MYACCOUNTID:MYREPONAME",
    "eventTime":"2017-07-19T06:30:53.404+0000",
    "eventTotalParts":1,
    "eventTriggerConfigId":"e47f9b31-1347-436c-af84-f0bd89e8fdaf",
    "eventTriggerName":"notifications",
    "eventVersion":"1.0",
    "userIdentityARN":"arn:aws:iam::MYACCOUNTID:user/system/MYUSER"
  }]
}

Jul 19, 2017 2:37:23 PM INFO com.ribose.jenkins.plugin.awscodecommittrigger.logging.Log write
0005B0 Job 'MYJOBNAME': test if any event not match by matcher 'ScmJobEventTriggerMatcher'...
Jul 19, 2017 2:37:23 PM INFO com.ribose.jenkins.plugin.awscodecommittrigger.logging.Log write
0005B0 Event(s) did not match job 'MYJOBNAME'
Jul 19, 2017 2:37:23 PM INFO com.ribose.jenkins.plugin.awscodecommittrigger.logging.Log write
0005B0 Job 'MYJOBNAME' matches='false' event(s), ignore message if matches='false'

MYJOBNAME is configured to subscribe to:

  • branch: tried master and refs/heads/master but both don't work

Remove Trigger field subscribed_branch

@ronaldtse The plugin requires SCM to be configured (Git/MultiSCM only for now), we can read value of branches from Job SCM configuration and use that value to match against CodeCommit Message.
So could we remove this field subscribed_branch?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.