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

Add ability to trigger manual builds #1156

Merged
merged 68 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from 59 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
935015b
update gitea sdk dep to allow darwin builds
ennetech Sep 2, 2022
35a3b28
allow variable injection on model.Build
ennetech Sep 2, 2022
1ea830f
add sample trigger for manual build
ennetech Sep 2, 2022
bcf81f4
correct ts type for ManualBuildOptions.variables
ennetech Sep 2, 2022
69c868b
manual_build: load last commit with helper function
ennetech Sep 2, 2022
9b4bc86
manual_build: migrate from push event to manual
ennetech Sep 2, 2022
ed5a965
add simple ui for manual builds
ennetech Sep 2, 2022
a77425e
manual_build: auto redirect to build after launch
ennetech Sep 2, 2022
4e040aa
persist build variables for pipeline restart
ennetech Sep 2, 2022
af6be26
manual_build: add missing fields and auto naming
ennetech Sep 2, 2022
b731535
manual_build: restyle ui
ennetech Sep 2, 2022
3ade793
chore: fix codestyle
ennetech Sep 2, 2022
f0fc61e
manual_build: get user from session instead of the store
ennetech Sep 2, 2022
5ed9016
manual_build: remove ineffectual assignment to err
ennetech Sep 2, 2022
4c224ea
manual_build: migrate component to composition api
ennetech Sep 2, 2022
62046b8
manual_build: abort request if json malformed
ennetech Sep 2, 2022
faeee72
chore: use button instead o a tab
ennetech Sep 2, 2022
f9269a7
ci: fix linter errors and tidy deps
ennetech Sep 5, 2022
6aefd8f
manual_build: add cli command
ennetech Sep 5, 2022
e818ce7
manual_build: restyle ui
ennetech Sep 5, 2022
b8facb5
manual_build: add manual filter to docs reference
ennetech Sep 5, 2022
cbb2c52
chore: link
ennetech Sep 5, 2022
afaf84d
Update web/src/assets/locales/en.json
ennetech Sep 6, 2022
d3ed448
manual_builds: move translation key to correct place
ennetech Sep 7, 2022
4c303b3
manual_builds_ui: add icon for manual build
ennetech Sep 7, 2022
c288f9e
manual_build: removed name generation from vars
ennetech Sep 7, 2022
a8dded6
manual_build_ui: add manual to IconNames
ennetech Sep 8, 2022
259066f
manual_build: move ManualBuildReq to types.go
ennetech Sep 8, 2022
1f661e7
manual_build_ui: rename manual build struct
ennetech Sep 8, 2022
8923c76
manual_build: add session.MustPush to route
ennetech Sep 8, 2022
597a4e2
Merge branch 'master' into feature/manual_build
ennetech Sep 8, 2022
024a7c0
manual_builds_ui: hide button if missing push perm
ennetech Sep 8, 2022
0f5f16c
manual_build: move import
ennetech Sep 8, 2022
3864720
Update web/src/assets/locales/en.json
ennetech Sep 9, 2022
a0d8100
manual_build: use buildOptions instead of separate branch / variables
ennetech Sep 9, 2022
738bf02
Merge branch 'feature/manual_build' of https://github.com/ennetech/wo…
ennetech Sep 9, 2022
5069f12
some tiny ui adjustments
anbraten Sep 9, 2022
e1fad86
Merge branch 'feature/manual_build' of github.com:ennetech/woodpecker…
anbraten Sep 9, 2022
c41d1d0
Merge branch 'master' into feature/manual_build
anbraten Sep 9, 2022
dcb85e3
Update web/src/views/repo/RepoBuild.vue
ennetech Sep 12, 2022
b507bcc
Update web/src/views/repo/RepoBuild.vue
ennetech Sep 12, 2022
234d25a
Update web/src/router.ts
ennetech Sep 12, 2022
96c304c
manual_build: remove intrusive lockfile
ennetech Sep 12, 2022
7598cc9
manual_builds_ui: remove default var
ennetech Sep 12, 2022
06ca707
manual_build_ui: rename path for button
ennetech Sep 12, 2022
9e65693
manual_build: renamed variables to AdditionalVariables
ennetech Sep 12, 2022
bf24bec
manual_builds_ui: move to popup
ennetech Sep 12, 2022
b68562a
Merge branch 'master' into feature/manual_build
ennetech Sep 12, 2022
2df1cac
manual_build: lint
ennetech Sep 12, 2022
e7500b1
Merge branch 'feature/manual_build' of https://github.com/ennetech/wo…
ennetech Sep 12, 2022
4503802
fix popup positioning
anbraten Sep 13, 2022
40050f5
rename components
anbraten Sep 13, 2022
9ee33cd
adjust description
anbraten Sep 13, 2022
55715e8
add manual to secrets
anbraten Sep 13, 2022
bcd4c36
some fixes, renames
anbraten Sep 13, 2022
53cecf4
$(make docs)
6543 Sep 18, 2022
93f4d35
use SplitN
6543 Sep 18, 2022
9320585
own func
6543 Sep 18, 2022
c899d50
Merge branch 'master' into feature/manual_build
anbraten Sep 19, 2022
cfa2e64
Merge branch 'master' into feature/manual_build
qwerty287 Sep 25, 2022
a7ae122
merge from master
ennetech Sep 26, 2022
4f05b86
Merge branch 'master' into feature/manual_build
anbraten Sep 26, 2022
54e6d48
manual_build: removed client dependency
ennetech Sep 26, 2022
7c9a98b
Merge branch 'feature/manual_build' of https://github.com/ennetech/wo…
ennetech Sep 26, 2022
e435a62
Update cli/build/build_create.go
ennetech Sep 26, 2022
e30a25e
update generated docs
6543 Sep 27, 2022
e41fa5d
Merge branch 'master' into feature/manual_build
ennetech Sep 27, 2022
40d4510
Merge branch 'master' into feature/manual_build
anbraten Sep 27, 2022
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
1 change: 1 addition & 0 deletions cli/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ var Command = &cli.Command{
buildQueueCmd,
buildKillCmd,
buildPsCmd,
buildCreateCmd,
6543 marked this conversation as resolved.
Show resolved Hide resolved
},
}
78 changes: 78 additions & 0 deletions cli/build/build_create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package build

