Integrate Wercker with Bitbucket, Firebase, Slack

Step to step tutorial for 'How to get started with Wercker?'

July 30, 2017 - 2 minute read -
ci-cd tutorial wercker firebase bitbucket slack

Introduction

Wercker is a Continuous integration and Deployment system. In this post we will be using Wercker to deploy changes as soon as they pushed on Bitbucket repository’s master branch to domain hosted at Firebase and then notifying other(team members etc) about the new deployment changes in Slack.

Things we will use

  • Bitbucket (Need to have a repository hosted at bitbucket either public/private)
  • Wercker (Need to have account on wercker, if not create one ;))
  • Firebase (Need to have a domain hosted at firebase, if not host one ;))
  • Slack (Need to have a slack web hook, create one )

Bitbucket

  • Create Repository on Bitbucket if already not have.

step 0

Wercker

  • Create Continuous integration app at “Wercker”

step 1

  • Select Bitbucket, type repository name, select it and click “Use selected repo”

step 2

  • Select recommended option

step 3

  • Finish

step 5

  • Add new pipeline “deploy-firebase”

step 6

  • Enter pipeline details and “Hook type” Default

step 7

  • Add “FIREBASE_PROJECT_NAME” and “FIREBASE_TOKEN” as environment variable for “deploy-firebase” pipeline

step 8

  • For “FIREBASE_TOKEN”, open terminal and type $firebase login:ci, login to account and after successful login token will get printed in same terminal, copy token and save as protected variable.

step 9

  • After setting variables, your setting will look something like below

step 10

  • Lets chain “deploy-firebase” pipeline after “build” pipeline finishes on master branch

step 11

  • Your pipelines will look something like below

step 12

  • Add “Wercker.yml” to your repository root and file will look something like below
  • Go to Webhook Api and create slack app, login into your slack team and then go to “incoming-hooks” and create new hooks, after creation your hook will look something like below

step 14

  • You can also restrict build trigger on particular branch e.g. “website” branch is restricted as below

step 16

  • Lets commit some changes to “master” branch of your bitbucket repository and as soon as changes are up build will trigger automatically

step 17

Firebase

  • As soon as build finishes successfully a new build will be uploaded to firebase hosting

step 17

Slack

  • After build finishes, slack hook will post a message to let the team know that a new build is release with appropriate message which build success or error.

step 18

Wercker documentation

Firebase Hosting documentation

Wercker.yml