{"id":16812728,"url":"https://github.com/eddywashere/codebuilder","last_synced_at":"2025-11-03T18:20:54.961Z","repository":{"id":57202236,"uuid":"94720790","full_name":"eddywashere/codebuilder","owner":"eddywashere","description":"An AWS CodeBuild project optimized for multiple source repos \u0026 any combination of buildspec based scripts from config values","archived":false,"fork":false,"pushed_at":"2017-06-19T03:05:26.000Z","size":75,"stargazers_count":5,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T22:51:17.963Z","etag":null,"topics":["aws","aws-codebuild","aws-lambda","aws-step-function","codebuild","lambda","state-machine","stepfunctions"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddywashere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-19T00:18:08.000Z","updated_at":"2023-03-11T12:20:36.000Z","dependencies_parsed_at":"2022-09-17T15:02:24.197Z","dependency_job_id":null,"html_url":"https://github.com/eddywashere/codebuilder","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/eddywashere%2Fcodebuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddywashere%2Fcodebuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddywashere%2Fcodebuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddywashere%2Fcodebuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddywashere","download_url":"https://codeload.github.com/eddywashere/codebuilder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248327753,"owners_count":21085257,"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-codebuild","aws-lambda","aws-step-function","codebuild","lambda","state-machine","stepfunctions"],"created_at":"2024-10-13T10:23:14.105Z","updated_at":"2025-11-03T18:20:54.934Z","avatar_url":"https://github.com/eddywashere.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# codebuilder\n\nAn AWS CodeBuild project optimized for multiple source repos \u0026 any combination of buildspec based scripts from config values. This is achieved by pointing a single CodeBuild project to this projects CI tooling and moving `buildspec.yml` build phases to environment variables.\n\nInspiration:\n\n- I wanted to be able to execute longer running scripts (lambda limits \u003c/3)\n- I wanted to [avoid](https://blog.travis-ci.com/2017-05-08-security-advisory) having AWS credentials on third party services\n- I also wanted something like deploybot.com, or a chatbot for running one off scripts like publishing npm packages\n- I want a cheaper alternative to paid versions of circle/travis ci, and code pipeline didn't work out for me\n\n## AWS Services Overview\n\n- CodeBuild - we'll utilize this service for it's per-minute based pricing \u003c3\n- S3 - A single bucket to host the CI tooling scripts that we'll point the CodeBuild project\n- Lambda - A single lambda to handle the Step Function State transitions\n- Step Function State Machine - Creates a CodeBuild execution, waits for completion, logs completion status\n\n![state-machine-preview](./state-machine-preview.png)\n\n## Getting started\n\n### Provision AWS resources with Terraform\n\nRead through `terraform/main.tf` and update variable names for your environment and remote state s3 bucket.\n\nCreate the s3 bucket for terraform remote state:\n\n```\nBUCKET=codebuilder-tf npm run tf:create:remote\n```\n\nInitialize the terraform state\n\n```\nnpm run tf:init\n```\n\nRun `terraform plan` to see what resources will be provisioned\n\n```\nnpm run tf:plan\n```\n\nIf that looks right, run `terraform apply` to create the resources in AWS\n\n```\nnpm run tf:apply\n```\n\n### Upload CI tooling to S3\n\nReplace bucket name with the bucket created via terraform.\n\n```\nBUCKET=codebuilder-tools npm run upload-tools\n```\n\n### Deploy Lambda\n\nReplace the placeholder lambda function code that terraform uploaded by deploying the new code with claudia.js.\n\n```\nnpm run claudia:update\n```\n\n### Run an example codebuilder step function\n\nThis example will clone, test, build, and deploy a [static react site](https://github.com/eddywashere/sample-create-react-app) to s3.\n\nFirst create a bucket and configure it for static site hosting. (For convenience I've added those scripts to this project)\n\n```\nBUCKET=sample-create-react-app npm run s3:create-bucket\nBUCKET=sample-create-react-app npm run s3:configure-bucket\n```\n\nStart your first codebuilder state function by running:\n\n```\nnpm run codebuilder\n```\n\n## codebuilder config\n\nThe following config variables determine which project and branch to build\n\n```\nCI_REPO\n# example: CI_REPO=eddywashere/sample-create-react-app\n\nCI_COMMIT\n# example: CI_COMMIT=feature-branch\n# example: CI_COMMIT=c420de0\n```\n\nThe following config variables are available to dynamically set your scripts in the CodeBuild execution.\n\n```\nCI_SCRIPT_INSTALL\n# example: CI_SCRIPT_INSTALL=\"npm install yarn -g \u0026\u0026 yarn install --silent\"\n\nCI_SCRIPT_PRE_BUILD\n# example: CI_SCRIPT_PRE_BUILD=\"npm run test\"\n\nCI_SCRIPT_BUILD\n# example: CI_SCRIPT_BUILD=\"npm run build\"\n\nCI_SCRIPT_POST_BUILD\n# example: CI_SCRIPT_POST_BUILD=\"npm run s3:upload\"\n```\n\n## Working with Secrets\n\nEach project that you'd like to run scripts against should use parameter store to get encrypted secrets.\n\n### Ideas\n\n- Looking into setting up an SNS topic and or github pr status integration\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddywashere%2Fcodebuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddywashere%2Fcodebuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddywashere%2Fcodebuilder/lists"}