Skip to content

Commit 266f0bc

Browse files
authored
refactor: rename release action (#5825)
1 parent f8d2b30 commit 266f0bc

File tree

11 files changed

+43
-35
lines changed

11 files changed

+43
-35
lines changed
File renamed without changes.

docs/content/docs/concepts/files/application-syntax.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ vcs_ssh_key: proj-ssh-key
129129
vcs_pgp_key: proj-pgp-key
130130
```
131131

132-
Now with this setup you will be able to use the actions [CheckoutApplication]({{< relref "../../actions/builtin-checkoutapplication/" >}}) and [Release]({{< relref "../../actions/builtin-release/" >}}) in your pipelines.
132+
Now with this setup you will be able to use the actions [CheckoutApplication]({{< relref "../../actions/builtin-checkoutapplication/" >}}) and [Release]({{< relref "../../actions/builtin-releasevcs/" >}}) in your pipelines.
133133

134134
## Deployment
135135

docs/content/docs/tutorials/step_by_step_build_tag_release.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ Tag is created on GitHub.
232232
233233
## 9 - Release Action
234234
235-
[Release action]({{< relref "/docs/actions/builtin-release.md" >}}) action is implemented for GitHub only.
235+
[Release action]({{< relref "/docs/actions/builtin-releasevcs.md" >}}) action is implemented for GitHub only.
236236
You can use it to create a release from a tag and push some artifacts on it.
237237
238238
{{%expand "view screenshots..." %}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- +migrate Up
2+
UPDATE action SET name = 'ReleaseVCS' WHERE name = 'Release' and type = 'Builtin'
3+
4+
-- +migrate Down
5+
UPDATE action SET name = 'Release' WHERE name = 'ReleaseVCS' and type = 'Builtin'
6+
7+
8+

engine/worker/internal/action/builtin_release.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"github.com/ovh/cds/sdk"
1414
)
1515

16-
func RunRelease(ctx context.Context, wk workerruntime.Runtime, a sdk.Action, secrets []sdk.Variable) (sdk.Result, error) {
16+
func RunReleaseVCS(ctx context.Context, wk workerruntime.Runtime, a sdk.Action, secrets []sdk.Variable) (sdk.Result, error) {
1717
var res sdk.Result
1818
res.Status = sdk.StatusFail
1919
jobID, err := workerruntime.JobID(ctx)

engine/worker/internal/action/builtin_release_test.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func TestRunRelease(t *testing.T) {
6666
Value: "999",
6767
},
6868
}...)
69-
res, err := RunRelease(ctx, wk,
69+
res, err := RunReleaseVCS(ctx, wk,
7070
sdk.Action{
7171
Parameters: []sdk.Parameter{
7272
{
@@ -110,7 +110,7 @@ func TestRunReleaseMissingTag(t *testing.T) {
110110
Value: "999",
111111
},
112112
}...)
113-
res, err := RunRelease(ctx, wk,
113+
res, err := RunReleaseVCS(ctx, wk,
114114
sdk.Action{
115115
Parameters: []sdk.Parameter{
116116
{
@@ -150,7 +150,7 @@ func TestRunReleaseMissingTitle(t *testing.T) {
150150
Value: "999",
151151
},
152152
}...)
153-
res, err := RunRelease(ctx, wk,
153+
res, err := RunReleaseVCS(ctx, wk,
154154
sdk.Action{
155155
Parameters: []sdk.Parameter{
156156
{
@@ -190,7 +190,7 @@ func TestRunReleaseMissingReleaseNote(t *testing.T) {
190190
Value: "999",
191191
},
192192
}...)
193-
res, err := RunRelease(ctx, wk,
193+
res, err := RunReleaseVCS(ctx, wk,
194194
sdk.Action{
195195
Parameters: []sdk.Parameter{
196196
{
@@ -226,7 +226,7 @@ func TestRunReleaseMissingProjectKey(t *testing.T) {
226226
Value: "999",
227227
},
228228
}...)
229-
res, err := RunRelease(ctx, wk,
229+
res, err := RunReleaseVCS(ctx, wk,
230230
sdk.Action{
231231
Parameters: []sdk.Parameter{
232232
{
@@ -266,7 +266,7 @@ func TestRunReleaseMissingWorkflowName(t *testing.T) {
266266
Value: "999",
267267
},
268268
}...)
269-
res, err := RunRelease(ctx, wk,
269+
res, err := RunReleaseVCS(ctx, wk,
270270
sdk.Action{
271271
Parameters: []sdk.Parameter{
272272
{
@@ -306,7 +306,7 @@ func TestRunReleaseMissingWorkflowRunNumber(t *testing.T) {
306306
Value: "workflow Name",
307307
},
308308
}...)
309-
res, err := RunRelease(ctx, wk,
309+
res, err := RunReleaseVCS(ctx, wk,
310310
sdk.Action{
311311
Parameters: []sdk.Parameter{
312312
{

engine/worker/internal/builtin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func init() {
2020
mapBuiltinActions[sdk.JUnitAction] = action.RunParseJunitTestResultAction
2121
mapBuiltinActions[sdk.GitCloneAction] = action.RunGitClone
2222
mapBuiltinActions[sdk.GitTagAction] = action.RunGitTag
23-
mapBuiltinActions[sdk.ReleaseAction] = action.RunRelease
23+
mapBuiltinActions[sdk.ReleaseVCSAction] = action.RunReleaseVCS
2424
mapBuiltinActions[sdk.CheckoutApplicationAction] = action.RunCheckoutApplication
2525
mapBuiltinActions[sdk.DeployApplicationAction] = action.RunDeployApplication
2626
mapBuiltinActions[sdk.CoverageAction] = action.RunParseCoverageResultAction

sdk/action.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const (
2121
CoverageAction = "Coverage"
2222
GitCloneAction = "GitClone"
2323
GitTagAction = "GitTag"
24-
ReleaseAction = "Release"
24+
ReleaseVCSAction = "ReleaseVCS"
2525
CheckoutApplicationAction = "CheckoutApplication"
2626
DeployApplicationAction = "DeployApplication"
2727
InstallKeyAction = "InstallKey"

sdk/action/action.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ var List = []Manifest{
2121
GitTag,
2222
InstallKey,
2323
JUnit,
24-
Release,
24+
ReleaseVCS,
2525
Script,
2626
ServeStaticFiles,
2727
}

sdk/action/release.go sdk/action/release-vcs.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import (
55
"github.com/ovh/cds/sdk/exportentities"
66
)
77

8-
// Release action definition.
9-
var Release = Manifest{
8+
// ReleaseVCS action definition.
9+
var ReleaseVCS = Manifest{
1010
Action: sdk.Action{
11-
Name: sdk.ReleaseAction,
11+
Name: sdk.ReleaseVCSAction,
1212
Description: "This action creates a release on the git repository linked to the application, if repository manager implements it.",
1313
Parameters: []sdk.Parameter{
1414
{
@@ -68,7 +68,7 @@ var Release = Manifest{
6868
},
6969
},
7070
{
71-
Release: &exportentities.StepRelease{
71+
ReleaseVCS: &exportentities.StepReleaseVCS{
7272
Artifacts: "{{.cds.workspace}}/myFile",
7373
Title: "{{.cds.build.tag}}",
7474
ReleaseNote: "My release {{.cds.build.tag}}",

sdk/exportentities/step.go

+18-18
Original file line numberDiff line numberDiff line change
@@ -167,23 +167,23 @@ func newStep(act sdk.Action) Step {
167167
if prefix != nil {
168168
s.GitTag.Prefix = prefix.Value
169169
}
170-
case sdk.ReleaseAction:
171-
s.Release = &StepRelease{}
170+
case sdk.ReleaseVCSAction:
171+
s.ReleaseVCS = &StepReleaseVCS{}
172172
artifacts := sdk.ParameterFind(act.Parameters, "artifacts")
173173
if artifacts != nil {
174-
s.Release.Artifacts = artifacts.Value
174+
s.ReleaseVCS.Artifacts = artifacts.Value
175175
}
176176
releaseNote := sdk.ParameterFind(act.Parameters, "releaseNote")
177177
if releaseNote != nil {
178-
s.Release.ReleaseNote = releaseNote.Value
178+
s.ReleaseVCS.ReleaseNote = releaseNote.Value
179179
}
180180
tag := sdk.ParameterFind(act.Parameters, "tag")
181181
if tag != nil {
182-
s.Release.Tag = tag.Value
182+
s.ReleaseVCS.Tag = tag.Value
183183
}
184184
title := sdk.ParameterFind(act.Parameters, "title")
185185
if title != nil {
186-
s.Release.Title = title.Value
186+
s.ReleaseVCS.Title = title.Value
187187
}
188188
case sdk.JUnitAction:
189189
var step StepJUnitReport
@@ -289,8 +289,8 @@ type StepGitClone struct {
289289
User string `json:"user,omitempty" yaml:"user,omitempty"`
290290
}
291291

292-
// StepRelease represents exported release step.
293-
type StepRelease struct {
292+
// StepReleaseVCS represents exported release step.
293+
type StepReleaseVCS struct {
294294
Artifacts string `json:"artifacts,omitempty" yaml:"artifacts,omitempty"`
295295
ReleaseNote string `json:"releaseNote,omitempty" yaml:"releaseNote,omitempty"`
296296
Tag string `json:"tag,omitempty" yaml:"tag,omitempty" jsonschema:"required"`
@@ -335,7 +335,7 @@ type Step struct {
335335
ServeStaticFiles *StepServeStaticFiles `json:"serveStaticFiles,omitempty" yaml:"serveStaticFiles,omitempty" jsonschema:"oneof_required=actionServeStaticFiles" jsonschema_description:"Serve static files.\nhttps://ovh.github.io/cds/docs/actions/builtin-serve-static-files"`
336336
GitClone *StepGitClone `json:"gitClone,omitempty" yaml:"gitClone,omitempty" jsonschema:"oneof_required=actionGitClone" jsonschema_description:"Clone a git repository.\nhttps://ovh.github.io/cds/docs/actions/builtin-gitclone"`
337337
GitTag *StepGitTag `json:"gitTag,omitempty" yaml:"gitTag,omitempty" jsonschema:"oneof_required=actionGitTag" jsonschema_description:"Create a git tag.\nhttps://ovh.github.io/cds/docs/actions/builtin-gittag"`
338-
Release *StepRelease `json:"release,omitempty" yaml:"release,omitempty" jsonschema:"oneof_required=actionRelease" jsonschema_description:"Release an application.\nhttps://ovh.github.io/cds/docs/actions/builtin-release"`
338+
ReleaseVCS *StepReleaseVCS `json:"releaseVCS,omitempty" yaml:"releaseVCS,omitempty" jsonschema:"oneof_required=actionReleaseVCS" jsonschema_description:"Release an application.\nhttps://ovh.github.io/cds/docs/actions/builtin-releasevcs"`
339339
JUnitReport *StepJUnitReport `json:"jUnitReport,omitempty" yaml:"jUnitReport,omitempty" jsonschema:"oneof_required=actionJUNit" jsonschema_description:"Parse JUnit report.\nhttps://ovh.github.io/cds/docs/actions/builtin-junit"`
340340
Checkout *StepCheckout `json:"checkout,omitempty" yaml:"checkout,omitempty" jsonschema:"oneof_required=actionCheckout" jsonschema_description:"Checkout repository for an application.\nhttps://ovh.github.io/cds/docs/actions/builtin-checkoutapplication"`
341341
InstallKey *StepInstallKey `json:"installKey,omitempty" yaml:"installKey,omitempty" jsonschema:"oneof_required=actionInstallKey" jsonschema_description:"Install a key (GPG, SSH) in your current workspace.\nhttps://ovh.github.io/cds/docs/actions/builtin-installkey"`
@@ -441,7 +441,7 @@ func (s Step) IsValid() bool {
441441
if s.isGitTag() {
442442
count++
443443
}
444-
if s.isRelease() {
444+
if s.isReleaseVCS() {
445445
count++
446446
}
447447
if s.isCheckout() {
@@ -483,8 +483,8 @@ func (s Step) toAction() (*sdk.Action, error) {
483483
a, err = s.asGitClone()
484484
} else if s.isGitTag() {
485485
a, err = s.asGitTag()
486-
} else if s.isRelease() {
487-
a, err = s.asRelease()
486+
} else if s.isReleaseVCS() {
487+
a, err = s.asReleaseVCS()
488488
} else if s.isCheckout() {
489489
a = s.asCheckoutApplication()
490490
} else if s.isInstallKey() {
@@ -711,16 +711,16 @@ func (s Step) asGitTag() (sdk.Action, error) {
711711
return a, nil
712712
}
713713

714-
func (s Step) isRelease() bool { return s.Release != nil }
714+
func (s Step) isReleaseVCS() bool { return s.ReleaseVCS != nil }
715715

716-
func (s Step) asRelease() (sdk.Action, error) {
716+
func (s Step) asReleaseVCS() (sdk.Action, error) {
717717
var a sdk.Action
718-
m, err := stepToMap(s.Release)
718+
m, err := stepToMap(s.ReleaseVCS)
719719
if err != nil {
720720
return a, err
721721
}
722722
a = sdk.Action{
723-
Name: sdk.ReleaseAction,
723+
Name: sdk.ReleaseVCSAction,
724724
Type: sdk.BuiltinAction,
725725
Parameters: sdk.ParametersFromMap(m),
726726
}
@@ -780,7 +780,7 @@ func stepToMap(i interface{}) (map[string]string, error) {
780780

781781
func (s Step) String() string {
782782
buf := new(bytes.Buffer)
783-
dump := dump.NewEncoder(buf)
784-
_ = dump.Fdump(s)
783+
dp := dump.NewEncoder(buf)
784+
_ = dp.Fdump(s)
785785
return buf.String()
786786
}

0 commit comments

Comments
 (0)