Sample Code

In order to demonstrate an end-to-end CICD pipeline, one needs to have code to run! For this example pipeline, we will use a simple Gin-based HTTP serve. The sample code is shown here:

package main

import (
"fmt"
"github.com/gin-gonic/gin"
)

func main() {
fmt.Println("starting application..")

// setup and route
r := gin.Default()
r.GET("/health", func(c *gin.Context) {
c.JSON(200, gin.H{
"status": "ok",
})
})

// listen and serve on 0.0.0.0:9000
r.Run(":9000")
}

We will trigger builds and deployments from this source directly (https://github.com/cookingkode/cisample).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset