Backend - Go (be-golang)
Purpose of this quickstarter
Use this quickstarter when you want to use Go. Go is well suited for CLI tools, network/operational related things and microservices.
What files / which architecture is generated?
├── Jenkinsfile - Contains Jenkins build configuration ├── .pre-commit-config.yaml ├── README.md ├── docker - Contains Dockerfile for the build │ └── Dockerfile ├── metadata.yml - Component metadata ├── release-manager.yml - Configuration file for the Release Manager ├── sonar-project.properties - SonarQube Configuration ├── main.go - Example Go file
Frameworks used
None, except the ODS Jenkins Shared Library
Usage - how do you start after you provisioned this quickstarter
Simply start to write Go code, e.g. by extending main.go. No further adjustments
should be necessary. Typically, you’d want to use Go modules:
go mod init example.com/project/component
Metadata
The following are typical metadata values that can be used for components based on this quickstarter: Note that the OpenShift resources will be labeled based on this metadata.
name: <the component id (this is the default, if omitted)>
description: "Some microservice implemented in golang"
supplier: https://example.com
version: 1.0.1
type: ods
role: backend
How this quickstarter is built through Jenkins
There are six steps:
-
Check that all files are gofmt’d.
-
Run SonarQube analysis.
-
Run all package tests.
-
Build the binary (placing it into the
dockerdirectory). -
Build the container image.
-
Deploy.
include::partials$secret-scanning-with-gitleaks.adoc
Builder agent used
This quickstarter uses Golang builder agent.