{"id":20894593,"url":"https://github.com/gnu4cn/artifacts-repo","last_synced_at":"2025-12-27T05:32:21.597Z","repository":{"id":183674046,"uuid":"670553884","full_name":"gnu4cn/artifacts-repo","owner":"gnu4cn","description":"A artifacts repo server implemented with Actix-web + Diesel + Postgres REST API","archived":false,"fork":false,"pushed_at":"2023-11-27T07:51:07.000Z","size":1319,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-19T12:13:58.170Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gnu4cn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-25T10:04:16.000Z","updated_at":"2023-09-11T02:23:57.000Z","dependencies_parsed_at":"2023-11-27T08:49:37.284Z","dependency_job_id":null,"html_url":"https://github.com/gnu4cn/artifacts-repo","commit_stats":null,"previous_names":["gnu4cn/artifacts-repo"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnu4cn%2Fartifacts-repo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnu4cn%2Fartifacts-repo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnu4cn%2Fartifacts-repo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gnu4cn%2Fartifacts-repo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gnu4cn","download_url":"https://codeload.github.com/gnu4cn/artifacts-repo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243278333,"owners_count":20265529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-18T10:20:18.299Z","updated_at":"2025-12-27T05:32:21.566Z","avatar_url":"https://github.com/gnu4cn.png","language":"Rust","readme":"# Artifacts Repo -- to store and serve build artifacts from Jenkins\n\nThis project utilizes the [Diesel ORM](https://diesel.rs) backed by [PostgreSQL](https://www.postgresql.org/), [Actix Web](https://actix.rs) for setting up a backend restful api server, and uses [Angular](https://angular.io) for getting a frontend UI, which located at [gnu4cn/artifacts-repo-spa](https://github.com/gnu4cn/artifacts-repo-spa). This project has taken inspiration from [SakaDream/actix-web-rest-api-with-jwt](https://github.com/SakaDream/actix-web-rest-api-with-jwt).\n\n![Project diagram](./artifacts-repo.png)\n\n*Chart: `artfacts-repo` project diagram*\n\n![Database tables design](./artifacts-repo-db-design.png)\n\n*Chart: `artfacts-repo` project database tables design*\n\n\n## TODO list\n\n- Implement the pagination feature.\n\n## Prerequisites\n\nClone this project to your local machine.\n\n```bash\ngit clone https://github.com/gnu4cn/artifacts-repo.git\n```\n\nTo run this project, you should have Rust `cargo`, PostgreSQL installed. And creating a user `jenkins` with password `jenkins` in PostgreSQL, then create a database `jenkins`, and grant all its' privileges to user `jenkins`. Or you can create a file `.env` then set the corresponding database name and user credentials in that file.\n\n```env\nDATABASE_URL=postgresql://jenkins:jenkins@localhost:5432/jenkins\n```\n\nWhen all things prepared, simply run the following command to start the server.\n\n```console\ncd artifacts-repo\ncargo run\n```\n\n## API list\n\n### `api/release`\n\n\n| Endpoint | Description | Usage |\n| :-- | :-- | :-- |\n| `api/release/new` | Post a new release. | |\n| `api/release` | List all releases. | `curl -X GET -i https://HOST/api/release --noproxy '*'`|\n| `api/release/today` | List releases of today. | `curl -X GET -i https://HOST/api/release/today --noproxy '*'`|\n| `api/release/repository` | List all releases under specific repo. | `curl -X POST -H 'Content-Type: application/json' -i https://HOST/api/release/repository --data '{\"org\":\"Senscomm\",\"repo\":\"taihu_wise\"}' --noproxy '*'` |\n| `api/release/days` | List all days release available. | `curl -X GET -k -i 'https://HOST/api/release/days' --noproxy '*'` |\n| `api/release/repo/date` | Fetch a release with specified repo name and release date. | `curl -X POST -k -H 'Content-Type: application/json' -i 'https://HOST/api/release/repo/date' --data '{\"repo\":{\"org\": \"Senscomm\", \"repo\": \"wise\"}, \"date\": \"2023-08-29\"}' --noproxy '*'` |\n| `api/release/date/{date}` | Fetch releases with the specific date. | `curl -X GET -i https://HOST/api/release/date/2023-08-23 --noproxy '*'` |\n| `api/release/{id}` | Fetch a release with the specific id. | `curl -X GET -i https://HOST/api/release/1 --noproxy '*'` |\n\n\n### `api/repository`\n\n| Endpoint | Description | Usage |\n| :-- | :-- | :-- |\n| `api/repository` | List all `repo`. | `curl -X GET -i https://HOST/api/repository --noproxy '*'` |\n| `api/repository/brief` | List all `repo`'s brief data. | `curl -X GET -k -i 'https://HOST/api/repository/brief' --noproxy '*'` |\n| `api/repository/brief/{repo_id}` | Fetch specific `repo`'s brief data. | `curl -X GET -k -i 'https://HOST/api/repository/brief/1' --noproxy '*'` |\n| `api/repository/defconfig` | List all defconfigs under specific repo. | `curl -X POST -H 'Content-Type: application/json' -i https://HOST/api/repository/defconfig --data '{\"org\":\"Senscomm\",\"repo\":\"wise\"}' --noproxy '*'` |\n| `api/repository/tagged` | List all tagged releases under specific repo. | `curl -X POST -k -H 'Content-Type: application/json' -i 'https://HOST/api/repository/tagged' --data '{\"org\":\"Senscomm\",\"repo\":\"wise\"}' --noproxy '*'` |\n| `api/repository/tag/release` | Fetch a release which has the specicified tag under a repository. | `curl -X POST -k -H 'Content-Type: application/json' -i 'https://HOST/api/repository/tag/release' --data '{\"repo\": {\"org\":\"Senscomm\",\"repo\":\"wise\"}, \"tag\": \"WISE-SDK-1.0.1\"}' --noproxy '*'` |\n\n### `api/artifact`\n\n| Endpoint | Description | Usage |\n| :-- | :-- | :-- |\n| `api/artifact/{a_id}` | Fetch a artifact with it's assiociated release, changelogs and affected files info. | `curl -X GET -i https://HOST/api/artifact/2 --noproxy '*'` |\n| `api/artifact` | Fetch a artifact which has specified repo name, release date and defconfig. | `curl -X POST -k -H 'Content-Type: application/json' -i 'https://HOST/api/artifact' --data '{\"repo\":{\"org\": \"Senscomm\", \"repo\": \"wise\"}, \"date\": \"2023-08-29\", \"defconfig\": \"scm1612_ate_defconfig\"}' --noproxy '*'` |\n\n\n## `ReleaseDTO` JSON structure\n\n```json\n{\n    \"repo\": {\n        \"org\": String,\n        \"repo\": String\n    },\n    \"release\":{\n        \"release_channel\": String,\n        \"diffs_url\": String,\n        \"repository_id\": 0\n    },\n    \"tag\":{\n        \"name\": String,\n        \"repository_id\": 0,\n        \"release_id\": 0\n    },\n    \"changelogs\": [\n        {\n            \"commit_id\": String,\n            \"commit_comment\": String,\n            \"commited_by\": String,\n            \"release_id\": 0\n        }\n    ],\n    \"artifacts\": [\n        {\n            \"defconfig\": String,\n            \"url\": String,\n            \"filesize\": i32,\n            \"build_log_url\": String,\n            \"repository_id\": 0,\n            \"release_id\": 0\n        }\n    ],\n    \"affected_files\": [\n        {\n            \"file_edit_type\": String\n            \"file_path\": String,\n            \"release_id\": 0\n        }\n    ]\n}\n```\n\nUse this JSON structure to POST a new release.\n\n## How to migrate the database tables\n\n- Run `diesel migrate generate create_tags` command to create migration SQL files under the project's `migrations` directory. The `create_tags` CLI flag is a comment-like command parameter.\n\n- Run `vim migrations/2023-09-14-092441_create_tags/up.sql` to edit both the `up.sql` and `down.sql` files, to add or remove any database table.\n\n- Then run `diesel migrate run` to complete the migration.\n\n\u003e Note:\n\u003e\n\u003e When use the diesel-orm migration feat, we should use `pg_dump`'s `-a`, `--only-data` option, to only dump the data. And for `diesel migrate run` command, there is a `--all` option for specifying running all the migrations.\n\n\n## About `git tag`\n\n+ Add a tag and push it to remote\n\n    - `git tag TAG_NAME`\n\n    - `git tag TAG_NAME -a -m \"message\"`, Create an “annotated” tag with the given message (instead of prompting)\n\n    - `git push origin TAG_NAME`\n\n+ Delete local and remote tag\n\n    - `git tag -d TAG_NAME`\n\n    - `git push --delete origin TAG_NAME`\n\n- List tags by commit date: `git tag --sort=committerdate`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnu4cn%2Fartifacts-repo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgnu4cn%2Fartifacts-repo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgnu4cn%2Fartifacts-repo/lists"}