Skip to content

Commit

Permalink
fix(release-fetch): fix compile error; add missing outputs in spec.yml (
Browse files Browse the repository at this point in the history
#48)

* fix(release-fetch): fix compile error; add missing outputs in spec.yml

* adjust go imports
  • Loading branch information
sfwn authored Jul 10, 2024
1 parent afcc1e8 commit 7c04b76
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion actions/release-fetch/1.0/dice.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 3 additions & 6 deletions actions/release-fetch/1.0/main.go
Original file line number Diff line number Diff line change
@@ -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"`
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down
15 changes: 14 additions & 1 deletion actions/release-fetch/1.0/spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
displayName: Get Release Detail

0 comments on commit 7c04b76

Please sign in to comment.