Commit graph

1133 commits

Author SHA1 Message Date
6543 e57a09a404
Update pipeline state on server as a whole on approval (#3504)
We can not just update some records for steps, as we want the pipeline
engine as single source of truth but not manage the state.
And the server should only manage the state but not how pipelines work.

We can match the pipeline but neither workflows or steps 1:1, so we
"update" them as a whole by deleting existing workflow and step data and
insert the new info from engine.

close   #3494
close  #3472

---------
*Sponsored by Kithara Software GmbH*

---------

Co-authored-by: Robert Kaussow <xoxys@rknet.org>
2024-03-18 20:07:45 +01:00
6543 43264a5f8e
rename stepID to workflowID to reflect value (#3502)
address https://github.com/woodpecker-ci/woodpecker/issues/3494#issuecomment-2001986597
2024-03-18 15:21:26 +01:00
renovate[bot] 5d98a717ac
fix(deps): update module github.com/google/go-github/v59 to v60 (#3493) 2024-03-16 09:37:08 +01:00
Robert Kaussow a779eed3df
Enable golangci linter gomnd (#3171) 2024-03-15 18:00:25 +01:00
Thor Anker Kvisgård Lange 632c946511
feat: Remove user part of http clone url (#3462)
Some configuration of Bitbucket Datacenter seems to return username as
part of the clone URL. This needs to be removed for `.netrc` to work
properly.

Closes #3443

---------

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
2024-03-07 18:06:05 +01:00
Thor Anker Kvisgård Lange ce51d65829
fix: Make sure to refresh access token when reading commit information (#3447)
When receiving notification by webhook the forge tries to read
information on the latest commit when constructing the pipeline. This
requires a call to the Bitbucket API which again requires the access
token to be up-to-date.

Signed-off-by: Thor Anker Kvisgård Lange <tal@netic.dk>
2024-02-27 17:15:11 +01:00
qwerty287 cb3efd2cd9
Simplify store interfaces (#3437)
Use `store.Store` interface if possible.
2024-02-25 10:37:10 +01:00
qwerty287 5b0430ab4a
Fix storing steps (#3431)
Closes https://github.com/woodpecker-ci/woodpecker/issues/3427
2024-02-25 08:16:14 +01:00
qwerty287 16dca0abc2
Store workflows/steps for blocked pipeline (#2757)
This stores workflows and steps to DB even if it is not yet approved and
thus blocked.

I'm not really happy with this, because even though it is stored, it
must parse the pipeline again and set back the original UUID. If you
have any ideas how to fix/improve this just comment.

In addition, this allows to view step list and side panel for approved
pipelines, https://github.com/woodpecker-ci/woodpecker/pull/2345 is
partially not longer necessary.

Closes https://github.com/woodpecker-ci/woodpecker/issues/895

---------

Co-authored-by: 6543 <6543@obermui.de>
2024-02-22 15:48:29 +01:00
6543 10e4bac936
Parse email from Gitea webhook (#3420)
The CI_COMMIT_AUTHOR_EMAIL was empty for gitea/forgejo,
now the webhook is parsed correctly.
2024-02-22 09:02:19 +02:00
qwerty287 bf0a9455ce
Update org name on login (#3409)
and create a new org once a user is created (logged in for the first
time)

closes https://github.com/woodpecker-ci/woodpecker/issues/3342

---------

Co-authored-by: Anbraten <6918444+anbraten@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2024-02-21 19:56:37 +01:00
Thor Anker Kvisgård Lange 364d708923
Add bitbucket datacenter (server) support (#2503)
This pull-requests re-introduces the Bitbucket Server support with a
more or less complete rewrite of the forge implementation. We have a lot
of on-premises git repositories hosted in Bitbucket Server and need a CI
solution for running that and Woodpecker looks promising.

The implementation is based on external Bitbucket Server REST client
library which we are maintaining and have created in another context.
Besides the original support for Bitbucket the re-implementation also
adds support for handling Bitbucket pull-request events.
2024-02-20 15:58:02 +01:00
qwerty287 0c9bbf91a3
Do not alter secret key upper-/lowercase (#3375) 2024-02-20 14:20:25 +01:00
Anbraten f86c2b7d0f
Fix pipeline restart (#3402)
closes #3399
2024-02-17 10:19:28 +01:00
renovate[bot] 4e44dd0e76
fix(deps): update module github.com/google/go-github/v58 to v59 (#3398) 2024-02-17 09:04:33 +01:00
Anbraten 0e0d0188a0
Fix agent polling (#3378) 2024-02-16 10:04:13 +01:00
qwerty287 451af535d3
Replace http types on forge interface (#3374) 2024-02-13 16:19:02 +01:00
Anbraten 65d88be523
Prevent agent deletion when it's still running tasks (#3377)
It wont solve the underlying issues like
https://github.com/woodpecker-ci/autoscaler/issues/50 completely, but
should be a first step in the correct direction.
2024-02-12 19:23:56 +01:00
Anbraten 82e1ce937c
Refactor internal services (#915) 2024-02-11 18:42:33 +01:00
qwerty287 e1521ef460
Set correct link for commit (#3368)
Closes https://github.com/woodpecker-ci/woodpecker/issues/2657
Closes https://github.com/woodpecker-ci/woodpecker/issues/906
2024-02-11 10:44:50 +01:00
qwerty287 f369d2c543
Lint for event filter and deprecate exclude (#3222)
Closes https://github.com/woodpecker-ci/woodpecker/discussions/2174

- return bad habit error if no event filter is set
- If this is applied, it's useless to allow `exclude`s on events.
Therefore, deprecate it together with `include`s which should be
replaced by `base.StringOrSlice` later.
2024-02-10 17:33:05 +01:00
Anbraten 9e96c9c25e
Fix correctly handle gitlab pr closed events (#3362)
closes #3355
2024-02-09 16:49:04 +01:00
Anbraten 0b91317cde
Fix linter (#3354) 2024-02-08 22:49:07 +01:00
qwerty287 6892a9ca57
Parse backend options in backend (#3227)
Currently, backend options are parsed in the yaml parser.
This has some issues:
- backend specific code should be in the backend folders
- it is not possible to add backend options for backends added via
addons
2024-02-08 18:39:32 +01:00
Lukas 5cedc956e9
Ignore gitlab merge request events without code changes (#3338)
Closes #3320 

From the gitlab docs at:
https://docs.gitlab.com/ee/user/project/integrations/webhook_events.html#merge-request-events

> The field object_attributes.oldrev is only available when there are
actual code changes
2024-02-07 01:45:00 +01:00
Lukas baf2e645bc
Ignore gitlab push events without commits (#3339)
Example of the resulting buggy pipeline:


![image](https://github.com/woodpecker-ci/woodpecker/assets/32853499/1e4bedc6-465b-466e-8d89-a7348e374c7f)
2024-02-07 02:24:08 +02:00
Lukas db4a50951c
Consider gitlab inherited permissions (#3308)
The gitlab projects endpoint does not include information about
permissions granted by namespace memberships. To get this information a
separate query to
https://docs.gitlab.com/ee/api/members.html#get-a-member-of-a-group-or-project-including-inherited-and-invited-members
is necessary.
2024-02-06 00:10:23 +01:00
Patrick Schratz e85762f791
Remove accidentally added file (#3304)
See discussion in [`1ab94d6`
(#3303)](1ab94d662b (r1473078205))

@qwerty287
2024-01-31 18:38:39 +01:00
Anbraten 6ed1655ce3
Add release types (#3303)
Co-authored-by: pat-s <patrick.schratz@gmail.com>
2024-01-31 16:18:32 +01:00
qwerty287 9df572ef31
Add release event trigger (#3226)
Supersedes #764 

Bitbucket does not support release webhooks.

---------

Co-authored-by: Patrick Schratz <patrick.schratz@gmail.com>
2024-01-30 17:39:00 +01:00
qwerty287 2eec1ce909
Fix agent updating (#3287) 2024-01-28 12:29:56 +01:00
Lukas 94b882fb95
Add spellcheck config (#3018)
Part of #738 

```
pnpx cspell lint --gitignore '{**,.*}/{*,.*}'
```

---------

Co-authored-by: Anbraten <anton@ju60.de>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: 6543 <6543@obermui.de>
2024-01-27 21:15:10 +01:00
Anbraten 0b5eef7d1e
Improve secret availability checks (#3271) 2024-01-27 20:59:44 +01:00
Alconety 8cb86ddc68
fix bitbucket SSO using UUID from bitbucket api response as ForgeRemoteID (#3265) 2024-01-23 16:35:30 +01:00
qwerty287 c8fa71874a
Fix disabling PRs (#3258)
Closes https://github.com/woodpecker-ci/woodpecker/issues/3257
2024-01-22 20:46:46 +01:00
qwerty287 5e2f7d81b3
Clean up models (#3228) 2024-01-22 07:56:18 +01:00
6543 8ca51971be
Add gitea/forgejo driver check, to handle ErrUnknownVersion error (#3243)
close  #3240
2024-01-21 23:07:37 +02:00
Michalis Zampetakis 39c1beffc5
Fix Bitbucket get pull requests that ignores pagination (#3235)
Fixes #3180
2024-01-20 22:41:54 +01:00
qwerty287 b82790d54c
Remove some interfaces (#3220) 2024-01-19 16:20:35 +01:00
Alconety 07479dd645
Retrieve all user repo perms with a single API call (#3211)
This pull request addresses the issue https://github.com/woodpecker-ci/woodpecker/issues/3210.

Ideally, the Bitbucket API should include repository permissions when
utilizing the 'get all repositories' endpoint. However, as it currently
does not provide this information, a viable solution is to fetch all
permissions for every repository and then employ a dictionary to
associate each repository with its respective permissions.

Without implementing this fix, logging in becomes problematic for users
with access to a substantial number of repositories (300+), as the
process takes over 2 minutes to complete.

---------

Co-authored-by: Alberto Alcón <albertoalcon@bit2me.com>
2024-01-19 04:15:47 +01:00
6543 7b29d1da49
Make PipelineConfig unique again (#3215)
fix https://github.com/woodpecker-ci/woodpecker/issues/3093

reverts https://github.com/woodpecker-ci/woodpecker/pull/3128
2024-01-18 23:50:29 +02:00
qwerty287 001b5639a6
Use assert for test (#3201)
instead of `if`s
2024-01-14 19:33:58 +01:00
qwerty287 b9f6f3f9fb
Replace goimports with gci (#3202)
`gci` seems to be much more strict.
2024-01-14 18:22:06 +01:00
qwerty287 45bf8600ef
Remove multipart logger (#3200) 2024-01-14 10:54:02 +01:00
renovate[bot] 57dd88f94a
fix(deps): update module github.com/google/go-github/v57 to v58 (#3187) 2024-01-13 08:13:22 +01:00
Robert Kaussow 9bbba4441d
Enable golangci linter forcetypeassert (#3168)
Split out from https://github.com/woodpecker-ci/woodpecker/pull/2960
2024-01-12 02:01:02 +01:00
Robert Kaussow f813badcf9
Enable golangci linter contextcheck (#3170)
Split out from https://github.com/woodpecker-ci/woodpecker/pull/2960
2024-01-11 22:15:15 +01:00
qwerty287 d0380e31b5
Remove panic recovering (#3162) 2024-01-11 19:37:47 +01:00
qwerty287 b0a2b1cf2d
Lowercase all log strings (#3173)
from #3161

---------

Co-authored-by: 6543 <6543@obermui.de>
2024-01-11 19:17:07 +01:00
Robert Kaussow 7756c60a33
Enable golangci linter stylecheck (#3167)
This PR only fixes error string formatting, log message strings are
still mixed upper/lowercase (see
https://github.com/woodpecker-ci/woodpecker/pull/3161#issuecomment-1885140649)
and I'm not aware of a linter to enforce it.
2024-01-10 22:56:42 +01:00