Commit Graph
44 Commits
Author SHA1 Message Date
FuXiaoHeiandGitHub 68e1d17a5f Expire artifacts before deleting them physically (#29241)
https://github.com/go-gitea/gitea/pull/27172#discussion_r1493735466

When cleanup artifacts, it removes storage first. If storage is not
exist (maybe delete manually), it gets error and continue loop. It makes
a dead loop if there are a lot pending but non-existing artifacts.

Now it updates db record at first to avoid keep a lot of pending status
artifacts.
2024-02-18 22:25:14 +08:00
FuXiaoHeiandGitHub 67adc5c1dc Artifact deletion in actions ui (#27172)
Add deletion link in runs view page.
Fix #26315


![image](https://github.com/go-gitea/gitea/assets/2142787/aa65a4ab-f434-4deb-b953-21e63c212033)

When click deletion button. It marks this artifact `need-delete`.

This artifact would be deleted when actions cleanup cron task.
2024-02-18 10:33:50 +00:00
FuXiaoHeiandGitHub ad98ea63ee Fix uploaded artifacts should be overwritten (#28726)
Fix `Uploaded artifacts should be overwritten`
https://github.com/go-gitea/gitea/issues/28549

When upload different content to uploaded artifact, it checks that
content size is not match in db record with previous artifact size, then
the new artifact is refused.

Now if it finds uploading content size is not matching db record when
receiving chunks, it updates db records to follow the latest size value.
2024-01-17 11:21:16 +08:00
FuXiaoHeiandGitHub fe5a616392 Fix merging artifact chunks error when minio storage basepath is set (#28555)
Related to  https://github.com/go-gitea/gitea/issues/28279

When merging artifact chunks, it lists chunks from storage. When storage
is minio, chunk's path contains `MINIO_BASE_PATH` that makes merging
break.

<del>So trim the `MINIO_BASE_PATH` when handle chunks.</del>

Update the chunk file's basename to retain necessary information. It
ensures that the directory in the chunk's path remains unaffected.
2023-12-21 07:04:50 +00:00
ec0c6829d4 Fix/upload artifact error windows (#27802)
From issue https://github.com/go-gitea/gitea/issues/27314

When act_runner in `host` mode on Windows. `upload_artifact@v3` actions
use `path.join` to generate `itemPath` params when uploading artifact
chunk. `itemPath` is encoded as `${artifact_name}\${artifact_path}`.

<del>It's twice query escaped from ${artifact_name}/${artifact_path}
that joined by Windows slash \.</del>

**So we need convert Windows slash to linux**.

In https://github.com/go-gitea/gitea/issues/27314, runner shows logs
from `upload_artifact@v3` like with `%255C`:

```
[artifact-cases/test-artifact-cases]   | ::error::Unexpected response. Unable to upload chunk to http://192.168.31.230:3000/api/actions_pipeline/_apis/pipelines/workflows/6/artifacts/34d628a422db9367c869d3fb36be81f5/upload?itemPath=more-files%255Css.json
```

But in gitea server at the same time, But shows `%5C`

```
2023/10/27 19:29:51 ...eb/routing/logger.go:102:func1() [I] router: completed PUT /api/actions_pipeline/_apis/pipelines/workflows/6/artifacts/34d628a422db9367c869d3fb36be81f5/upload?itemPath=more-files%5Css.json for 192.168.31.230:55340, 400 Bad Request in 17.6ms @ <autogenerated>:1(actions.artifactRoutes.uploadArtifact-fm)
```

I found `%255C` is escaped by
`https://github.com/actions/upload-artifact/blob/main/dist/index.js#L2329`.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-10-30 10:40:05 +00:00
FuXiaoHeiandGitHub 460a2b0edf Artifacts retention and auto clean up (#26131)
Currently, Artifact does not have an expiration and automatic cleanup
mechanism, and this feature needs to be added. It contains the following
key points:

- [x] add global artifact retention days option in config file. Default
value is 90 days.
- [x] add cron task to clean up expired artifacts. It should run once a
day.
- [x] support custom retention period from `retention-days: 5` in
`upload-artifact@v3`.
- [x] artifacts link in actions view should be non-clickable text when
expired.
2023-09-06 07:41:06 +00:00
FuXiaoHeiandGitHub ad69f7175a fix artifact merging chunks path with correct slash on Windows (#26400)
From Discord
https://discord.com/channels/322538954119184384/1069795723178160168/1136719889684500480

Artifact chunks merging is break on Windows.

```
Gitea Log:
2023/08/03 20:51:15 ...actions/artifacts.go:271:comfirmUploadArtifact() [E] Error merge chunks: parse content range error: input does not match format
```

Artifact uses wrong slash to parse saved chunks path.
2023-08-08 17:21:48 +00:00
FuXiaoHeiandGitHub f3d293d2bb Actions Artifacts support uploading multiple files and directories (#24874)
current actions artifacts implementation only support single file
artifact. To support multiple files uploading, it needs:

- save each file to each db record with same run-id, same artifact-name
and proper artifact-path
- need change artifact uploading url without artifact-id, multiple files
creates multiple artifact-ids
- support `path` in download-artifact action. artifact should download
to `{path}/{artifact-path}`.
- in repo action view, it provides zip download link in artifacts list
in summary page, no matter this artifact contains single or multiple
files.
2023-07-21 10:42:01 +08:00
FuXiaoHeiandGitHub c757765a9e Implement actions artifacts (#22738)
Implement action artifacts server api.

This change is used for supporting
https://github.com/actions/upload-artifact and
https://github.com/actions/download-artifact in gitea actions. It can
run sample workflow from doc
https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts.
The api design is inspired by
https://github.com/nektos/act/blob/master/pkg/artifacts/server.go and
includes some changes from gitea internal structs and methods.

Actions artifacts contains two parts:

- Gitea server api and storage (this pr implement basic design without
some complex cases supports)
- Runner communicate with gitea server api (in comming)

Old pr https://github.com/go-gitea/gitea/pull/22345 is outdated after
actions merged. I create new pr from main branch.


![897f7694-3e0f-4f7c-bb4b-9936624ead45](https://user-images.githubusercontent.com/2142787/219382371-eb3cf810-e4e0-456b-a8ff-aecc2b1a1032.jpeg)

Add artifacts list in actions workflow page.
2023-05-19 21:37:57 +08:00
61ad4c607b fix minio storage iterator path (#24691)
minio storage iterator shows different behavior with local fs iterator.

in local fs storage:

``` go
s.IterateObjects("prefix", func(path,obj)
     println(path) // show "prefix/xxx.file"
})
```

in minio storage:

```go
s.IterateObjects("prefix", func(path,obj)
     println(path) // show "xxx.file"
})
```

I think local fs is correct, minio use wrong `basePath` to trim storage
path prefix.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-05-13 22:33:25 +00:00
cdc9e91750 add path prefix to ObjectStorage.Iterator (#23332)
Support to iterator subdirectory in ObjectStorage for
ObjectStorage.Iterator method.

It's required for https://github.com/go-gitea/gitea/pull/22738 to make
artifact files cleanable.

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2023-03-13 18:23:51 +08:00
fuxiaohei c0cfd62b90 add label-edit and label-delete logic 2014-12-22 21:26:05 +08:00
fuxiaohei 0daef29053 add label-create ui elements 2014-12-07 21:29:37 +08:00
fuxiaohei 0af3a5b603 add issue list filter ui 2014-12-04 23:22:16 +08:00
fuxiaohei 23d53561d1 update milestone page design 2014-11-24 23:13:42 +08:00
fuxiaohei 79dae254cf add milestone page design 2014-11-24 22:33:04 +08:00
fuxiaohei d1a60e3643 add pull-request and labels page design 2014-11-17 23:07:34 +08:00
fuxiaohei 69a98236bd Merge remote-tracking branch 'origin/dev' into dev 2014-11-04 21:58:47 +08:00
fuxiaohei b866dc92d7 finish issue list ui draft 2014-11-04 21:58:28 +08:00
fuxiaohei 9e3a1bc11a add nav bar in issue list 2014-10-18 22:52:34 +08:00
fuxiaohei cb2da7bf2c some ui details fix 2014-10-18 22:15:05 +08:00
fuxiaohei 7d48f811f1 add issue router for new issue page ui preview 2014-09-27 19:03:07 +08:00
fuxiaohei e3a27aeb25 template and ui fix 2014-09-27 17:31:44 +08:00
fuxiaohei dccc50e9d4 template and ui fix 2014-09-27 17:08:57 +08:00
fuxiaohei 7c30ae7002 is utils improvement 2014-09-25 21:52:58 +08:00
fuxiaohei a11ed51bbb resize star font size 2014-09-24 00:01:48 +08:00
fuxiaohei e0493259a6 resize star font size 2014-09-23 23:59:44 +08:00
fuxiaohei b3f0d25ce5 pull request ui review, change sidebar 2014-09-23 23:48:28 +08:00
fuxiaohei d750d53422 Merge remote-tracking branch 'origin/dev' into dev 2014-09-23 23:36:25 +08:00
fuxiaohei 8d5a4cc9eb pull request ui review, change sidebar 2014-09-23 23:36:09 +08:00
fuxiaohei 60c65415dd pull request page ui review, upgrade octicon icons 2014-09-23 22:28:03 +08:00
fuxiaohei 904f799c1a improve ui details 2014-09-23 21:43:45 +08:00
fuxiaohei c127d84777 add organization team-single page 2014-07-07 18:13:42 +08:00
fuxiaohei 1d55ecd29c add organization team-create page 2014-06-27 22:04:04 +08:00
fuxiaohei b5ba2bd268 add organization team-create page 2014-06-27 21:33:49 +08:00
fuxiaohei 72ba273cc9 select owner when creating repository 2014-06-25 16:03:29 +08:00
fuxiaohei 80be060735 select owner when creating repository 2014-06-25 13:08:28 +08:00
fuxiaohei cc703ee663 select owner when creating repository 2014-06-25 12:22:08 +08:00
fuxiaohei fb53cc4fa8 add organization setting page 2014-06-23 19:11:20 +08:00
fuxiaohei f393dc6520 add organization dashboard page 2014-06-23 12:08:53 +08:00
fuxiaohei ea507e20d4 add organization create page 2014-06-23 11:40:49 +08:00
fuxiaohei adda10f4a4 add organization teams page 2014-06-22 21:53:40 +08:00
fuxiaohei 514d7e1922 add organization memebers page 2014-06-22 16:53:46 +08:00
fuxiaohei bf703ef617 add dashboard context switch button 2014-06-22 14:10:12 +08:00