Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Jul 10, 2024
Merged
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
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
Loading