Lab A - Build Software
Goals
We’ll setup a CI Pipeline with source code tests, build, and then push the artifact to a remote repository!
Lab Guide
Login and app link
-
Login to Harness at https://workshop.harness.io using the credentials provided.
-
Ensure your project is selected: 1 click on project, 2 click/ensure project level, 3 click on project shown.
-
Get your personal application link: 1 click the hamburger button, 2 click on Unified View.
-
then 1 click-hold and drag over your URL (it will look different). Right-click and copy the URL.
-
Open a new tab in your browser and then paste the URL into the address bar and press enter.
Our first pipeline
-
Return to the Harness Platform tab then: 1 click Pipelines, 2 Click Create a Pipeline
-
In the box that pops up: 1 give your pipeline a name, 2 click Inline, 3 click Start
-
then: 1 click Add Stage, 2 Build as the Stage Type
-
then: 1 enter any name (ex:
build
), 2 ensure Clone Codebase is selected, 3 click for repo selector and pick harnessrepo, 4 click Set Up StageConfigure the infrastructure and tests
-
On the infrastructure page: 1 click Cloud, 2 click Continue
-
On the execution page: 1 click Add Step, 2 click Add Step
-
In the Step Library: 1 (optional) type
tests
in search box, 2 click Run Tests -
In the Run Tests pane: 1 name the test
Run Tests with Intelligence
, 2 choose python, 3 Pytest, 4 Click Additional Configuration to expand……5 copy and paste the install command below into the Pre-Command field…
… then: 6 click Apply Changes
Leverage a template for software build!
-
Back in the Execution pane: 1 click Add Step, 2 click Use Template
-
In the Template Library: 1 click Compile Application, 2 click Use Template (far bottom right of screen)
-
In the template box: 1 name the template
Compile
, 2 click Apply ChangesSave the completed build artifact
-
Back in the Execution pane: 1 click Add Step, 2 click Add Step
-
In the Step Library: 1 type
docker
in search box, 2 click Build and Push an image to Dockerhub -
In the Build and Push pane:
1 name the stepPush to DockerHub
2 selectdockerhub
for Docker Connector
3 for Docker Respository paste:4 click +Add in Tags, then paste:
5 Click Optional Configuration to expand
6 For DockerFile paste:7 For Context paste:
8 Click Apply Changes. That was the biggest step in the workshop, you did it! ⭐️
-
In the top right of Pipeline Studio: 1 click Save, 2 click Run