{"id":18217269,"url":"https://github.com/hendricjabs/aws-gitlab-connector","last_synced_at":"2025-04-02T21:30:54.676Z","repository":{"id":43476788,"uuid":"155578914","full_name":"hendricjabs/aws-gitlab-connector","owner":"hendricjabs","description":"A GitLab Connector to be used with AWS CodeBuild.","archived":false,"fork":false,"pushed_at":"2021-10-22T19:22:12.000Z","size":41,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T16:12:20.224Z","etag":null,"topics":["aws","aws-apigateway","aws-lambda","gitlab","gitlab-webhook"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hendricjabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-31T15:17:47.000Z","updated_at":"2023-02-02T04:25:03.000Z","dependencies_parsed_at":"2022-09-09T08:23:18.784Z","dependency_job_id":null,"html_url":"https://github.com/hendricjabs/aws-gitlab-connector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendricjabs%2Faws-gitlab-connector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendricjabs%2Faws-gitlab-connector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendricjabs%2Faws-gitlab-connector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hendricjabs%2Faws-gitlab-connector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hendricjabs","download_url":"https://codeload.github.com/hendricjabs/aws-gitlab-connector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246895643,"owners_count":20851307,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-apigateway","aws-lambda","gitlab","gitlab-webhook"],"created_at":"2024-11-03T17:04:13.272Z","updated_at":"2025-04-02T21:30:54.404Z","avatar_url":"https://github.com/hendricjabs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS GitLab Connector\n\nAWS CodeBuild/CodePipeline does not nativly support GitLab Repositories. You can only build repositories from CodeCommit, GitHub and Zip-Files stored in Amazon S3. This is a sample template for a GitLab connector for AWS CodeBuild. To use it you need to set up the Lambda endpoint as described below, add it as webhook for push-events to your GitLab repository and change your CodeBuild or CodePipeline configuration so that the destination S3-Bucket is your source of code.\n```bash\n.\n├── Makefile                    \u003c-- Make to automate build\n├── README.md                   \u003c-- This instructions file\n├── gitlab-connector            \u003c-- Source code for a lambda function\n│   ├── main.go                 \u003c-- Lambda function code\n│   ├── main_test.go            \u003c-- Test for main function\n│   ├── GitCloneAndZip.go       \u003c-- Routine for cloning and zipping repository \n│   ├── GitCloneAndZip_test.go  \u003c-- Test for cloning and zipping routine\n|   ├── Zipper.go               \u003c-- Routine for compressing bytes into a Zip-archive \n|   └── Zipper_test.go          \u003c-- Test for compressing routine\n├── template.yaml               \u003c-- SAM Template\n└── .gitignore                  \u003c-- Files to ignore by git\n```\n\n## Status\n[![Build Status](https://travis-ci.com/hendricjabs/aws-gitlab-connector.png)](https://travis-ci.org/hendricjabs/aws-gitlab-connector)\n\n## Requirements\n\n* AWS CLI already configured with Administrator permission\n* [Golang](https://golang.org)\n* [Makefile](https://wiki.ubuntuusers.de/Makefile/)\n\n## Architecture\n![Architecture](assets/architecture.png)\n\n## Setup process\n\n### Installing dependencies\n\nYou can use make to install all go dependencies or run the GO command directly.\n```bash\nmake deps\n// or\ngo get -u ./gitlab-connector/...\n```\n\n### Building\n\nGolang is a staticly compiled language, meaning that in order to run it you have to build the executeable target.\n\nYou can issue the following command in a shell to build it:\n\n```bash\nmake build\n// or \nGOOS=linux GOARCH=amd64 go build -o gitlab-connector/gitlab-connector ./gitlab-connector\n```\n\n**NOTE**: If you're not building the function on a Linux machine, you will need to specify the `GOOS` and `GOARCH` environment variables, this allows Golang to build your function for another system architecture and ensure compatability.\n\n### Local development\n\n**Invoking function locally through local API Gateway**\n\n```bash\nsam local start-api\n```\n\nIf the previous command ran successfully you should now be able to hit the following local endpoint to invoke your function `http://localhost:3000/gitlab`\n\n**SAM CLI** is used to emulate both Lambda and API Gateway locally and uses the `template.yaml` to understand how to bootstrap this environment (runtime, where the source code is, etc.) - The following excerpt is what the CLI will read in order to initialize an API and its routes:\n\n```yaml\n...\nEvents:\n    GitLab:\n        Type: Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api\n        Properties:\n            Path: /gitlab\n            Method: post\n```\n\n## Packaging and deployment\n\nTo deploy the connector you can simply use the Docker deployment.\n\nFirst you need to build the image with some parameters you should define previously.\nReplace \n* `\u003cTarget Bucket\u003e` with the S3 bucket where the CloudFormation template shall be stored.\n* `\u003cLambda Bucket\u003e` with the S3 bucket where the Lambda deployment package shall be stored.\n* `\u003cAWS Access Key\u003e` with your AWS access key (e.g. AKIAXXXXXXXXXXXXXXXQ)\n* `\u003cAWS Secret Access Key\u003e` with your AWS secret access key (e.g. NMAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXR)\n* `\u003cRegion\u003e` with the region you want to deploy the stack in\n\n```sh\nTARGET_BUCKET=\u003cTarget Bucket\u003e\nLAMBDA_BUCKET=\u003cLambda Bucket\u003e\nAWS_ACCESS_KEY=\u003cAWS Access Key\u003e\nAWS_SECRET_ACCESS_KEY=\u003cAWS Secret Access Key\u003e\nREGION=\u003cRegion\u003e\n\ndocker build \\\n    --build-arg target_bucket=$TARGET_BUCKET \\\n    --build-arg lambda_bucket=$LAMBDA_BUCKET \\\n    --build-arg aws_access_key=$AWS_ACCESS_KEY \\\n    --build-arg aws_secret_key=$AWS_SECRET_ACCESS_KEY \\ \n    --build-arg region=$REGION \\\n    -t hendricjabs/aws-gitlab-connector .\n```\n\nNow you can run the deployment process:\n```sh\ndocker run hendricjabs/aws-gitlab-connector\n```\n\nAfter deployment is complete you can run the following command to retrieve the API Gateway Endpoint URL:\n\n```bash\naws cloudformation describe-stacks \\\n    --stack-name gitlab-connector \\\n    --query 'Stacks[].Outputs'\n``` \n\n### Testing\n\nWe use `testing` package that is built-in in Golang and you can simply run the following command to run our tests:\n\n```shell\nmake test\n// or\ngo test -v ./gitlab-connector/\n```\n# Appendix\n\n### Golang installation\n\nPlease ensure Go 1.x (where 'x' is the latest version) is installed as per the instructions on the official golang website: https://golang.org/doc/install\n\n\n## Bringing to the next level\n\nHere are a few ideas that you can use to get more acquainted as to how this overall process works:\n\n* ~~Create an additional API resource for Atlassian BitBucket~~ *Now supported by AWS CodeBuild.*\n\nNext, you can use the following resources to know more about beyond hello world samples and how others structure their Serverless applications:\n\n* [AWS Serverless Application Repository](https://aws.amazon.com/serverless/serverlessrepo/)\n\n## Contribute\nI'm glad for every feedback, improvement, recommendation, pull-request, bug report and advise.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendricjabs%2Faws-gitlab-connector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhendricjabs%2Faws-gitlab-connector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhendricjabs%2Faws-gitlab-connector/lists"}