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!
Steps
-
In Harness:
click: # Projects (blue bar) 1 Your Project: ?project 2 -
If you see the Welcome screen with Get Started pane, kick it to the curb with the “X” top right.
Create the pipeline
-
In your project:
click: # Projects (blue bar) 1 Your Project: ?project 2 -
In the box that pops up:
click: # value Name 1 Python Build
Inline 2 Start 3 -
then:
click: # Add Stage 1 build 2 -
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…
pip install pytest & cd ./python-tests… 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:Terminal window nikpap/harness-workshop4 click +Add in Tags, then paste:
Terminal window <+variable.username>-<+pipeline.sequenceId>5 Click Optional Configuration to expand
6 For DockerFile paste:Terminal window /harness/frontend-app/harness-webapp/Dockerfile7 For Context paste:
Terminal window /harness/frontend-app/harness-webapp8 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