In this tutorial, we build a continuous integration (CI) workflow that automatically builds and tests a Go application every time code changes. No server setup or manual steps are required, as Cloudbees Unify runs the automation for you. By the end, we will have created a component for your connected repository, defined a multi-step CI job in the workflow composer, triggered and verified a run, and pushed a code change that kicks off the next one automatically.
Along the way, we meet the component, which ties your repository, workflows, and automation together in Cloudbees Unify.
Prerequisites
Before we begin, ensure you have completed the following. This tutorial uses a controlled sample app so we can focus on the workflow, not on debugging your own code.
| Prerequisite | Details |
|---|---|
Cloudbees Unify access |
You have component management permissions in at least one organization. Refer to RBAC permissions reference for permission details. |
A connected repository |
You have completed the Connect your repository tutorial and have a sample Go app repository connected to Cloudbees Unify. |
The sample Go app |
The repository contains a Go application with at least one test file (a file ending in |
Step 1: Create a component
A component is a container that connects a repository to Cloudbees Unify.
-
Select , and then select an organization.
-
Select Components.
-
Select Create component.
-
Select your sample Go app repository from the list.
-
The organization is filled in automatically.
-
-
Select Create components to create the component.
-
Select Finish and close.
Your component appears in the Components list with a repository connection indicator, confirming that Cloudbees Unify can detect your repository and is ready to run automation against it.
|
If your repository does not appear in the list: Your repository connection may not be complete. Return to Connect your repository and verify that authentication succeeded. |
Step 2: Open the Workflow composer
Now that the component exists, we create a workflow inside it. The Workflow composer is where you define what happens when automation runs.
-
Select your new component from the Components list.
-
Select the Workflows tab.
-
Select Create standard workflow.
The Workflow composer opens with a default "hello world" example workflow. Two synchronized views display: a visual representation on the left and a code editor on the right showing the workflow as YAML (a human-readable data format used to define workflows). Changes in one view automatically update the other.
Step 3: Replace the default workflow with a CI job
The default workflow outputs "hello world." Now we replace it with a real CI workflow that builds and tests our Go application.
-
Select inside the code editor to edit the YAML file.
-
Delete the default
buildjob (lines 11-17). -
Starting on line 11, enter the following:
1 The job. ci-jobis the name of the job. A workflow can contain one or many jobs.2 Checkout. This step uses a Cloudbees action (pre-built, reusable automation) to pull your repository code into the workspace. 3 Build. This step runs a Go 1.22 container and builds your application. 4 Test. This step runs the same Go container and executes your test suite. If any test fails, the workflow run fails.
The code editor shows your updated YAML with a ci-job containing three steps.
The visual view updates to reflect the new job structure.
|
If the visual view does not update: Your YAML may contain a syntax error. The code editor on the right underlines the problem line in red. Look for missing indentation, missing colons, or a misspelled keyword. |
Step 4: Commit the workflow and trigger a run
Saving a workflow in Cloudbees Unify means committing it to your repository. This commit also triggers the workflow to run for the first time.
-
Select Commit.
-
Enter a Commit message, for example,
Add CI workflow for Go app. -
Select Commit to current branch.
-
Select FINISH.
The workflow file is committed to your repository in the .cloudbees/workflows directory, and a workflow run starts automatically.
If you check your connected GitHub repository, the new commit appears there too.
|
If no run appears within a few seconds: Check the Runs view of your component.
If the run shows a red error icon on checkout, your repository connection may need to be refreshed.
If no run appears at all, verify that the commit landed on the |
Step 5: Review your results
Your workflow is running. Now we check the results to confirm that the build and tests passed.
-
Select Components, and then select your component.
-
Select the Runs tab.
-
Select your run from the list.
-
Select JOB LOGS to display the output of each step.
-
Select Expand all in the upper right to display the details of every step.
Each step shows a green success indicator. You can expand any step to review its logs:
-
Checkout: your repository files being pulled
-
Build Go app: the Go compiler building your application
-
Run tests: your test results with pass/fail output
|
If a step shows a red error icon: Select the failed step to view the error message, then expand that step’s log and read from the bottom up, as the most recent line usually contains the error. |
Step 6: Make it your own
This is the moment that proves the automation works for you, not just for the workflow file you committed. We change a line of code in the app and watch the workflow run automatically.
-
In your connected GitHub repository, open any source file, for example,
main.go. -
Select the pencil icon to edit the file.
-
Add a comment line such as,
// My first automated build. -
Commit the change directly to the
mainbranch. -
Return to the Runs view in Cloudbees Unify.
A new run appears at the top of the Runs list within a few seconds, triggered by your code change. When it finishes, both runs are visible: your first one (the workflow commit) and your second one (the code change).
What we learned
In this tutorial we built a CI pipeline that automatically builds and tests a Go application on every code change. Along the way we created a component for your connected repository, defined a multi-step job in the workflow composer, and confirmed the automation loop: code change, workflow run, result.
These skills apply to any language or framework. You now have a working pipeline and a starting point to build on.