From 7c04b76922ee1dc42956afb6c1da72df144b7b56 Mon Sep 17 00:00:00 2001 From: sfwn Date: Wed, 10 Jul 2024 16:23:39 +0800 Subject: [PATCH] fix(release-fetch): fix compile error; add missing outputs in spec.yml (#48) * fix(release-fetch): fix compile error; add missing outputs in spec.yml * adjust go imports --- actions/release-fetch/1.0/dice.yml | 2 +- actions/release-fetch/1.0/main.go | 9 +++------ actions/release-fetch/1.0/spec.yml | 15 ++++++++++++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/actions/release-fetch/1.0/dice.yml b/actions/release-fetch/1.0/dice.yml index e8eca3a4..87a9f9d3 100644 --- a/actions/release-fetch/1.0/dice.yml +++ b/actions/release-fetch/1.0/dice.yml @@ -1,6 +1,6 @@ jobs: run: - image: registry.erda.cloud/erda-actions/release-fetch-action:1.0-20220414-85d8486 + image: registry.erda.cloud/erda-actions/release-fetch-action:1.0-20240710161221-afcc1e8 resources: cpu: 0.2 mem: 128 diff --git a/actions/release-fetch/1.0/main.go b/actions/release-fetch/1.0/main.go index 01c1d4aa..6eff4c58 100644 --- a/actions/release-fetch/1.0/main.go +++ b/actions/release-fetch/1.0/main.go @@ -1,19 +1,17 @@ package main import ( + "encoding/json" "fmt" "strconv" "time" - "encoding/json" - "github.com/erda-project/erda/pkg/parser/diceyml" "github.com/erda-project/erda/apistructs" "github.com/erda-project/erda/pkg/envconf" "github.com/erda-project/erda/pkg/http/httpclient" + "github.com/erda-project/erda/pkg/parser/diceyml" ) - - type Conf struct { ApplicationName string `env:"ACTION_APPLICATION_NAME" required:"true"` Branch string `env:"ACTION_BRANCH" required:"true"` @@ -48,7 +46,7 @@ func main() { panic(err) } - serviceInfo, err := GetServerInfo(release.Diceyml) + serviceInfo, err := GetServiceInfo(release.Diceyml) if err != nil { echoMeta("Error", err.Error()) panic(err) @@ -117,7 +115,6 @@ func getRelease(hc *httpclient.HTTPClient, appID string) (*apistructs.ReleaseDat return &resp.Data.Releases[0], nil } - func GetServiceInfo(data string) (string, error) { diceYaml, err := diceyml.New([]byte(data), false) if err != nil { diff --git a/actions/release-fetch/1.0/spec.yml b/actions/release-fetch/1.0/spec.yml index 6f56624d..d6d88373 100644 --- a/actions/release-fetch/1.0/spec.yml +++ b/actions/release-fetch/1.0/spec.yml @@ -19,6 +19,19 @@ outputs: - name: release_id desc: release id got from query + - name: release_name + - name: release_branch + - name: release_commit + - name: release_commit_message + - name: release_images + desc: |- + json format: + { + "svc_a": "image_a", + "svc_b": "image_b" + } + + accessibleAPIs: - path: /api/applications method: GET @@ -35,4 +48,4 @@ locale: en-US: desc: It is used to obtain the details of Erda products according to the ID - displayName: Get Release Detail \ No newline at end of file + displayName: Get Release Detail