The core of the CloudBees platform is the workflow, a DevSecOps automation. In this quickstart, create a workflow to build a sample Go application, then run the workflow.
Prerequisites
Complete the Quickstart: Connect to source code management that connects a sample Go app repository to the platform.
Create a component
Create a component that contains all the resources required to build a sample Go app in the CloudBees platform.
To create a component:
-
Select Components from the left pane.
-
Select CREATE COMPONENT.
-
Select your sample Go app repository from the options. If desired, enter all or part of its name into Search, and then select it.
-
Select NEXT.
-
Enter a Component name.
-
(Optional) Enter a Description.
-
Select CREATE.
Your component is created, and you are ready to create a workflow to automate building your Go app.
Create a workflow
Create a CloudBees workflow with the composer code editor.
The workflow displayed in the visual tool automatically updates with every change you make to the script in the code editor. |
To create a workflow:
-
Select Components from the left pane, select your component, and then select Workflows.
-
Select CREATE WORKFLOW.
An example workflow that outputs "hello world" is displayed in the composer.

Update the workflow
In the code editor, add a new CI job, then commit these changes to your repository.
This job performs the following steps:
-
Adds update privileges to an image directory (required by the Go app).
-
Runs the preconfigured CloudBees action to check out a Git repository.
-
Builds the Go app.
-
Runs tests on the Go app.
To add the new CI job using the code editor:
-
Select Components from the left pane, and then select your component name from the list.
-
Select EDIT YAML on your workflow.
-
Delete the
build
job that outputs "hello world", on lines 11 - 17. -
Enter the following, starting on line 11:
ci-job: steps: - uses: docker://alpine/git:latest run: | git config --global --add safe.directory /cloudbees/workspace - name: checkout uses: cloudbees-io/checkout@v1 - name: Build Go app uses: docker://golang:1.20 run: | go build -v ./... - name: Run tests uses: docker://golang:1.20 run: | go test -v ./...
Check to confirm that your YAML script is similar to the following:
Display the complete YAML file for building the sample Go app.
apiVersion: automation.cloudbees.io/v1alpha1 kind: workflow name: My automation on: push: branches: - '**' jobs: ci-job: steps: - uses: docker://alpine/git:latest run: | git config --global --add safe.directory /cloudbees/workspace - name: checkout uses: cloudbees-io/checkout@v1 - name: Build Go app uses: docker://golang:1.20 run: | go build -v ./... - name: Run tests uses: docker://golang:1.20 run: | go test -v ./...
-
Select COMMIT.
To save changes to your workflow, you must make a commit. -
Enter a Commit message.
-
Select Commit to current branch.
-
Select FINISH.
-
Check your repository for the commit.
All CloudBees platform workflows are saved in .cloudbees/workflows
.Figure 2. Commit in connected GitHub repository.
You have created a workflow to build a sample Go app, using the code editor in the composer, and triggered a workflow run.
Check your workflow run
-
Select Components from the left pane, select your component, and then select Runs.
-
Select Display run to the right of your run.
-
Select
ci-job
to display each job step, and then select EXPAND ALL on the upper right to display all step details.
You have run a workflow triggered by a commit to the main
branch of your repository, and checked your workflow run details. You are now ready to scan your repository for security flaws.