Giter VIP home page Giter VIP logo

serverless-gitlab-ci's Introduction

serverless-gitlab-ci

Description

Basic nodejs CI setup for gitlab's CI service. This configuration can be used with their free tier usage or their self-hosted solution. This lets devs collaborate on simple serverless projects with automatic deployment on merge. This also tags each merge to an environment for automatic tracking in the CI / CD > Environments tab.

This setup also includes a dummy test command that will run on all branches. Ideally this would be replaced with real tests to enable a true CI experience.

Usage

Navigate to gitlab.com and create a new repo.

Then go to settings > CI / CD and expand the Secret Variables section. Click Add New Variable and add

Key: AWS_ACCESS_KEY_ID
Value: YOUR_ACCESS_KEY
Protected: 

Key: AWS_SECRET_ACCESS_KEY
Value: YOUR_SECRET_VALUE
Protected: 

Enabling protected limits these variables to specific branches that we define (eg: staging and master, since they'll be the only ones that deploy anything). See settings > Repository and expand protected branches to set the access (Can enable user, or group level access).

Next up, template this repo with

serverless create --template-url https://github.com/bvincent1/serverless-gitlab-ci/master --path myService

And set the remote to the gitlab url

cd myService
git init # init repo if needed
git remote add origin [email protected]:username/myrepo.git
git add -A
git commit -a -m 'Init repo from template'
git push -u origin master

This should create the repo and automatically create the ci pipeline.

Special Notes

  • Ideally you could just use AWS IAM to create a new admin user and use those keys and not your own. This lets you track usage and keeps your keys separate. Best practice even suggests you rotate keys regularly, but thats a whole different story.

  • This project uses yarn as the node_modules install tool. This can be easily changed by modifiying the .gitlab-ci.yml file and changing the yarn command to npm.

  • Additional Gitlab CI example RestfullSheets

serverless-gitlab-ci's People

Contributors

bvincent1 avatar dakshshah96 avatar

Watchers

 avatar

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.