This file contains hidden or 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
| - name: Schedule Cleanup | |
| run: | | |
| aws events put-rule \ | |
| --name "CleanupBranch-${{ github.ref_name }}" \ | |
| --schedule-expression "rate(6 hours)" # Ajuste o tempo conforme necessário | |
| aws events put-targets \ | |
| --rule "CleanupBranch-${{ github.ref_name }}" \ | |
| --targets "Id"="1","Arn"="arn:aws:lambda:us-east-1:123456789012:function:YourCleanupFunction","Input"="{\"branch_name\":\"${{ github.ref_name }}\",\"cluster_name\":\"my-cluster-name\",\"listener_arn\":\"arn:aws:elasticloadbalancing:us-east-1:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/7c7a56b0\"}" |
This file contains hidden or 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
| { | |
| "source": ["custom.branchDeploy"], | |
| "detail-type": ["ECS Deploy Expiration"], | |
| "resources": [], | |
| "detail": { | |
| "branch_name": "feature-branch", | |
| "cluster_name": "my-cluster-name", | |
| "listener_arn": "arn:aws:elasticloadbalancing:us-east-1:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/7c7a56b0" | |
| } | |
| } |
This file contains hidden or 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
| import boto3 | |
| ecs_client = boto3.client('ecs') | |
| elbv2_client = boto3.client('elbv2') | |
| def lambda_handler(event, context): | |
| branch_name = event['branch_name'] | |
| cluster_name = event['cluster_name'] | |
| service_name = f"my-service-{branch_name}" | |
| listener_arn = event['listener_arn'] |
This file contains hidden or 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
| name: Deploy to ECS | |
| on: | |
| push: | |
| branches: | |
| - '*' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest |
This file contains hidden or 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
| #!/bin/sh | |
| # copy the “prepare commit msg” script to the proper hooks folder and fix the permission on that folder | |
| # just run the script and on the next commit you will see the jira prefix | |
| curl https://gist.githubusercontent.com/trylix/38e43750deedf3d83f13e6392904aed1/raw/0658f176f79d3b57e22141d5fd50681ff5b1498d/prepare-commit-msg.sh > .git/hooks/prepare-commit-msg && chmod u+x .git/hooks/prepare-commit-msg |
This file contains hidden or 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
| #!/bin/sh | |
| # check if commit is merge commit or a commit ammend | |
| if [ $2 = "merge" ] || [ $2 = "commit" ]; then | |
| exit | |
| fi | |
| ISSUE_KEY=`git branch | grep -o "\* \(.*/\)*[A-Z]\{2,\}-[0-9]\+" | grep -o "[A-Z]\{2,\}-[0-9]\+"` | |
| if [ $? -ne 0 ]; then | |
| # no issue key in branch, use the default message | |
| exit |
This file contains hidden or 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
| { | |
| "editor.fontFamily": "Fira Code", | |
| "editor.fontSize": 14, | |
| "editor.fontLigatures": true, | |
| "editor.fontWeight": 300, | |
| "editor.lineHeight": 28, | |
| "editor.suggestSelection": "first", | |
| "editor.parameterHints.enabled": false, | |
| "editor.formatOnPaste": true, | |
| "editor.formatOnSave": true, |