-
Notifications
You must be signed in to change notification settings - Fork 425
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
Add AWS CodeCommit examples for push request and also README to configure AWS CodeCommit #1619
Merged
tekton-robot
merged 1 commit into
tektoncd:main
from
savitaashture:awscodecommitpush-example
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
## AWS CodeCommit push EventListener | ||
|
||
Creates an EventListener that listens for AWS CodeCommit push request. | ||
|
||
### Pre-requisites | ||
|
||
1. Enable [debug logs for Triggers eventlistener](https://github.com/tektoncd/triggers/blob/main/docs/troubleshooting.md#configuring-debug-logging-for-eventlisteners) (This will be helpful for getting subscription URL which you do in later section) | ||
2. Should have access to AWS | ||
1. Should have URL accessible publicly to configure in webhook | ||
|
||
### Steps to try: | ||
|
||
1. To create the AWS CodeCommit push eventlistener and all related resources, run: | ||
|
||
```bash | ||
kubectl apply -f . | ||
``` | ||
|
||
1. To get the eventlistener URL, run: | ||
|
||
```bash | ||
kubectl get el | ||
``` | ||
|
||
### Steps for AWS CodeCommit configuration | ||
|
||
1. Login to aws console | ||
2. Search for CodeCommit aws service | ||
3. On left side of the panel select **Source** -> **Repositories** -> **Create repository** | ||
 | ||
4. Once after successful creation of repository follow below steps to add Triggers | ||
5. a) Create SNS (Simple Notification Service) | ||
|
||
ai) Search for sns service | ||
 | ||
|
||
aii) Click on Create topic | ||
|
||
 | ||
|
||
aiii) Click on **Create subscription** | ||
|
||
1. | ||
 | ||
2. | ||
 | ||
3. Once **Create subscription** is success click on **Request confirmation** | ||
 | ||
a. Then go to eventlistener pod | ||
|
||
i. oc logs -f <pod-name> | ||
|
||
ii. Search for SubscribeURL and copy value | ||
|
||
"SubscribeURL\" : \"https://sns.us-east-2.amazonaws.com/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-east-2:361754793035:demo-acc-tekton&Token=2336412f37fb687f5d51e6e2425c464de257e9a5924e2fd4cf343ac0f1dcdb40cc7dad021f86dcf2af98fbabf59b6314b975e5d5bfc673924522ab99cb9b45b824a2795d81328e045db0148571c0ba451648f60157690c2c377eb41f58a7d663c15a36654beda27c295f9f90cc8a0f46096aea96a40f9c4ca0b1ec1092e32116\" | ||
|
||
4. Click on **Confirm subscription** | ||
|
||
 | ||
5. Make sure Status as **Confirmed** | ||
|
||
 | ||
|
||
aiv) Now go back to CodeCommit page | ||
|
||
**!!!!!Done with SNS configuration go back to codecommit flow!!!!!** | ||
|
||
b) **Source** -> **Repositories** and select demo-acc-tekton | ||
 | ||
|
||
c) Go to **Settings -> Triggers** then click on **Create trigger** | ||
 | ||
|
||
d) While creating trigger give trigger name, set the events to All repository events, Service to use AWS SNS, and finally, choose the previously configured SNS topic | ||
 | ||
e) Once the **Create trigger** is successful go back to Repository and send Push Request. | ||
|
||
**!!!!!Done with CodeCommit configuration!!!!!** | ||
|
||
f) You should see a new TaskRun that got created: | ||
|
||
```bash | ||
kubectl get taskruns | grep aws-codecommit-push-listener-run- | ||
``` |
65 changes: 65 additions & 0 deletions
65
examples/v1beta1/awscodecommit/push/awscodecommit-push-listener.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
apiVersion: triggers.tekton.dev/v1beta1 | ||
kind: EventListener | ||
metadata: | ||
name: aws-codecommit-push | ||
spec: | ||
triggers: | ||
- name: aws-codecommit-push | ||
bindings: | ||
- ref: aws-codecommit-push-binding | ||
template: | ||
ref: aws-codecommit-push-template | ||
resources: | ||
kubernetesResource: | ||
spec: | ||
template: | ||
spec: | ||
serviceAccountName: tekton-triggers-example-sa | ||
containers: | ||
- resources: | ||
requests: | ||
memory: "64Mi" | ||
cpu: "250m" | ||
limits: | ||
memory: "128Mi" | ||
cpu: "500m" | ||
|
||
--- | ||
apiVersion: triggers.tekton.dev/v1beta1 | ||
kind: TriggerBinding | ||
metadata: | ||
name: aws-codecommit-push-binding | ||
spec: | ||
params: | ||
- name: aws-codecommit-awsregion | ||
value: $(body.Records[0].awsRegion) | ||
- name: aws-codecommit-commit | ||
value: $(body.Records[0].codecommit.references[0].commit) | ||
- name: aws-codecommit-branch | ||
value: $(body.Records[0].codecommit.references[0].ref) | ||
- name: aws-codecommit-useridentity | ||
value: $(body.Records[0].userIdentityARN) | ||
--- | ||
apiVersion: triggers.tekton.dev/v1beta1 | ||
kind: TriggerTemplate | ||
metadata: | ||
name: aws-codecommit-push-template | ||
spec: | ||
params: | ||
- name: aws-codecommit-awsregion | ||
- name: aws-codecommit-commit | ||
- name: aws-codecommit-branch | ||
- name: aws-codecommit-useridentity | ||
resourcetemplates: | ||
- apiVersion: tekton.dev/v1beta1 | ||
kind: TaskRun | ||
metadata: | ||
generateName: aws-codecommit-push-listener-run- | ||
spec: | ||
taskSpec: | ||
steps: | ||
- image: ubuntu | ||
script: | | ||
#! /bin/bash | ||
echo "aws region is : $(tt.params.aws-codecommit-awsregion). commit is $(tt.params.aws-codecommit-commit). | ||
branch name is : $(tt.params.aws-codecommit-branch). pusher name is $(tt.params.aws-codecommit-useridentity)." |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+257 KB
examples/v1beta1/awscodecommit/push/images/createsubscriptionsuccess.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../rbac.yaml |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking: is this an active subscription? we may want to change it to something fake
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It no more works
So is that okay if i keep it as it is ?