You've already forked golang-saas-starter-kit
mirror of
https://github.com/raseels-repos/golang-saas-starter-kit.git
synced 2025-06-29 00:52:03 +02:00
fixing build cache target name
This commit is contained in:
@ -32,7 +32,7 @@ cache:
|
||||
.build_tmpl: &build_tmpl
|
||||
<<: *job_tmpl
|
||||
script:
|
||||
- 'EMAIL_SENDER=$EMAIL_SENDER devops build -service=${SERVICE} -project=${PROJECT_NAME} -env=${TARGET_ENV}'
|
||||
- 'devops build -service=${SERVICE} -project=${PROJECT_NAME} -env=${TARGET_ENV}'
|
||||
|
||||
.deploy_tmpl: &deploy_tmpl
|
||||
<<: *job_tmpl
|
||||
|
@ -3,6 +3,7 @@ package handlers
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"geeks-accelerator/oss/saas-starter-kit/internal/platform/web"
|
||||
"github.com/jmoiron/sqlx"
|
||||
@ -33,13 +34,27 @@ func (c *Check) Health(ctx context.Context, w http.ResponseWriter, r *http.Reque
|
||||
return errors.Wrap(err, "Redis failed")
|
||||
}
|
||||
|
||||
status := struct {
|
||||
data := struct {
|
||||
Status string `json:"status"`
|
||||
CiCommitRefName string `json:"ci-commit-ref-name,omitempty"`
|
||||
CiCommitRefSlug string `json:"ci-commit-ref-slug,omitempty"`
|
||||
CiCommitSha string `json:"ci-commit-sha,omitempty"`
|
||||
CiCommitTag string `json:"ci-commit-tag,omitempty"`
|
||||
CiCommitTitle string `json:"ci-commit-title,omitempty"`
|
||||
CiJobId string `json:"ci-commit-job-id,omitempty"`
|
||||
CiPipelineId string `json:"ci-commit-pipeline-id,omitempty"`
|
||||
}{
|
||||
Status: "ok",
|
||||
CiCommitRefName: os.Getenv("CI_COMMIT_REF_NAME"),
|
||||
CiCommitRefSlug: os.Getenv("CI_COMMIT_REF_SLUG"),
|
||||
CiCommitSha: os.Getenv("CI_COMMIT_SHA"),
|
||||
CiCommitTag: os.Getenv("CI_COMMIT_TAG"),
|
||||
CiCommitTitle: os.Getenv("CI_COMMIT_TITLE"),
|
||||
CiJobId : os.Getenv("CI_COMMIT_JOB_ID"),
|
||||
CiPipelineId: os.Getenv("CI_COMMIT_PIPELINE_ID"),
|
||||
}
|
||||
|
||||
return web.RespondJson(ctx, w, status, http.StatusOK)
|
||||
return web.RespondJson(ctx, w, data, http.StatusOK)
|
||||
}
|
||||
|
||||
// Ping validates the service is ready to accept requests.
|
||||
|
@ -3,6 +3,7 @@ package handlers
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
"os"
|
||||
|
||||
"geeks-accelerator/oss/saas-starter-kit/internal/platform/web"
|
||||
"github.com/jmoiron/sqlx"
|
||||
@ -14,7 +15,6 @@ import (
|
||||
type Check struct {
|
||||
MasterDB *sqlx.DB
|
||||
Redis *redis.Client
|
||||
Renderer web.Renderer
|
||||
|
||||
// ADD OTHER STATE LIKE THE LOGGER IF NEEDED.
|
||||
}
|
||||
@ -34,8 +34,24 @@ func (c *Check) Health(ctx context.Context, w http.ResponseWriter, r *http.Reque
|
||||
return errors.Wrap(err, "Redis failed")
|
||||
}
|
||||
|
||||
data := map[string]interface{}{
|
||||
"Status": "ok",
|
||||
data := struct {
|
||||
Status string `json:"status"`
|
||||
CiCommitRefName string `json:"ci-commit-ref-name,omitempty"`
|
||||
CiCommitRefSlug string `json:"ci-commit-ref-slug,omitempty"`
|
||||
CiCommitSha string `json:"ci-commit-sha,omitempty"`
|
||||
CiCommitTag string `json:"ci-commit-tag,omitempty"`
|
||||
CiCommitTitle string `json:"ci-commit-title,omitempty"`
|
||||
CiJobId string `json:"ci-commit-job-id,omitempty"`
|
||||
CiPipelineId string `json:"ci-commit-pipeline-id,omitempty"`
|
||||
}{
|
||||
Status: "ok",
|
||||
CiCommitRefName: os.Getenv("CI_COMMIT_REF_NAME"),
|
||||
CiCommitRefSlug: os.Getenv("CI_COMMIT_REF_SLUG"),
|
||||
CiCommitSha: os.Getenv("CI_COMMIT_SHA"),
|
||||
CiCommitTag: os.Getenv("CI_COMMIT_TAG"),
|
||||
CiCommitTitle: os.Getenv("CI_COMMIT_TITLE"),
|
||||
CiJobId : os.Getenv("CI_COMMIT_JOB_ID"),
|
||||
CiPipelineId: os.Getenv("CI_COMMIT_PIPELINE_ID"),
|
||||
}
|
||||
|
||||
return web.RespondJson(ctx, w, data, http.StatusOK)
|
||||
|
@ -163,7 +163,6 @@ func APP(shutdown chan os.Signal, log *log.Logger, env webcontext.Env, staticDir
|
||||
check := Check{
|
||||
MasterDB: masterDB,
|
||||
Redis: redis,
|
||||
Renderer: renderer,
|
||||
}
|
||||
app.Handle("GET", "/v1/health", check.Health)
|
||||
|
||||
|
@ -199,6 +199,9 @@ func ServiceBuild(log *log.Logger, req *serviceBuildRequest) error {
|
||||
return errors.Wrapf(err, "Failed parse relative path for %s from %s", req.DockerFile, req.ProjectRoot)
|
||||
}
|
||||
|
||||
// Name of the first build stage declared in the docckerFile.
|
||||
var buildStageName string
|
||||
|
||||
// When the dockerFile is multistage, caching can be applied. Scan the dockerFile for the first stage.
|
||||
// FROM golang:1.12.6-alpine3.9 AS build_base
|
||||
var buildBaseImageTag string
|
||||
@ -213,9 +216,6 @@ func ServiceBuild(log *log.Logger, req *serviceBuildRequest) error {
|
||||
// any changes to the lines associated with the first stage force cache to be reset.
|
||||
var stageLines []string
|
||||
|
||||
// Name of the first build stage declared in the docckerFile.
|
||||
var buildStageName string
|
||||
|
||||
// Loop through all the lines in the Dockerfile searching for the lines associated with the first build stage.
|
||||
scanner := bufio.NewScanner(file)
|
||||
for scanner.Scan() {
|
||||
@ -299,7 +299,7 @@ func ServiceBuild(log *log.Logger, req *serviceBuildRequest) error {
|
||||
"--build-arg", "service=" + req.ServiceName,
|
||||
"--build-arg", "env=" + req.Env,
|
||||
"-t", buildBaseImageTag,
|
||||
"--target", "build_base",
|
||||
"--target", buildStageName,
|
||||
".",
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user