Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions helm/stagetime-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: stagetime-server
description: A Helm chart for Kubernetes
type: application
version: v0.4.42
appVersion: v0.4.42
version: v0.4.1
appVersion: v0.4.1
dependencies:
- name: sthings-helm-toolkit
version: 2.4.58
Expand Down
2 changes: 1 addition & 1 deletion helm/stagetime-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ deployment:
image: scr.cd43.sthings-pve.labul.sva.de/stagetime-server/stagetime-server
replicaCount: 1
imagePullPolicy: Always
tag: 24.0124.2021-v0.4.42
tag: 24.0219.0514-v0.4.1
securityContext:
capabilities: {}
services:
Expand Down
2 changes: 1 addition & 1 deletion helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ releases:
installed: true
namespace: stagetime
chart: stagetime-server/stagetime-server
version: v0.4.42
version: v0.4.1
values:
- "env/values.yaml.gotmpl"
environments:
Expand Down
23 changes: 3 additions & 20 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ var (
log = sthingsBase.StdOutFileLogger(logfilePath, "2006-01-02 15:04:05", 50, 3, 28)
now = time.Now()
stage string
stageNumber string
revisionRunID string
countPipelineRuns = 0
pipelineRunStatus []server.PipelineRunStatus
Expand Down Expand Up @@ -150,9 +149,6 @@ func (s Server) CreateRevisionRun(ctx context.Context, gRPCRequest *revisionrun.
stage = prInformation["stagetime/stage"]
stages[stage] = server.SetStage(stages, stage)
revisionRunID = prInformation["stagetime/commit"]
// SET STAGES ON LIST
// sthingsCli.AddValueToRedisSet(redisClient, now.Format(time.RFC3339)+"-"+prInformation["stagetime/commit"]+"-"+"stages", stage)
// sthingsCli.AddValueToRedisSet(redisClient, now.Format(time.RFC3339)+"-"+prInformation["stagetime/commit"], prInformation["name"])

// CONVERT PR TO JSON + ADD TO REDIS
prJSON := sthingsCli.ConvertYAMLToJSON(pr)
Expand Down Expand Up @@ -184,7 +180,7 @@ func (s Server) CreateRevisionRun(ctx context.Context, gRPCRequest *revisionrun.
CountStages: countStage,
CountPipelineRuns: countPipelineRuns,
LastUpdated: now.Format("2006-01-0215-04-05"),
Status: "CREATED W/ STAGETIME-SERVER",
Status: "REVISIONRUN CREATED W/ STAGETIME-SERVER",
}

sthingsCli.SetRedisJSON(redisJSONHandler, initialRrs, revisionRunID+"-status")
Expand All @@ -199,19 +195,16 @@ func (s Server) CreateRevisionRun(ctx context.Context, gRPCRequest *revisionrun.
}

// CREATE STAGE STATUS ON REDIS + PRINT AS TABLE
fmt.Println("LEN STAGES", len(stages))

for stageNumber, _ := range stages {
for stageNumber := range stages {

fmt.Println("STAGENUMBER: ", stageNumber)

initialStageStatus := server.StageStatus{
StageID: now.Format("2006-01-0215-04-05") + "-" + revisionRunID + "-" + stageNumber,
CountPipelineRuns: stages[stageNumber],
LastUpdated: now.Format("2006-01-0215-04-05"),
Status: "CREATED W/ STAGETIME-SERVER",
Status: "STAGE CREATED W/ STAGETIME-SERVER",
}
// "2024-01-2405-54-56-093uohkjscbod32903de-0"

log.Info("INITIAL STATE STATUS WAS ADDED TO REDIS (JSON): ", revisionRunID+stageNumber)
sthingsCli.SetRedisJSON(redisJSONHandler, initialStageStatus, revisionRunID+stageNumber)
Expand All @@ -225,16 +218,6 @@ func (s Server) CreateRevisionRun(ctx context.Context, gRPCRequest *revisionrun.
server.SendStageToMessageQueue(now.Format("2006-01-0215-04-05") + "+" + revisionRunID + "+0")
log.Info("STAGE WAS QUEUED FOR PIPELINERUN CREATION ON SERVER (STREAM): ", revisionRunID+"+0")

// HANDLING OF REVISONRUN CR
// stageID := "stageTime-" + gRPCRequest.CommitId[0:4]
// fmt.Println("REVISIONRUN ID: ", stageID)
// sthingsCli.AddValueToRedisSet(redisClient, now.Format(time.RFC3339)+"-"+stageID, stageID)
// cr := server.RenderRevisionRunCR()
// fmt.Println(string(cr))
// crJSON := sthingsCli.ConvertYAMLToJSON(string(cr))
// fmt.Println(crJSON)
// sthingsCli.SetRedisJSON(redisJSONHandler, crJSON, stageID)

// SEND gRPC RESPONSE
return &revisionrun.Response{
Result: revisionrun.Response_SUCCESS,
Expand Down
3 changes: 2 additions & 1 deletion server/producing.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ func OutputRevisonRunStatus(renderedPipelineruns map[int][]string) {
CountStages: countStage,
CountPipelineRuns: countPipelineRuns,
LastUpdated: t.Format("2006-01-02 15:04:05"),
Status: "CREATED W/ STAGETIME-SERVER",
Status: "REVISIONRUN CREATED W/ STAGETIME-SERVER",
}

tw := table.NewWriter()
header := sthingsCli.CreateTableHeader(rrs)
tw.AppendHeader(header)
Expand Down
5 changes: 5 additions & 0 deletions server/producing_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
Copyright © 2024 PATRICK HERMANN patrick.hermann@sva.de
*/

package server
207 changes: 207 additions & 0 deletions stageTime-server.log

Large diffs are not rendered by default.

Binary file added stagetime-server-v0.4.1.tgz
Binary file not shown.
14 changes: 7 additions & 7 deletions tests/cluster-importer/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ configMapGenerator:
- name: revisionruns
files:
- prime.json
# patches:
# - target:
# kind: Pod
# patch: |-
# - op: replace
# path: /metadata/name
# value: revisionrun-importer
patches:
- target:
kind: Pod
patch: |-
- op: replace
path: /metadata/name
value: revisionrun-importer
15 changes: 3 additions & 12 deletions tests/cluster-importer/prime.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"pushed_at": "2024-01-13T13:40:36Z",
"author": "patrick-hermann-sva",
"repo_url": "https://codehub.sva.de/Lab/stuttgart-things/stuttgart-things.git",
"commit_id": "000000005",
"commit_id": "000000021",
"pipelineruns": [
{
"name": "simulate-stagetime",
"name": "simulate-stagetime-1",
"canfail": true,
"stage": 0,
"resolverParams": "url=https://github.com/stuttgart-things/stuttgart-things.git, revision=main, pathInRepo=stageTime/pipelines/simulate-stagetime-pipelineruns.yaml",
Expand All @@ -17,16 +17,7 @@
{
"name": "simulate-stagetime-2",
"canfail": true,
"stage": 0,
"resolverParams": "url=https://github.com/stuttgart-things/stuttgart-things.git, revision=main, pathInRepo=stageTime/pipelines/simulate-stagetime-pipelineruns.yaml",
"params": "gitRevision=main, gitRepoUrl=https://github.com/stuttgart-things/stageTime-server.git, gitWorkspaceSubdirectory=stageTime, scriptPath=tests/prime.sh, scriptTimeout=25s",
"listparams": "",
"volumeClaimTemplates": "source=openebs-hostpath;ReadWriteOnce;20Mi"
},
{
"name": "simulate-stagetime-3",
"canfail": true,
"stage": 0,
"stage": 1,
"resolverParams": "url=https://github.com/stuttgart-things/stuttgart-things.git, revision=main, pathInRepo=stageTime/pipelines/simulate-stagetime-pipelineruns.yaml",
"params": "gitRevision=main, gitRepoUrl=https://github.com/stuttgart-things/stageTime-server.git, gitWorkspaceSubdirectory=stageTime, scriptPath=tests/prime.sh, scriptTimeout=25s",
"listparams": "",
Expand Down
2 changes: 1 addition & 1 deletion tests/grpcCall.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func ConnectSecure(address, testFilePath string) {
}
defer conn.Close()

json, err := ioutil.ReadFile(testFilePath)
json, err := os.ReadFile(testFilePath)
if err != nil {
log.Fatalln(err)
}
Expand Down