import (
"os"
"strings"
"text/template"

"github.com/woodpecker-ci/woodpecker/woodpecker-go/woodpecker"

"github.com/urfave/cli/v2"

"github.com/woodpecker-ci/woodpecker/cli/common"
"github.com/woodpecker-ci/woodpecker/cli/internal"
)

var buildCreateCmd = &cli.Command{
Name: "create",
Usage: "create new build",
ArgsUsage: "<repo/name>",
Action: buildCreate,
Flags: append(common.GlobalFlags,
common.FormatFlag(tmplBuildList),
&cli.StringFlag{
Name: "branch",
Usage: "branch to create build from",
Required: true,
},
&cli.StringSliceFlag{
Name: "var",
Usage: "<key>=<value>",
ennetech marked this conversation as resolved.
Show resolved Hide resolved
},
),
}

func buildCreate(c *cli.Context) error {
repo := c.Args().First()

owner, name, err := internal.ParseRepo(repo)
if err != nil {
return err
}

client, err := internal.NewClient(c)
if err != nil {
return err
}

branch := c.String("branch")
variables := make(map[string]string)

for _, vaz := range c.StringSlice("var") {
sp := strings.SplitN(vaz, "=", 2)
if len(sp) == 2 {
variables[sp[0]] = sp[1]
}
}

options := &woodpecker.BuildOptions{
Branch: branch,
Variables: variables,
}

build, err := client.BuildCreate(owner, name, options)
if err != nil {
return err
}

tmpl, err := template.New("_").Parse(c.String("format") + "\n")
if err != nil {
return err
}

if err := tmpl.Execute(os.Stdout, build); err != nil {
return err
}

return nil
}
4 changes: 2 additions & 2 deletions docs/docs/20-usage/20-pipeline-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,10 @@ when:
:::info
**By default steps are filtered by following event types:**

`push`, `pull_request`, `tag`, `deployment`.
`push`, `pull_request`, `tag`, `deployment`, `manual`.
:::

Available events: `push`, `pull_request`, `tag`, `deployment`, `cron`
Available events: `push`, `pull_request`, `tag`, `deployment`, `cron`, `manual`

Execute a step if the build event is a `tag`:

Expand Down
Loading