Web3 Meets DevOps: Creating the Initial Structure of Pipeline | by Donovan Brown | Jun, 2022

Web3 wants DevOps

Half-4 — Constructing a DevOps pipeline for the Ethereum blockchain

Photograph by Fotis Fotopoulos on Unsplash

Within the earlier submit of this collection Web3 Meets DevOps: Writing Address Service, I had the entrance finish, contracts, and supporting code in place. On this submit, I’ll begin the creation of our pipeline.

Earlier than I may begin constructing my pipeline I wanted to publish my modifications to a distant git service. Though I’m utilizing Azure Pipelines for my DevOps pipeline I used GitHub to retailer my supply. Azure Pipelines and GitHub work nice collectively and I get one of the best of each worlds.

When you need assistance creating an Azure DevOps challenge (to carry your Azure Pipeline) or creating and pushing your code to a GitHub repository you should use the hyperlinks beneath:

I created a brand new department named “blog/part4” for this submit.

git checkout -b weblog/part4
Pipelines menu and Create Pipeline button

With my code pushed to GitHub I navigated to the Pipelines web page of Azure DevOps and clicked the Create Pipeline button.

Then I chosen GitHub when requested “The place is your code”. I chosen the repo with my code after which chosen Starter pipeline.

Azure Pipelines will be made up with Stages, Jobs, and Steps. To get began I made a decision to put out my phases and jobs. This allowed me to outline dependencies between phases and jobs and see my whole pipeline.

Utilizing the net editor I up to date the code to outline my pipeline construction. My pipeline has six phases:

  1. construct: compiles, checks, and packages artifacts
  2. dev: deploys infrastructure, contracts and frontend
  3. dev_validation: waits for guide validation of dev and deletes dev setting
  4. qa: deploys infrastructure, contracts and frontend
  5. qa_validation waits for guide validation of qa and deletes qa setting
  6. prod: deploys infrastructure, contracts and frontend
Preliminary pipeline construction

I saved and ran my pipeline to substantiate every thing was structured accurately and operating.

Six stage Azure Pipeline with all green check marks
Profitable run of the pipeline

After the preliminary run of the pipeline I synced my modifications to my native improvement machine to tug the azure-pipelines.yml file down. That is the file that incorporates the definition of my pipeline.

To make my pipeline simpler to create I added a package deal.json file within the root of my challenge that contained the Truffle dependency. Azure Pipelines use Microsoft-hosted brokers to run. They comprise the commonest packages, and I can add further packages through a package deal.json file.

On this case, I would like so as to add Truffle. The pre-installed packages are listed here. Truffle should be put in to compile, check, and migrate the contracts. Putting in Truffle within the root will create a node_modules folder that doesn’t must be tracked. So, I added it to the .gitignore file within the root of the challenge.

Added node_modules to .gitignore

Then I ran the next command:

npm set up --save-dev truffle

I made a decision to create a package deal.json file simply in case I wanted further packages sooner or later.

package deal.json

Lastly, I dedicated all of the modifications.

git add package deal.json
git add package-lock.json
git commit -a -m "including pipeline yaml"

Then I merged my modifications into important.

git checkout important
git merge weblog/part4

Within the subsequent submit of this collection, I’ll full the construct stage of the pipeline.

Editor: Chelsea Brown
Technical Overview: Brian Benz

More Posts