mirror of
https://gitea.com/gitea/docs.git
synced 2026-06-30 16:14:23 +00:00
Add 1.24.0-rc0 documentation (#220)
Reviewed-on: https://gitea.com/gitea/docs/pulls/220
This commit is contained in:
376
versioned_docs/version-1.24/usage/actions/act-runner.md
Normal file
376
versioned_docs/version-1.24/usage/actions/act-runner.md
Normal file
@@ -0,0 +1,376 @@
|
||||
---
|
||||
date: "2023-04-27T15:00:00+08:00"
|
||||
slug: "act-runner"
|
||||
sidebar_position: 20
|
||||
---
|
||||
|
||||
# Act Runner
|
||||
|
||||
This page will introduce the [act runner](https://gitea.com/gitea/act_runner) in detail, which is the runner of Gitea Actions.
|
||||
|
||||
## Requirements
|
||||
|
||||
Currently the runner supports run in two modes. One is running in docker container, another is running in host. It is recommended to run jobs in a [docker](https://docker.com) container, if you chose this mode, you need to [install docker](https://docs.docker.com/engine/install/) first and make sure that the docker daemon is running.
|
||||
|
||||
Other OCI container engines which are compatible with Docker's API should also work, but are untested.
|
||||
|
||||
However, if you are sure that you want to run jobs directly on the host only, then docker is not required.
|
||||
|
||||
There are multiple ways to install the act runner.
|
||||
|
||||
## Installation with binary
|
||||
|
||||
### Download the binary
|
||||
|
||||
You can download the binary from the [release page](https://gitea.com/gitea/act_runner/releases).
|
||||
However, if you want to use the latest nightly build, you can download it from the [download page](https://dl.gitea.com/act_runner/).
|
||||
|
||||
When you download the binary, please make sure that you have downloaded the correct one for your platform.
|
||||
You can check it by running the following command if you are in a Unix-Style OS.
|
||||
|
||||
```bash
|
||||
chmod +x act_runner
|
||||
./act_runner --version
|
||||
```
|
||||
|
||||
If you see the version information, it means that you have downloaded the correct binary.
|
||||
|
||||
### Obtain a registration token
|
||||
|
||||
You can register a runner in different levels, it can be:
|
||||
|
||||
- Instance level: The runner will run jobs for all repositories in the instance.
|
||||
- Organization level: The runner will run jobs for all repositories in the organization.
|
||||
- Repository level: The runner will run jobs for the repository it belongs to.
|
||||
|
||||
Note that the repository may still use instance-level or organization-level runners even if it has its own repository-level runners. A future release may provide an option to allow more control over this.
|
||||
|
||||
|
||||
Before register the runner and run it, you need a registration token. The level of the runner determines where to obtain the registration token.
|
||||
|
||||
- Instance level: The admin settings page, like `<your_gitea.com>/-/admin/actions/runners`.
|
||||
- Organization level: The organization settings page, like `<your_gitea.com>/<org>/settings/actions/runners`.
|
||||
- Repository level: The repository settings page, like `<your_gitea.com>/<owner>/<repo>/settings/actions/runners`.
|
||||
|
||||
If you cannot see the settings page, please make sure that you have the right permissions and that Actions have been enabled.
|
||||
|
||||
The format of the registration token is a random string `D0gvfu2iHfUjNqCYVljVyRV14fISpJxxxxxxxxxx`.
|
||||
|
||||
A registration token can also be obtained from the gitea [command-line interface](../../administration/command-line.md#actions-generate-runner-token):
|
||||
|
||||
```
|
||||
gitea --config /etc/gitea/app.ini actions generate-runner-token
|
||||
```
|
||||
|
||||
You can also use `GITEA_RUNNER_REGISTRATION_TOKEN`/`GITEA_RUNNER_REGISTRATION_TOKEN_FILE` environment variable to set a global runner registration token when Gitea starts, for example:
|
||||
|
||||
```
|
||||
openssl rand -hex 24 > /some-dir/runner-token
|
||||
export GITEA_RUNNER_REGISTRATION_TOKEN_FILE=/some-dir/runner-token
|
||||
./gitea --config ...
|
||||
```
|
||||
|
||||
The token from environment is valid until you reset the token (re-create a new one) via web UI or API.
|
||||
|
||||
Tokens are valid for registering multiple runners, until they are revoked and replaced by a new token using the token reset link in the web interface.
|
||||
|
||||
### Configuration
|
||||
|
||||
Configuration is done via a configuration file. It is optional, and the default configuration will be used when no configuration file is specified. You can generate a configuration file by running the following command:
|
||||
|
||||
```bash
|
||||
./act_runner generate-config
|
||||
```
|
||||
|
||||
The default configuration is safe to use without any modification, so you can just use it directly.
|
||||
|
||||
```bash
|
||||
./act_runner generate-config > config.yaml
|
||||
./act_runner --config config.yaml [command]
|
||||
```
|
||||
|
||||
### Register the runner
|
||||
|
||||
Registration is required before running the act runner, because the runner needs to know where to get jobs from. And it is also important to Gitea instance to identify the runner.
|
||||
|
||||
If this has been installed using the binary package, the act runner can be registered by running the following command.
|
||||
|
||||
```bash
|
||||
./act_runner register
|
||||
```
|
||||
|
||||
Alternatively, you can use the `--config` option to specify the configuration file mentioned in the previous section.
|
||||
|
||||
```bash
|
||||
./act_runner --config config.yaml register
|
||||
```
|
||||
|
||||
You will be asked to input the registration information step by step. Includes:
|
||||
|
||||
- The Gitea instance URL, like `https://gitea.com/` or `http://192.168.8.8:3000/`.
|
||||
- The registration token.
|
||||
- The runner name, which is optional. If you leave it blank, the hostname will be used.
|
||||
- The runner labels, which is optional. If you leave it blank, the default labels will be used.
|
||||
|
||||
You may be confused about the runner labels, which will be explained later.
|
||||
|
||||
If you want to register the runner in a non-interactive way, you can use arguments to do it.
|
||||
|
||||
```bash
|
||||
./act_runner register --no-interactive --instance <instance_url> --token <registration_token> --name <runner_name> --labels <runner_labels>
|
||||
```
|
||||
|
||||
When you have registered the runner, you can find a new file named `.runner` in the current directory.
|
||||
This file stores the registration information.
|
||||
Please do not edit it manually.
|
||||
If this file is missing or corrupted, you can simply remove it and register again.
|
||||
|
||||
If you want to store the registration information in another place, you can specify it in the configuration file,
|
||||
and don't forget to specify the `--config` option.
|
||||
|
||||
### Start the runner in command line
|
||||
|
||||
After you have registered the runner, you can run it by running the following command:
|
||||
|
||||
```shell
|
||||
./act_runner daemon
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
./act_runner daemon --config config.yaml
|
||||
```
|
||||
|
||||
The runner will fetch jobs from the Gitea instance and run them automatically.
|
||||
|
||||
### Start the runner with Systemd
|
||||
|
||||
It is also possible to run act-runner as a [systemd](https://en.wikipedia.org/wiki/Systemd) service. Create an unprivileged `act_runner` user on your system, and the following file in `/etc/systemd/system/act_runner.service`. The paths in `ExecStart` and `WorkingDirectory` may need to be adjusted depending on where you installed the `act_runner` binary, its configuration file, and the home directory of the `act_runner` user.
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Gitea Actions runner
|
||||
Documentation=https://gitea.com/gitea/act_runner
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/act_runner daemon --config /etc/act_runner/config.yaml
|
||||
ExecReload=/bin/kill -s HUP $MAINPID
|
||||
WorkingDirectory=/var/lib/act_runner
|
||||
TimeoutSec=0
|
||||
RestartSec=10
|
||||
Restart=always
|
||||
User=act_runner
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```bash
|
||||
# load the new systemd unit file
|
||||
sudo systemctl daemon-reload
|
||||
# start the service and enable it at boot
|
||||
sudo systemctl enable act_runner --now
|
||||
```
|
||||
|
||||
If using Docker, the `act_runner` user should also be added to the `docker` group before starting the service. Keep in mind that this effectively gives `act_runner` root access to the system [[1]](https://docs.docker.com/engine/security/#docker-daemon-attack-surface).
|
||||
|
||||
### Start the runner with LaunchDaemon(macOS)
|
||||
|
||||
Mac uses `launchd` in place of systemd for registering daemon processes. By default daemons run as the root user, so if desired an unprivileged `_act_runner` user can be created via the `dscl` tool. The following file should then be created at the directory `/Library/LaunchDaemon/com.gitea.act_runner.plist`. The paths for `WorkingDirectory`, `ProgramArguments`, `StandardOutPath`, `StandardErrPath`, and the `HOME` environment variable may need to be updated to reflect your installation. Also note that any executables outside of the example `PATH` shown will need to be explicitly included and will not be inherited from existing configurations.
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>com.gitea.act_runner</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/local/bin/act_runner</string>
|
||||
<string>daemon</string>
|
||||
<string>--config</string>
|
||||
<string>/etc/act_runner/config.yaml</string>
|
||||
</array>
|
||||
<key>RunAtLoad</key>
|
||||
<true/>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/var/lib/act_runner</string>
|
||||
<key>StandardOutPath</key>
|
||||
<string>/var/lib/act_runner/act_runner.log</string>
|
||||
<key>StandardErrorPath</key>
|
||||
<string>/var/lib/act_runner/act_runner.err</string>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>PATH</key>
|
||||
<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
|
||||
<key>HOME</key>
|
||||
<string>/var/lib/act_runner</string>
|
||||
</dict>
|
||||
<key>UserName</key>
|
||||
<string>_act_runner</string>
|
||||
</dict>
|
||||
</plist>
|
||||
```
|
||||
|
||||
Then:
|
||||
|
||||
```bash
|
||||
sudo launchctl load /Library/LaunchDaemon/com.gitea.act_runner.plist
|
||||
```
|
||||
|
||||
You can also set up a Linux service or Windows service to let the runner run automatically.
|
||||
|
||||
## Install with the docker image
|
||||
|
||||
### Pull the image
|
||||
|
||||
You can use the docker image from the [docker hub](https://hub.docker.com/r/gitea/act_runner/tags).
|
||||
Just like the binary, you can use the latest nightly build by using the `nightly` tag, while the `latest` tag is the latest stable release.
|
||||
|
||||
```bash
|
||||
docker pull docker.io/gitea/act_runner:latest # for the latest stable release
|
||||
```
|
||||
|
||||
If you want to test newly features, you could also use nightly image
|
||||
```bash
|
||||
docker pull docker.io/gitea/act_runner:nightly # for the latest nightly build
|
||||
```
|
||||
|
||||
### Configuration
|
||||
|
||||
Configuration is optional, but you could also generate config file with docker:
|
||||
|
||||
```bash
|
||||
docker run --entrypoint="" --rm -it docker.io/gitea/act_runner:latest act_runner generate-config > config.yaml
|
||||
```
|
||||
|
||||
When you are using the docker image, you can specify the configuration file by using the `CONFIG_FILE` environment variable. Make sure that the file is mounted into the container as a volume:
|
||||
|
||||
```bash
|
||||
docker run -v $PWD/config.yaml:/config.yaml -e CONFIG_FILE=/config.yaml ...
|
||||
```
|
||||
|
||||
You may notice the commands above are both incomplete, because it is not the time to run the act runner yet.
|
||||
Before running the act runner, we need to register it to your Gitea instance first.
|
||||
|
||||
### Start the runner with docker
|
||||
|
||||
If you are using the docker image, behaviour will be slightly different. Registration and running are combined into one step in this case, so you need to specify the registration information when running the act runner.
|
||||
|
||||
A quick start with docker run like below. You need to get `<registration_token>` from the above step, and give
|
||||
a special unique name for `<runner_name>`
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
-e GITEA_INSTANCE_URL=<instance_url> \
|
||||
-e GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token> \
|
||||
-e GITEA_RUNNER_NAME=<runner_name> \
|
||||
--name my_runner \
|
||||
-d docker.io/gitea/act_runner:nightly
|
||||
```
|
||||
|
||||
There are more parameters so that you can configure it.
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
-v $PWD/config.yaml:/config.yaml \
|
||||
-v $PWD/data:/data \
|
||||
-v /var/run/docker.sock:/var/run/docker.sock \
|
||||
-e CONFIG_FILE=/config.yaml \
|
||||
-e GITEA_INSTANCE_URL=<instance_url> \
|
||||
-e GITEA_RUNNER_REGISTRATION_TOKEN=<registration_token> \
|
||||
-e GITEA_RUNNER_NAME=<runner_name> \
|
||||
-e GITEA_RUNNER_LABELS=<runner_labels> \
|
||||
--name my_runner \
|
||||
-d docker.io/gitea/act_runner:nightly
|
||||
```
|
||||
|
||||
You may notice that we have mounted the `/var/run/docker.sock` into the container.
|
||||
It is because the act runner will run jobs in docker containers, so it needs to communicate with the docker daemon.
|
||||
As mentioned, you can remove it if you want to run jobs in the host directly.
|
||||
To be clear, the "host" actually means the container which is running the act runner now, instead of the host machine.
|
||||
|
||||
### Start the runner using docker compose
|
||||
|
||||
You could also set up the runner using the following `docker-compose.yml`:
|
||||
|
||||
```yml
|
||||
version: "3.8"
|
||||
services:
|
||||
runner:
|
||||
image: docker.io/gitea/act_runner:nightly
|
||||
environment:
|
||||
CONFIG_FILE: /config.yaml
|
||||
GITEA_INSTANCE_URL: "${INSTANCE_URL}"
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN: "${REGISTRATION_TOKEN}"
|
||||
GITEA_RUNNER_NAME: "${RUNNER_NAME}"
|
||||
GITEA_RUNNER_LABELS: "${RUNNER_LABELS}"
|
||||
volumes:
|
||||
- ./config.yaml:/config.yaml
|
||||
- ./data:/data
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
```
|
||||
|
||||
When using docker, there is no requirement to enter the container and manually run `./act_runner daemon` command as shown below. Once the container has been started successfully, it will show up as an active runner in your Gitea instance.
|
||||
|
||||
## Advanced Configurations
|
||||
|
||||
### Configuring cache when starting a Runner using docker image
|
||||
|
||||
If you do not intend to use `actions/cache` in workflow, you can ignore this section.
|
||||
|
||||
If you use `actions/cache` without any additional configuration, it will return the following error:
|
||||
> Failed to restore: getCacheEntry failed: connect ETIMEDOUT IP:PORT
|
||||
|
||||
The error occurs because the runner container and job container are on different networks, so the job container cannot access the runner container.
|
||||
|
||||
Therefore, it is essential to configure the cache action to ensure its proper functioning. Follow these steps:
|
||||
|
||||
- 1.Obtain the LAN IP address of the host machine where the runner container is running.
|
||||
- 2.Find an available port number on the host machine where the runner container is running.
|
||||
- 3.Configure the following settings in the configuration file:
|
||||
|
||||
```yaml
|
||||
cache:
|
||||
enabled: true
|
||||
dir: ""
|
||||
# Use the LAN IP obtained in step 1
|
||||
host: "192.168.8.17"
|
||||
# Use the port number obtained in step 2
|
||||
port: 8088
|
||||
```
|
||||
|
||||
- 4.When starting the container, map the cache port to the host machine:
|
||||
|
||||
```bash
|
||||
docker run \
|
||||
--name gitea-docker-runner \
|
||||
-p 8088:8088 \
|
||||
-d docker.io/gitea/act_runner:nightly
|
||||
```
|
||||
|
||||
### Labels
|
||||
|
||||
The labels of a runner are used to determine which jobs the runner can run, and how to run them.
|
||||
|
||||
The default labels are `ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye,ubuntu-20.04:docker://node:16-bullseye,ubuntu-18.04:docker://node:16-buster`.
|
||||
It is a comma-separated list, and each item is a label.
|
||||
|
||||
Let's take `ubuntu-22.04:docker://node:16-bullseye` as an example.
|
||||
It means that the runner can run jobs with `runs-on: ubuntu-22.04`, and the job will be run in a docker container with the image `node:16-bullseye`.
|
||||
|
||||
If the default image is insufficient for your needs, and you have enough disk space to use a better and bigger one, you can change it to `ubuntu-22.04:docker://<the image you like>`.
|
||||
You can find more useful images on [act images](https://github.com/nektos/act/blob/master/IMAGES.md).
|
||||
|
||||
If you want to run jobs in the host directly, you can change it to `ubuntu-22.04:host` or just `ubuntu-22.04`, the `:host` is optional.
|
||||
However, we suggest you to use a special name like `linux_amd64:host` or `windows:host` to avoid misusing it.
|
||||
|
||||
Starting with Gitea 1.21, you can change labels by modifying `runners.labels` in the runner configuration file (if you don't have a configuration file, please refer to [configuration tutorials](#configuration)).
|
||||
The runner will use these new labels as soon as you restart it, i.e., by calling `./act_runner daemon --config config.yaml`.
|
||||
27
versioned_docs/version-1.24/usage/actions/badge.md
Normal file
27
versioned_docs/version-1.24/usage/actions/badge.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
date: "2023-02-25T00:00:00+00:00"
|
||||
slug: "badge"
|
||||
sidebar_position: 110
|
||||
---
|
||||
|
||||
# Badge
|
||||
|
||||
Gitea has its builtin Badge system which allows you to display the status of your repository in other places. You can use the following badges:
|
||||
|
||||
## Workflow Badge
|
||||
|
||||
The Gitea Actions workflow badge is a badge that shows the status of the latest workflow run.
|
||||
It is designed to be compatible with [GitHub Actions workflow badge](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge).
|
||||
|
||||
You can use the following URL to get the badge:
|
||||
|
||||
```
|
||||
https://your-gitea-instance.com/{owner}/{repo}/actions/workflows/{workflow_file}/badge.svg?branch={branch}&event={event}&style={style}
|
||||
```
|
||||
|
||||
- `{owner}`: The owner of the repository.
|
||||
- `{repo}`: The name of the repository.
|
||||
- `{workflow_file}`: The name of the workflow file.
|
||||
- `{branch}`: Optional. The branch of the workflow. Default to your repository's default branch.
|
||||
- `{event}`: Optional. The event of the workflow. Default to none.
|
||||
- `{style}`: Optional. Style of the badge, either `flat` or `flat-square`. Default to `flat`.
|
||||
127
versioned_docs/version-1.24/usage/actions/comparison.md
Normal file
127
versioned_docs/version-1.24/usage/actions/comparison.md
Normal file
@@ -0,0 +1,127 @@
|
||||
---
|
||||
date: "2023-04-27T15:00:00+08:00"
|
||||
slug: "comparison"
|
||||
sidebar_position: 120
|
||||
---
|
||||
|
||||
# Compared to GitHub Actions
|
||||
|
||||
Even though Gitea Actions is designed to be compatible with GitHub Actions, there are some differences between them.
|
||||
|
||||
## Additional features
|
||||
|
||||
### Absolute action URLs
|
||||
|
||||
Gitea Actions supports defining actions via absolute URL, which means that you can use actions from any git repository.
|
||||
Like `uses: https://github.com/actions/checkout@v4` or `uses: http://your_gitea.com/owner/repo@branch`.
|
||||
|
||||
### Actions written in Go
|
||||
|
||||
Gitea Actions supports writing actions in Go.
|
||||
See [Creating Go Actions](https://blog.gitea.com/creating-go-actions/).
|
||||
|
||||
### Support the non-standard syntax @yearly, @monthly, @weekly, @daily, @hourly on schedule
|
||||
|
||||
Github Actions doesn't support that. https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
|
||||
|
||||
## Unsupported workflows syntax
|
||||
|
||||
### `concurrency`
|
||||
|
||||
It's used to run a single job at a time.
|
||||
See [Using concurrency](https://docs.github.com/en/actions/using-jobs/using-concurrency).
|
||||
|
||||
It's ignored by Gitea Actions now.
|
||||
|
||||
### `run-name`
|
||||
|
||||
The name for workflow runs generated from the workflow.
|
||||
See [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#run-name).
|
||||
|
||||
It's ignored by Gitea Actions now.
|
||||
|
||||
### `permissions` and `jobs.<job_id>.permissions`
|
||||
|
||||
See [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions).
|
||||
|
||||
It's ignored by Gitea Actions now.
|
||||
|
||||
### `jobs.<job_id>.timeout-minutes`
|
||||
|
||||
See [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes).
|
||||
|
||||
It's ignored by Gitea Actions now.
|
||||
|
||||
### `jobs.<job_id>.continue-on-error`
|
||||
|
||||
See [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error).
|
||||
|
||||
It's ignored by Gitea Actions now.
|
||||
|
||||
### `jobs.<job_id>.environment`
|
||||
|
||||
See [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenvironment).
|
||||
|
||||
It's ignored by Gitea Actions now.
|
||||
|
||||
### Complex `runs-on`
|
||||
|
||||
See [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on).
|
||||
|
||||
Gitea Actions only supports `runs-on: xyz` or `runs-on: [xyz]` now.
|
||||
|
||||
## Missing features
|
||||
|
||||
### Package repository authorization
|
||||
|
||||
The `GITEA_TOKEN` for a job running within a repository should be able to publish to the associated package repository (i.e. to upload OCI images). See the "packages" scope for the "default access" in [Automatic token authentication](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication#permissions-for-the-github_token).
|
||||
|
||||
This is not implemented in Gitea Actions now. A workaround for Gitea Actions is to use a Personal Access Token (PAT). See this [github issue and comment](https://github.com/go-gitea/gitea/issues/23642#issuecomment-2119876692) for tracking this feature.
|
||||
|
||||
### Problem Matchers
|
||||
|
||||
Problem Matchers are a way to scan the output of actions for a specified regex pattern and surface that information prominently in the UI.
|
||||
See [Problem matchers](https://github.com/actions/toolkit/blob/main/docs/problem-matchers.md).
|
||||
|
||||
It's ignored by Gitea Actions now.
|
||||
|
||||
### Create an error annotation
|
||||
|
||||
See [Creating an annotation for an error](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-creating-an-annotation-for-an-error)
|
||||
|
||||
It's ignored by Gitea Actions now.
|
||||
|
||||
### Expressions
|
||||
|
||||
For [expressions](https://docs.github.com/en/actions/learn-github-actions/expressions), only [`always()`](https://docs.github.com/en/actions/learn-github-actions/expressions#always) is supported.
|
||||
|
||||
## Missing UI features
|
||||
|
||||
### Pre and Post steps
|
||||
|
||||
Pre and Post steps don't have their own section in the job log user interface.
|
||||
|
||||
### Services steps
|
||||
|
||||
Services steps don't have their own section in the job log user interface.
|
||||
|
||||
## Different behavior
|
||||
|
||||
### Downloading actions
|
||||
|
||||
Previously (Pre 1.21.0), `[actions].DEFAULT_ACTIONS_URL` defaulted to `https://gitea.com`.
|
||||
We have since restricted this option to only allow two values (`github` and `self`).
|
||||
When set to `github`, the new default, Gitea will download non-fully-qualified actions from `https://github.com`.
|
||||
For example, if you use `uses: actions/checkout@v4`, it will download the checkout repository from `https://github.com/actions/checkout.git`.
|
||||
|
||||
If you want to download an action from another git hoster, you can use an absolute URL, e.g. `uses: https://gitea.com/actions/checkout@v4`.
|
||||
|
||||
If your Gitea instance is in an intranet or a restricted area, you can set the URL to `self` to only download actions from your own instance by default.
|
||||
Of course, you can still use absolute URLs in workflows.
|
||||
|
||||
More details about the `[actions].DEFAULT_ACTIONS_URL` configuration can be found in the [Configuration Cheat Sheet](../../administration/config-cheat-sheet.md#actions-actions)。
|
||||
|
||||
### Context availability
|
||||
|
||||
Context availability is not checked, so you can use the env context on more places.
|
||||
See [Context availability](https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability).
|
||||
122
versioned_docs/version-1.24/usage/actions/design.md
Normal file
122
versioned_docs/version-1.24/usage/actions/design.md
Normal file
@@ -0,0 +1,122 @@
|
||||
---
|
||||
date: "2023-04-27T15:00:00+08:00"
|
||||
slug: "design"
|
||||
sidebar_position: 140
|
||||
---
|
||||
|
||||
# Design of Gitea Actions
|
||||
|
||||
Gitea Actions has multiple components. This document describes them individually.
|
||||
|
||||
## Act
|
||||
|
||||
The [nektos/act](https://github.com/nektos/act) project is an excellent tool that allows you to run your GitHub Actions locally.
|
||||
We were inspired by this and wondered if it would be possible to run actions for Gitea.
|
||||
|
||||
However, while [nektos/act](https://github.com/nektos/act) is designed as a command line tool, what we actually needed was a Go library with modifications specifically for Gitea.
|
||||
So we forked it as [gitea/act](https://gitea.com/gitea/act).
|
||||
|
||||
This is a soft fork that will periodically follow the upstream.
|
||||
Although some custom commits have been added, we will try our best to avoid changing too much of the original code.
|
||||
|
||||
The forked act is just a shim or adapter for Gitea's specific usage.
|
||||
There are some additional commits that have been made, such as:
|
||||
|
||||
- Outputting execution logs to logger hook so they can be reported to Gitea
|
||||
- Disabling the GraphQL URL, since Gitea doesn't support it
|
||||
- Starting a new container for every job instead of reusing to ensure isolation.
|
||||
|
||||
These modifications have no reason to be merged into the upstream.
|
||||
They don't make sense if the user just wants to run trusted actions locally.
|
||||
|
||||
However, there may be overlaps in the future, such as a required bug fix or new feature needed by both projects.
|
||||
In these cases, we will contribute the changes back to the upstream repository.
|
||||
|
||||
## Act runner
|
||||
|
||||
Gitea's runner is called act runner because it's based on act.
|
||||
|
||||
Like other CI runners, we designed it as an external part of Gitea, which means it should run on a different server than Gitea.
|
||||
|
||||
To ensure that the runner connects to the correct Gitea instance, we need to register it with a token.
|
||||
Additionally, the runner will introduce itself to Gitea and declare what kind of jobs it can run by reporting its labels.
|
||||
|
||||
Earlier, we mentioned that `runs-on: ubuntu-latest` in a workflow file means that the job will be run on a runner with the `ubuntu-latest` label.
|
||||
But how does the runner know to run `ubuntu-latest`? The answer lies in mapping the label to an environment.
|
||||
That's why when you add custom labels during registration, you will need to input some complex content like `my_custom_label:docker://centos:7`.
|
||||
This means that the runner can take the job which needs to run on `my_custom_label`, and it will run it via a docker container with the image `centos:7`.
|
||||
|
||||
Docker isn't the only option, though.
|
||||
The act also supports running jobs directly on the host.
|
||||
This is achieved through labels like `linux_arm:host`.
|
||||
This label indicates that the runner can take a job that needs to run on `linux_arm` and run it directly on the host.
|
||||
|
||||
The label's design follows the format `label[:schema[:args]]`.
|
||||
If the schema is omitted, it defaults to `host`.
|
||||
So,
|
||||
|
||||
- `my_custom_label:docker://node:18`: Run jobs labeled with `my_custom_label` using the `node:18` Docker image.
|
||||
- `my_custom_label:host`: Run jobs labeled with `my_custom_label` directly on the host.
|
||||
- `my_custom_label`: Same as `my_custom_label:host`.
|
||||
- `my_custom_label:vm:ubuntu-latest`: (Example only, not implemented) Run jobs labeled with `my_custom_label` using a virtual machine with the `ubuntu-latest` ISO.
|
||||
|
||||
## Communication protocol
|
||||
|
||||
As act runner is an independent part of Gitea, we needed a protocol for runners to communicate with the Gitea instance.
|
||||
However, we did not think it was a good idea to have Gitea listen on a new port.
|
||||
Instead, we wanted to reuse the HTTP port, which means we needed a protocol that is compatible with HTTP.
|
||||
We chose to use gRPC over HTTP.
|
||||
|
||||
We use [actions-proto-def](https://gitea.com/gitea/actions-proto-def) and [actions-proto-go](https://gitea.com/gitea/actions-proto-go) to wire them up.
|
||||
More information about gRPC can be found on [its website](https://grpc.io/).
|
||||
|
||||
## Network architecture
|
||||
|
||||
Let's examine the overall network architecture.
|
||||
This will help you troubleshoot some problems and explain why it's a bad idea to register a runner with a loopback address of the Gitea instance.
|
||||
|
||||

|
||||
|
||||
There are four network connections marked in the picture, and the direction of the arrows indicates the direction of establishing the connections.
|
||||
|
||||
### Connection 1, act runner to Gitea instance
|
||||
|
||||
The act runner must be able to connect to Gitea to receive tasks and send back the execution results.
|
||||
|
||||
### Connection 2, job containers to Gitea instance
|
||||
|
||||
The job containers have different network namespaces than the runner, even if they are on the same machine.
|
||||
They need to connect to Gitea to fetch codes if there is `actions/checkout@v4` in the workflow, for example.
|
||||
Fetching code is not always necessary to run some jobs, but it is required in most cases.
|
||||
|
||||
If you use a loopback address to register a runner, the runner can connect to Gitea when it is on the same machine.
|
||||
However, if a job container tries to fetch code from localhost, it will fail because Gitea is not in the same container.
|
||||
|
||||
### Connection 3, act runner to internet
|
||||
|
||||
When you use some actions like `actions/checkout@v4`, the act runner downloads the scripts, not the job containers.
|
||||
By default, it downloads from [github.com](http://github.com/), so it requires access to the internet. If you configure the `DEFAULT_ACTIONS_URL` to `self`, then it will download from your Gitea instance by default. Then it will not connect to internet when downloading the action itself.
|
||||
It also downloads some docker images from Docker Hub by default, which also requires internet access.
|
||||
|
||||
However, internet access is not strictly necessary.
|
||||
You can configure your Gitea instance to fetch actions or images from your intranet facilities.
|
||||
|
||||
In fact, your Gitea instance can serve as both the actions marketplace and the image registry.
|
||||
You can mirror actions repositories from GitHub to your Gitea instance, and use them as normal.
|
||||
And [Gitea Container Registry](usage/packages/container.md) can be used as a Docker image registry.
|
||||
|
||||
### Connection 4, job containers to internet
|
||||
|
||||
When using actions such as `actions/setup-go@v5`, it may be necessary to download resources from the internet to set up the Go language environment in job containers.
|
||||
Therefore, access to the internet is required for the successful completion of these actions.
|
||||
|
||||
However, it is optional as well.
|
||||
You can use your own custom actions to avoid relying on internet access, or you can use your packaged Docker image to run jobs with all dependencies installed.
|
||||
|
||||
## Summary
|
||||
|
||||
Using Gitea Actions only requires ensuring that the runner can connect to the Gitea instance.
|
||||
Internet access is optional, but not having it will require some additional work.
|
||||
In other words: The runner works best when it can query the internet itself, but you don't need to expose it to the internet (in either direction).
|
||||
|
||||
If you encounter any network issues while using Gitea Actions, hopefully the image above can help you troubleshoot them.
|
||||
168
versioned_docs/version-1.24/usage/actions/faq.md
Normal file
168
versioned_docs/version-1.24/usage/actions/faq.md
Normal file
@@ -0,0 +1,168 @@
|
||||
---
|
||||
date: "2023-04-27T15:00:00+08:00"
|
||||
slug: "faq"
|
||||
sidebar_position: 200
|
||||
---
|
||||
|
||||
# Frequently Asked Questions
|
||||
|
||||
This page contains some common questions and answers about Gitea Actions.
|
||||
|
||||
## Is it possible to disable Actions for new repositories by default for my own instance?
|
||||
|
||||
Yes, when you enable Actions for the instance, you can choose to enable the `actions` unit for all new repositories by default.
|
||||
|
||||
```ini
|
||||
[repository]
|
||||
; remove repo.actions will not enable actions for newly created repositories.
|
||||
DEFAULT_REPO_UNITS = ...,repo.actions
|
||||
```
|
||||
|
||||
## Should we use `${{ github.xyz }}` or `${{ gitea.xyz }}` in workflow files?
|
||||
|
||||
You can use `github.xyz` and Gitea will work fine.
|
||||
As mentioned, Gitea Actions is designed to be compatible with GitHub Actions.
|
||||
However, we recommend using `gitea.xyz` in case Gitea adds something that GitHub does not have to avoid different kinds of secrets in your workflow file (and because you are using this workflow on Gitea, not GitHub).
|
||||
Still, this is completely optional since both options have the same effect at the moment.
|
||||
|
||||
## Where will the runner download scripts when using actions such as `actions/checkout@v4`?
|
||||
|
||||
There are tens of thousands of [actions scripts](https://github.com/marketplace?type=actions) in GitHub, and when you write `uses: actions/checkout@v4`, it downloads the scripts from [github.com/actions/checkout](http://github.com/actions/checkout) by default.
|
||||
But what if you want to use actions from other places such as gitea.com instead of GitHub?
|
||||
|
||||
The good news is that you can specify the URL prefix to use actions from anywhere.
|
||||
This is an extra syntax in Gitea Actions.
|
||||
For example:
|
||||
|
||||
- `uses: https://gitea.com/xxx/xxx@xxx`
|
||||
- `uses: https://github.com/xxx/xxx@xxx`
|
||||
- `uses: http://your_gitea_instance.com/xxx@xxx`
|
||||
|
||||
Be careful, the `https://` or `http://` prefix is necessary!
|
||||
|
||||
This is one of the differences from GitHub Actions which supports actions scripts only from GitHub.
|
||||
But it should allow users much more flexibility in how they run Actions.
|
||||
|
||||
Alternatively, if you want your runners to download actions from your own Gitea instance by default, you can configure it by setting `[actions].DEFAULT_ACTIONS_URL`.
|
||||
See [Configuration Cheat Sheet](../../administration/config-cheat-sheet.md#actions-actions).
|
||||
|
||||
## How to limit the permission of the runners?
|
||||
|
||||
Runners have no more permissions than simply connecting to your Gitea instance.
|
||||
When any runner receives a job to run, it will temporarily gain limited permission to the repository associated with the job.
|
||||
If you want to give more permissions to the runner, allowing it to access more private repositories or external systems, you can pass [secrets](usage/actions/secrets.md) to it.
|
||||
|
||||
Refined permission control to Actions is a complicated job.
|
||||
In the future, we will add more options to Gitea to make it more configurable, such as allowing more write access to repositories or read access to all repositories in the same organization.
|
||||
|
||||
## Which operating systems are supported by act runner?
|
||||
|
||||
We released official binaries for Linux, macOS, and Windows.
|
||||
While other operating systems are theoretically supported if it is supported by golang and docker(docker mode enabled).
|
||||
|
||||
One thing to note is that if you choose to run jobs directly on the host instead of in job containers, the environmental differences between operating systems may cause unexpected failures.
|
||||
|
||||
For example, bash is not available on Windows in most cases, while act tries to use bash to run scripts by default.
|
||||
Therefore, you need to specify `powershell` as the default shell in your workflow file, see [defaults.run](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrun).
|
||||
|
||||
|
||||
```yaml
|
||||
defaults:
|
||||
run:
|
||||
shell: powershell
|
||||
```
|
||||
|
||||
## How to avoid being hacked?
|
||||
|
||||
There are two types of possible attacks: unknown runner stealing the code or secrets from your repository, or malicious scripts controlling your runner.
|
||||
|
||||
Avoiding the former means not allowing people you don't know to register runners for your repository, organization, or instance.
|
||||
|
||||
The latter is a bit more complicated.
|
||||
If you're using a private Gitea instance for your company, you may not need to worry about security since you trust your colleagues and can hold them accountable.
|
||||
|
||||
For public instances, things are a little different.
|
||||
Here's how we do it on [gitea.com](http://gitea.com/):
|
||||
|
||||
- We only register runners for the "gitea" organization, so our runners will not execute jobs from other repositories.
|
||||
- Our runners always run jobs with isolated containers. While it is possible to do this directly on the host, we choose not to for more security.
|
||||
- To run actions for fork pull requests, approval is required. See [#22803](https://github.com/go-gitea/gitea/pull/22803).
|
||||
- If someone registers their own runner for their repository or organization on [gitea.com](http://gitea.com/), we have no objections and will just not use it in our org. However, they should take care to ensure that the runner is not used by other users they do not know.
|
||||
|
||||
## Why choose GitHub Actions? Why not something compatible with GitLab CI/CD?
|
||||
|
||||
[@lunny](https://gitea.com/lunny) has explained this in the [issue to implement actions](https://github.com/go-gitea/gitea/issues/13539).
|
||||
Furthermore, Actions is not only a CI/CD system but also an automation tool.
|
||||
|
||||
There have also been numerous [marketplace actions](https://github.com/marketplace?type=actions) implemented in the open-source world.
|
||||
It is exciting to be able to reuse them.
|
||||
|
||||
## What if it runs on multiple labels, such as `runs-on: [label_a, label_b]`?
|
||||
|
||||
This is valid syntax.
|
||||
It means that it should run on runners that have both the `label_a` **and** `label_b` labels, see [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on).
|
||||
Unfortunately, act runner does not work this way until v0.2.11.
|
||||
As mentioned, we map labels to environments:
|
||||
|
||||
- `ubuntu` → `ubuntu:22.04`
|
||||
- `centos` → `centos:8`
|
||||
|
||||
But we need to map label groups to environments instead, like so:
|
||||
|
||||
- `[ubuntu]` → `ubuntu:22.04`
|
||||
- `[with-gpu]` → `linux:with-gpu`
|
||||
- `[ubuntu, with-gpu]` → `ubuntu:22.04_with-gpu`
|
||||
|
||||
We also need to re-design how tasks are assigned to runners.
|
||||
A runner with `ubuntu`, `centos`, or `with-gpu` does not necessarily indicate that it can accept jobs with `[centos, with-gpu]`.
|
||||
Therefore, the runner should inform the Gitea instance that it can only accept jobs with `[ubuntu]`, `[centos]`, `[with-gpu]`, and `[ubuntu, with-gpu]`.
|
||||
This is not a technical problem, it was just overlooked in the early design.
|
||||
See [runtime.go#L65](https://gitea.com/gitea/act_runner/src/commit/90b8cc6a7a48f45cc28b5ef9660ebf4061fcb336/runtime/runtime.go#L65).
|
||||
|
||||
Currently, the act runner attempts to match everyone in the labels and uses the first match it finds.
|
||||
|
||||
## What is the difference between agent labels and custom labels for a runner?
|
||||
|
||||

|
||||
|
||||
Agent labels are reported to the Gitea instance by the runner during registration.
|
||||
Custom labels, on the other hand, are added manually by a Gitea administrator or owners of the organization or repository (depending on the level of the runner).
|
||||
|
||||
However, the design here needs improvement, as it currently has some rough edges.
|
||||
You can add a custom label such as `centos` to a registered runner, which means the runner will receive jobs with `runs-on: centos`.
|
||||
However, the runner may not know which environment to use for this label, resulting in it using a default image or leading to a logical dead end.
|
||||
This default may not match user expectations.
|
||||
See [runtime.go#L71](https://gitea.com/gitea/act_runner/src/commit/90b8cc6a7a48f45cc28b5ef9660ebf4061fcb336/runtime/runtime.go#L71).
|
||||
|
||||
In the meantime, we suggest that you re-register your runner if you want to change its labels.
|
||||
|
||||
## Will there be more implementations for Gitea Actions runner?
|
||||
|
||||
Although we would like to provide more options, our limited manpower means that act runner will be the only officially supported runner at the moment.
|
||||
|
||||
However, both Gitea and act runner are completely open source under MIT License, so anyone can modify the code to satisfy their requirements.
|
||||
|
||||
In case you fork act runner to create your own version: Please contribute the changes back if you can and if you think your changes will help others as well.
|
||||
|
||||
## What workflow trigger events does Gitea support?
|
||||
|
||||
All events listed in this table are supported events and are compatible with GitHub.
|
||||
For events supported only by GitHub, see GitHub's [documentation](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows).
|
||||
|
||||
| trigger event | activity types |
|
||||
|-----------------------------|--------------------------------------------------------------------------------------------------------------------------|
|
||||
| create | not applicable |
|
||||
| delete | not applicable |
|
||||
| fork | not applicable |
|
||||
| gollum | not applicable |
|
||||
| push | not applicable |
|
||||
| issues | `opened`, `edited`, `closed`, `reopened`, `assigned`, `unassigned`, `milestoned`, `demilestoned`, `labeled`, `unlabeled` |
|
||||
| issue_comment | `created`, `edited`, `deleted` |
|
||||
| pull_request | `opened`, `edited`, `closed`, `reopened`, `assigned`, `unassigned`, `synchronize`, `labeled`, `unlabeled` |
|
||||
| pull_request_review | `submitted`, `edited` |
|
||||
| pull_request_review_comment | `created`, `edited` |
|
||||
| release | `published`, `edited` |
|
||||
| registry_package | `published` |
|
||||
|
||||
> For `pull_request` events, in [GitHub Actions](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request), the `ref` is `refs/pull/:prNumber/merge`, which is a reference to the merge commit preview. However, Gitea has no such reference.
|
||||
> Therefore, the `ref` in Gitea Actions is `refs/pull/:prNumber/head`, which points to the head of pull request rather than the preview of the merge commit.
|
||||
38
versioned_docs/version-1.24/usage/actions/overview.md
Normal file
38
versioned_docs/version-1.24/usage/actions/overview.md
Normal file
@@ -0,0 +1,38 @@
|
||||
---
|
||||
date: "2023-04-27T15:00:00+08:00"
|
||||
slug: "overview"
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Overview
|
||||
|
||||
Starting with Gitea **1.19**, Gitea Actions are available as a built-in CI/CD solution.
|
||||
|
||||
## Name
|
||||
|
||||
It is similar and mostly compatible to [GitHub Actions](https://github.com/features/actions), and its name is inspired by it too.
|
||||
To avoid confusion, we have clarified the spelling here:
|
||||
|
||||
- "Gitea Actions" (with an "s", both words capitalized) is the name of the Gitea feature.
|
||||
- "GitHub Actions" is the name of the GitHub feature.
|
||||
- "Actions" could refer to either of the above, depending on the context. So it refers to "Gitea Actions" in this document.
|
||||
- "action" or "actions" refer to some scripts/plugins to be used, like "actions/checkout@v4" or "actions/cache@v3".
|
||||
|
||||
## Runners
|
||||
|
||||
Just like other CI/CD solutions, Gitea doesn't run the jobs itself, but delegates the jobs to runners.
|
||||
The runner of Gitea Actions is called [act runner](https://gitea.com/gitea/act_runner), it is a standalone program and also written in Go.
|
||||
An important part of the application comes from a [fork](https://gitea.com/gitea/act) of [nektos/act](http://github.com/nektos/act).
|
||||
|
||||
Because the runner is deployed independently, there could be potential security issues.
|
||||
To avoid them, please follow two simple rules:
|
||||
|
||||
- Don't use a runner you don't trust for your repository, organization or instance.
|
||||
- Don't provide a runner to a repository, organization or instance you don't trust.
|
||||
|
||||
For Gitea instances used internally, such as instances used by enterprises or individuals, neither of these two rules is a problem, they are naturally so.
|
||||
However, for public Gitea instances, such as [gitea.com](https://gitea.com), these two rules should be kept in mind when adding or using runners.
|
||||
|
||||
## Status
|
||||
|
||||
Gitea Actions is stable enough for production usage and we use Gitea Actions in all the repositories in https://gitea.com/gitea.
|
||||
138
versioned_docs/version-1.24/usage/actions/quickstart.md
Normal file
138
versioned_docs/version-1.24/usage/actions/quickstart.md
Normal file
@@ -0,0 +1,138 @@
|
||||
---
|
||||
date: "2023-04-27T15:00:00+08:00"
|
||||
slug: "quickstart"
|
||||
sidebar_position: 10
|
||||
---
|
||||
|
||||
# Quick Start
|
||||
|
||||
This page will guide you through the process of using Gitea Actions.
|
||||
|
||||
## Set up Gitea
|
||||
|
||||
First of all, you need a Gitea instance.
|
||||
You can follow the [documentation](installation/from-package.md) to set up a new instance or upgrade your existing one.
|
||||
It doesn't matter how you install or run Gitea, as long as its version is 1.19.0 or higher.
|
||||
|
||||
Since 1.21.0, Actions are enabled by default. If you are using versions before 1.21.0, you need to add the following to the configuration file to enable it:
|
||||
|
||||
```ini
|
||||
[actions]
|
||||
ENABLED=true
|
||||
```
|
||||
|
||||
If you want to learn more or encounter any problems while configuring it, please refer to the [Configuration Cheat Sheet](../../administration/config-cheat-sheet.md#actions-actions).
|
||||
|
||||
### Set up runner
|
||||
|
||||
Gitea Actions requires [act runner](https://gitea.com/gitea/act_runner) to run the jobs.
|
||||
In order to avoid consuming too many resources and affecting the Gitea instance, it is recommended to start runners on separate machines from the Gitea instance.
|
||||
|
||||
You can use the [pre-built binaries](http://dl.gitea.com/act_runner) or the [docker images](https://hub.docker.com/r/gitea/act_runner/tags) to set up the runner.
|
||||
|
||||
Before proceeding any further, we suggest running it as a command line with pre-built binaries to ensure that it works with your environment, especially if you are running a runner on your local host.
|
||||
And it could be easier to debug if something goes wrong.
|
||||
|
||||
The runner can run the jobs in isolated Docker containers, so you need to make sure that the Docker has been installed and Docker daemon is running.
|
||||
While it is not strictly necessary, because the runner can also run the jobs directly on the host, it depends on how you configure it.
|
||||
However, it is recommended to use Docker to run the jobs, because it is more secure and easier to manage.
|
||||
|
||||
Before running a runner, you should first register it to your Gitea instance using the following command:
|
||||
|
||||
```bash
|
||||
./act_runner register --no-interactive --instance <instance> --token <token>
|
||||
```
|
||||
|
||||
There are two arguments required, `instance` and `token`.
|
||||
|
||||
`instance` refers to the address of your Gitea instance, like `http://192.168.8.8:3000` or `https://gitea.com`.
|
||||
The runner and job containers (which are started by the runner to execute jobs) will connect to this address.
|
||||
This means that it could be different from the `ROOT_URL` of your Gitea instance, which is configured for web access.
|
||||
It is always a bad idea to use a loopback address such as `127.0.0.1` or `localhost`.
|
||||
If you are unsure which address to use, the LAN address is usually the right choice.
|
||||
|
||||
`token` is used for authentication and identification, such as `P2U1U0oB4XaRCi8azcngmPCLbRpUGapalhmddh23`.
|
||||
Each token can be used to create multiple runners, until it is replaced with a new token using the reset link.
|
||||
You can obtain different levels of 'tokens' from the following places to create the corresponding level of 'runners':
|
||||
|
||||
- Instance level: The admin settings page, like `<your_gitea.com>/-/admin/actions/runners`.
|
||||
- Organization level: The organization settings page, like `<your_gitea.com>/<org>/settings/actions/runners`.
|
||||
- Repository level: The repository settings page, like `<your_gitea.com>/<owner>/<repo>/settings/actions/runners`.
|
||||
|
||||

|
||||
|
||||
After registering, a new file named `.runner` will appear in the current directory.
|
||||
This file stores the registration information.
|
||||
Please do not edit it manually.
|
||||
If this file is missing or corrupted, you can simply remove it and register again.
|
||||
|
||||
Finally, it's time to start the runner:
|
||||
|
||||
```bash
|
||||
./act_runner daemon
|
||||
```
|
||||
|
||||
And you can see the new runner in the management page:
|
||||
|
||||

|
||||
|
||||
You can find more information by visiting [Act runner](usage/actions/act-runner.md).
|
||||
|
||||
### Use Actions
|
||||
|
||||
Even if Actions is enabled for the Gitea instance, repositories still disable Actions by default.
|
||||
|
||||
To enable it, go to the settings page of your repository like `your_gitea.com/<owner>/repo/settings` and enable `Enable Repository Actions`.
|
||||
|
||||

|
||||
|
||||
The next steps may be rather complicated.
|
||||
You will need to study [the workflow syntax](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) for Actions and write the workflow files you want.
|
||||
|
||||
However, we can just start from a simple demo:
|
||||
|
||||
```yaml
|
||||
name: Gitea Actions Demo
|
||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
||||
- name: List files in the repository
|
||||
run: |
|
||||
ls ${{ gitea.workspace }}
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
```
|
||||
|
||||
:::warning
|
||||
|
||||
Certain actions may not function correctly within SHA256 repositories or when Gitea runs on subpath. This includes [actions/checkout](https://github.com/actions/checkout/issues/1843).
|
||||
|
||||
:::
|
||||
|
||||
You can upload it as a file with the extension `.yaml` in the directory `.gitea/workflows/` of the repository, for example `.gitea/workflows/demo.yaml`.
|
||||
You might notice that this is fairly similar from the [Quickstart for GitHub Actions](https://docs.github.com/en/actions/quickstart).
|
||||
That is because Gitea Actions is designed to be compatible with GitHub Actions wherever possible.
|
||||
|
||||
Be careful, the demo file contains some emojis.
|
||||
Please make sure your database supports them, especially when using MySQL.
|
||||
If the charset is not `utf8mb4`, errors will occur, such as `Error 1366 (HY000): Incorrect string value: '\\xF0\\x9F\\x8E\\x89 T...' for column 'name' at row 1`.
|
||||
See [Database Preparation](../../installation/database-preparation.md#mysqlmariadb) for more information.
|
||||
|
||||
Alternatively, you can remove all emojis from the demo file and try again.
|
||||
|
||||
The line `on: [push]` indicates that the workflow will be triggered when you push commits to this repository.
|
||||
However, when you upload the YAML file, it also pushes a commit, so you should see a new task in the Actions tab.
|
||||
|
||||

|
||||
|
||||
Great job! You have successfully started working with Actions.
|
||||
35
versioned_docs/version-1.24/usage/actions/secrets.md
Normal file
35
versioned_docs/version-1.24/usage/actions/secrets.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
date: "2024-07-10T09:23:00+02:00"
|
||||
slug: "secrets"
|
||||
sidebar_position: 50
|
||||
---
|
||||
|
||||
# Secrets
|
||||
|
||||
Secrets allow you to store sensitive information in your user, organization or repository.
|
||||
Secrets are available on Gitea 1.19+ and are only visible in 1.20+ when ACTIONS are enabled.
|
||||
|
||||
# Naming your secrets
|
||||
|
||||
The following rules apply to secret names:
|
||||
|
||||
- Secret names can only contain alphanumeric characters (`[a-z]`, `[A-Z]`, `[0-9]`) or underscores (`_`). Spaces are not allowed.
|
||||
|
||||
- Secret names must not start with the `GITHUB_` and `GITEA_` prefix.
|
||||
|
||||
- Secret names must not start with a number.
|
||||
|
||||
- Secret names are not case-sensitive.
|
||||
|
||||
- Secret names must be unique at the level they are created at.
|
||||
|
||||
For example, a secret created at the repository level must have a unique name in that repository, and a secret created at the organization level must have a unique name at that level.
|
||||
|
||||
### Using secrets
|
||||
|
||||
After creating configuration variables, they will be automatically filled in the `secrets` context.
|
||||
They can be accessed through expressions like `${{ secrets.SECRET_NAME }}` in the workflow.
|
||||
|
||||
### Precedence
|
||||
|
||||
If a secret with the same name exists at multiple levels, the secret at the lowest level takes precedence. For example, if an organization-level secret has the same name as a repository-level secret, then the repository-level secret takes precedence.
|
||||
32
versioned_docs/version-1.24/usage/actions/variables.md
Normal file
32
versioned_docs/version-1.24/usage/actions/variables.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
date: "2024-04-10T22:21:00+08:00"
|
||||
slug: "actions-variables"
|
||||
sidebar_position: 25
|
||||
---
|
||||
|
||||
# Variables
|
||||
|
||||
You can create configuration variables on the user, organization and repository level.
|
||||
The level of the variable depends on where you created it. When creating a variable, the
|
||||
key will be converted to uppercase. You need use uppercase on the yaml file.
|
||||
|
||||
## Naming conventions
|
||||
|
||||
The following rules apply to variable names:
|
||||
|
||||
- Variable names can only contain alphanumeric characters (`[a-z]`, `[A-Z]`, `[0-9]`) or underscores (`_`). Spaces are not allowed.
|
||||
- Variable names must not start with the `GITHUB_` and `GITEA_` prefix.
|
||||
- Variable names must not start with a number.
|
||||
- Variable names are case-insensitive.
|
||||
- Variable names must be unique at the level they are created at.
|
||||
- Variable names must not start with `CI`.
|
||||
|
||||
## Using variable
|
||||
|
||||
After creating configuration variables, they will be automatically filled in the `vars` context.
|
||||
They can be accessed through expressions like `${{ vars.VARIABLE_NAME }}` in the workflow.
|
||||
|
||||
## Precedence
|
||||
|
||||
If a variable with the same name exists at multiple levels, the variable at the lowest level takes precedence:
|
||||
A repository variable will always be chosen over an organization/user variable.
|
||||
48
versioned_docs/version-1.24/usage/agit.md
Normal file
48
versioned_docs/version-1.24/usage/agit.md
Normal file
@@ -0,0 +1,48 @@
|
||||
---
|
||||
date: " 2022-09-01T20:50:42+0000"
|
||||
slug: "agit"
|
||||
sidebar_position: 12
|
||||
aliases:
|
||||
- /en-us/agit-setup
|
||||
- /agit-setup
|
||||
---
|
||||
|
||||
# AGit
|
||||
|
||||
In Gitea `1.13`, support for [AGit](https://git-repo.info/en/2020/03/agit-flow-and-git-repo/) was added. AGit enables users to create pull requests directly, even without write permissions of the repository, eliminating the need to fork it. This helps reduce the number of duplicated repositories and minimizes unnecessary disk usage.
|
||||
|
||||
:::note
|
||||
Git version 2.29 or higher is required on the server side for this to work.
|
||||
:::
|
||||
|
||||
## Creating PRs with AGit
|
||||
|
||||
AGit allows to create PRs while pushing code to the remote repo.
|
||||
This can be done by pushing to the branch followed by a specific refspec (a location identifier known to git).
|
||||
The following example illustrates this:
|
||||
|
||||
```shell
|
||||
git push origin HEAD:refs/for/main
|
||||
```
|
||||
|
||||
The command has the following structure:
|
||||
|
||||
- `HEAD`: The target branch
|
||||
- `origin`: The target repository (not a fork!)
|
||||
- `HEAD`: The local branch containing the changes you are proposing
|
||||
- `refs/<for|draft|for-review>/<branch>`: The target PR type and configuration
|
||||
- `for`: Create a normal PR with `<branch>` as the target branch
|
||||
- `draft`/`for-review`: Currently ignored silently
|
||||
- `<branch>/`: The branch you want your changes to be merged into
|
||||
- `-o <topic|title|description>`: Options for the PR
|
||||
- `topic`: The topic of this change. It will become the name of the branch holding the changes waiting for review. This is REQUIRED to trigger a pull request.
|
||||
- `title`: The PR title (optional but recommended), only used for topics not already having an associated PR.
|
||||
- `description`: The PR description (optional but recommended), only used for topics not already having an associated PR.
|
||||
- `force-push=true`: Specifies whether to force-update the target branch.
|
||||
- Note: omitting the value and using just `-o force-push` will also work.
|
||||
|
||||
Here's another advanced example for creating a new PR targeting `main` with `topic`, `title`, and `description`:
|
||||
|
||||
```shell
|
||||
git push origin HEAD:refs/for/main -o topic="topic_of_my_PR" -o title="Title of the PR" -o description="# The PR Description\nThis can be **any** markdown content.\n- [x] Ok"
|
||||
```
|
||||
29
versioned_docs/version-1.24/usage/blame.md
Normal file
29
versioned_docs/version-1.24/usage/blame.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
date: "2023-08-14T00:00:00+00:00"
|
||||
slug: "blame"
|
||||
sidebar_position: 13
|
||||
aliases:
|
||||
- /en-us/blame
|
||||
---
|
||||
|
||||
# Blame File View
|
||||
|
||||
Gitea supports viewing the line-by-line revision history for a file also known as blame view.
|
||||
You can also use [`git blame`](https://git-scm.com/docs/git-blame) on the command line to view the revision history of lines within a file.
|
||||
|
||||
1. Navigate to and open the file whose line history you want to view.
|
||||
1. Click the `Blame` button in the file header bar.
|
||||
1. The new view shows the line-by-line revision history for a file with author and commit information on the left side.
|
||||
1. To navigate to an older commit, click the  icon.
|
||||
|
||||
## Ignore commits in the blame view
|
||||
|
||||
All revisions specified in the `.git-blame-ignore-revs` file are hidden from the blame view.
|
||||
This is especially useful to hide reformatting changes and keep the benefits of `git blame`.
|
||||
Lines that were changed or added by an ignored commit will be blamed on the previous commit that changed that line or nearby lines.
|
||||
The `.git-blame-ignore-revs` file must be located in the root directory of the repository.
|
||||
For more information like the file format, see [the `git blame --ignore-revs-file` documentation](https://git-scm.com/docs/git-blame#Documentation/git-blame.txt---ignore-revs-fileltfilegt).
|
||||
|
||||
### Bypassing `.git-blame-ignore-revs` in the blame view
|
||||
|
||||
If the blame view for a file shows a message about ignored revisions, you can see the normal blame view by appending the url parameter `?bypass-blame-ignore=true`.
|
||||
47
versioned_docs/version-1.24/usage/blocking-users.md
Normal file
47
versioned_docs/version-1.24/usage/blocking-users.md
Normal file
@@ -0,0 +1,47 @@
|
||||
---
|
||||
date: "2024-01-31T00:00:00+00:00"
|
||||
slug: "blocking-user"
|
||||
sidebar_position: 25
|
||||
aliases:
|
||||
- /en-us/webhooks
|
||||
---
|
||||
|
||||
# Blocking a user
|
||||
|
||||
Gitea supports blocking of users to restrict how they can interact with you and your content.
|
||||
|
||||
You can block a user in your account settings, from the user's profile or from comments created by the user.
|
||||
The user is not directly notified about the block, but they can notice they are blocked when they attempt to interact with you.
|
||||
Organization owners can block anyone who is not a member of the organization too.
|
||||
If a blocked user has admin permissions, they can still perform all actions even if blocked.
|
||||
|
||||
### When you block a user
|
||||
|
||||
- the user stops following you
|
||||
- you stop following the user
|
||||
- the user's stars are removed from your repositories
|
||||
- your stars are removed from their repositories
|
||||
- the user stops watching your repositories
|
||||
- you stop watching their repositories
|
||||
- the user's issue assignments are removed from your repositories
|
||||
- your issue assignments are removed from their repositories
|
||||
- the user is removed as a collaborator on your repositories
|
||||
- you are removed as a collaborator on their repositories
|
||||
- any pending repository transfers to or from the blocked user are canceled
|
||||
|
||||
### When you block a user, the user cannot
|
||||
|
||||
- follow you
|
||||
- watch your repositories
|
||||
- star your repositories
|
||||
- fork your repositories
|
||||
- transfer repositories to you
|
||||
- open issues or pull requests on your repositories
|
||||
- comment on issues or pull requests you've created
|
||||
- comment on issues or pull requests on your repositories
|
||||
- react to your comments on issues or pull requests
|
||||
- react to comments on issues or pull requests on your repositories
|
||||
- assign you to issues or pull requests
|
||||
- add you as a collaborator on their repositories
|
||||
- send you notifications by @mentioning your username
|
||||
- be added as team member (if blocked by an organization)
|
||||
30
versioned_docs/version-1.24/usage/clone-filter.md
Normal file
30
versioned_docs/version-1.24/usage/clone-filter.md
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
date: "2021-02-02"
|
||||
slug: "clone-filters"
|
||||
sidebar_position: 25
|
||||
aliases:
|
||||
- /en-us/clone-filters
|
||||
---
|
||||
|
||||
# Clone filters (partial clone)
|
||||
|
||||
Git introduces `--filter` option to `git clone` command, which filters out
|
||||
large files and objects (such as blobs) to create partial clone of a repo.
|
||||
Clone filters are especially useful for large repo and/or metered connection,
|
||||
where full clone (without `--filter`) can be expensive (as all history data
|
||||
must be downloaded).
|
||||
|
||||
This requires Git version 2.22 or later, both on the Gitea server and on the
|
||||
client. For clone filters to work properly, make sure that Git version
|
||||
on the client is at least the same as on the server (or later). Login to
|
||||
Gitea server as admin and head to Site Administration -> Configuration to
|
||||
see Git version of the server.
|
||||
|
||||
By default, clone filters are enabled, unless `DISABLE_PARTIAL_CLONE` under
|
||||
`[git]` is set to `true`.
|
||||
|
||||
See [GitHub blog post: Get up to speed with partial clone](https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/)
|
||||
for common use cases of clone filters (blobless and treeless clones), and
|
||||
[GitLab docs for partial clone](https://docs.gitlab.com/ee/topics/git/partial_clone.html)
|
||||
for more advanced use cases (such as filter by file size and remove
|
||||
filters to turn partial clone into full clone).
|
||||
56
versioned_docs/version-1.24/usage/code-owners.md
Normal file
56
versioned_docs/version-1.24/usage/code-owners.md
Normal file
@@ -0,0 +1,56 @@
|
||||
---
|
||||
date: "2023-05-24T16:00:00+00:00"
|
||||
slug: "code-owners"
|
||||
sidebar_position: 30
|
||||
aliases:
|
||||
- /en-us/code-owners
|
||||
---
|
||||
|
||||
# Code Owners
|
||||
|
||||
Gitea maintains code owner files. It looks for it in the following locations in this order:
|
||||
|
||||
- `./CODEOWNERS`
|
||||
- `./docs/CODEOWNERS`
|
||||
- `./.gitea/CODEOWNERS`
|
||||
|
||||
And stops at the first found file.
|
||||
|
||||
File format: `<regexp rule> <@user or @org/team> [@user or @org/team]...`
|
||||
|
||||
Regexp specified in golang Regex format.
|
||||
Regexp can start with `!` for negative rules - match all files except specified.
|
||||
|
||||
Example file:
|
||||
|
||||
```bash
|
||||
.*\\.go @user1 @user2 # This is comment
|
||||
|
||||
# Comment too
|
||||
# You can assigning code owning for users or teams
|
||||
frontend/src/.*\\.js @org1/team1 @org1/team2 @user3
|
||||
|
||||
# You can use negative pattern
|
||||
!frontend/src/.* @org1/team3 @user5
|
||||
|
||||
# You can use power of go regexp
|
||||
docs/(aws|google|azure)/[^/]*\\.(md|txt) @user8 @org1/team4
|
||||
!/assets/.*\\.(bin|exe|msi) @user9
|
||||
```
|
||||
|
||||
### Escaping
|
||||
|
||||
You can escape characters `#`, ` ` (space) and `\` with `\`, like:
|
||||
|
||||
```
|
||||
dir/with\#hashtag @user1
|
||||
path\ with\ space @user2
|
||||
path/with\\backslash @user3
|
||||
```
|
||||
|
||||
Some character (`.+*?()|[]{}^$\`) should be escaped with `\\` inside regexp, like:
|
||||
|
||||
```
|
||||
path/\\.with\\.dots
|
||||
path/with\\+plus
|
||||
```
|
||||
37
versioned_docs/version-1.24/usage/incoming-email.md
Normal file
37
versioned_docs/version-1.24/usage/incoming-email.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
date: "2022-12-01T00:00:00+00:00"
|
||||
slug: "incoming-email"
|
||||
sidebar_position: 13
|
||||
aliases:
|
||||
- /en-us/incoming-email
|
||||
---
|
||||
|
||||
# Incoming Email
|
||||
|
||||
Gitea supports the execution of several actions through incoming mails. This page describes how to set this up.
|
||||
|
||||
## Requirements
|
||||
|
||||
Handling incoming email messages requires an IMAP-enabled email account.
|
||||
The recommended strategy is to use [email sub-addressing](https://en.wikipedia.org/wiki/Email_address#Sub-addressing) but a catch-all mailbox does work too.
|
||||
The receiving email address contains a user/action specific token which tells Gitea which action should be performed.
|
||||
This token is expected in the `To` and `Delivered-To` header fields.
|
||||
|
||||
Gitea tries to detect automatic responses to skip and the email server should be configured to reduce the incoming noise too (spam, newsletter).
|
||||
|
||||
## Configuration
|
||||
|
||||
To activate the handling of incoming email messages you have to configure the `email.incoming` section in the configuration file.
|
||||
|
||||
The `REPLY_TO_ADDRESS` contains the address an email client will respond to.
|
||||
This address needs to contain the `%{token}` placeholder which will be replaced with a token describing the user/action.
|
||||
This placeholder must only appear once in the address and must be in the user part of the address (before the `@`).
|
||||
|
||||
An example using email sub-addressing may look like this: `incoming+%{token}@example.com`
|
||||
|
||||
If a catch-all mailbox is used, the placeholder may be used anywhere in the user part of the address: `incoming+%{token}@example.com`, `incoming_%{token}@example.com`, `%{token}@example.com`
|
||||
|
||||
## Security
|
||||
|
||||
Be careful when choosing the domain used for receiving incoming email.
|
||||
It's recommended receiving incoming email on a subdomain, such as `incoming.example.com` to prevent potential security problems with other services running on `example.com`.
|
||||
@@ -0,0 +1,328 @@
|
||||
---
|
||||
date: "2018-05-10T16:00:00+02:00"
|
||||
slug: "issue-pull-request-templates"
|
||||
sidebar_position: 15
|
||||
aliases:
|
||||
- /en-us/issue-pull-request-templates
|
||||
---
|
||||
|
||||
# Issue and Pull Request Templates
|
||||
|
||||
Some projects have a standard list of questions that users need to answer
|
||||
when creating an issue or pull request. Gitea supports adding templates to the
|
||||
**default branch of the repository** so that they can autopopulate the form when users are
|
||||
creating issues and pull requests. This will cut down on the initial back and forth
|
||||
of getting some clarifying details.
|
||||
It is currently not possible to provide generic issue/pull-request templates globally.
|
||||
|
||||
Additionally, the New Issue page URL can be suffixed with `?title=Issue+Title&body=Issue+Text` and the form will be populated with those strings. Those strings will be used instead of the template if there is one.
|
||||
|
||||
## File names
|
||||
|
||||
Possible file names for issue templates:
|
||||
|
||||
- `ISSUE_TEMPLATE.md`
|
||||
- `ISSUE_TEMPLATE.yaml`
|
||||
- `ISSUE_TEMPLATE.yml`
|
||||
- `issue_template.md`
|
||||
- `issue_template.yaml`
|
||||
- `issue_template.yml`
|
||||
- `.gitea/ISSUE_TEMPLATE.md`
|
||||
- `.gitea/ISSUE_TEMPLATE.yaml`
|
||||
- `.gitea/ISSUE_TEMPLATE.yml`
|
||||
- `.gitea/issue_template.md`
|
||||
- `.gitea/issue_template.yaml`
|
||||
- `.gitea/issue_template.yml`
|
||||
- `.github/ISSUE_TEMPLATE.md`
|
||||
- `.github/ISSUE_TEMPLATE.yaml`
|
||||
- `.github/ISSUE_TEMPLATE.yml`
|
||||
- `.github/issue_template.md`
|
||||
- `.github/issue_template.yaml`
|
||||
- `.github/issue_template.yml`
|
||||
|
||||
Possible file names for issue config:
|
||||
|
||||
- `.gitea/ISSUE_TEMPLATE/config.yaml`
|
||||
- `.gitea/ISSUE_TEMPLATE/config.yml`
|
||||
- `.gitea/issue_template/config.yaml`
|
||||
- `.gitea/issue_template/config.yml`
|
||||
- `.github/ISSUE_TEMPLATE/config.yaml`
|
||||
- `.github/ISSUE_TEMPLATE/config.yml`
|
||||
- `.github/issue_template/config.yaml`
|
||||
- `.github/issue_template/config.yml`
|
||||
|
||||
Possible file names for PR templates:
|
||||
|
||||
- `PULL_REQUEST_TEMPLATE.md`
|
||||
- `PULL_REQUEST_TEMPLATE.yaml`
|
||||
- `PULL_REQUEST_TEMPLATE.yml`
|
||||
- `pull_request_template.md`
|
||||
- `pull_request_template.yaml`
|
||||
- `pull_request_template.yml`
|
||||
- `.gitea/PULL_REQUEST_TEMPLATE.md`
|
||||
- `.gitea/PULL_REQUEST_TEMPLATE.yaml`
|
||||
- `.gitea/PULL_REQUEST_TEMPLATE.yml`
|
||||
- `.gitea/pull_request_template.md`
|
||||
- `.gitea/pull_request_template.yaml`
|
||||
- `.gitea/pull_request_template.yml`
|
||||
- `.github/PULL_REQUEST_TEMPLATE.md`
|
||||
- `.github/PULL_REQUEST_TEMPLATE.yaml`
|
||||
- `.github/PULL_REQUEST_TEMPLATE.yml`
|
||||
- `.github/pull_request_template.md`
|
||||
- `.github/pull_request_template.yaml`
|
||||
- `.github/pull_request_template.yml`
|
||||
|
||||
## Directory names
|
||||
|
||||
Alternatively, users can create multiple issue templates inside a special directory and allow users to choose one that more specifically
|
||||
addresses their problem.
|
||||
|
||||
Possible directory names for issue templates:
|
||||
|
||||
- `ISSUE_TEMPLATE`
|
||||
- `issue_template`
|
||||
- `.gitea/ISSUE_TEMPLATE`
|
||||
- `.gitea/issue_template`
|
||||
- `.github/ISSUE_TEMPLATE`
|
||||
- `.github/issue_template`
|
||||
- `.gitlab/ISSUE_TEMPLATE`
|
||||
- `.gitlab/issue_template`
|
||||
|
||||
Inside the directory can be multiple markdown (`.md`) or yaml (`.yaml`/`.yml`) issue templates of the form.
|
||||
|
||||
## Syntax for markdown template
|
||||
|
||||
```md
|
||||
---
|
||||
|
||||
name: "Template Name"
|
||||
about: "This template is for testing!"
|
||||
title: "[TEST] "
|
||||
ref: "main"
|
||||
assignees: ["user1"]
|
||||
labels:
|
||||
|
||||
- bug
|
||||
- "help needed"
|
||||
|
||||
---
|
||||
|
||||
This is the template!
|
||||
```
|
||||
|
||||
In the above example, when a user is presented with the list of issues they can submit, this would show as `Template Name` with the description
|
||||
`This template is for testing!`. When submitting an issue with the above example, the issue title would be pre-populated with
|
||||
`[TEST] ` while the issue body would be pre-populated with `This is the template!`.
|
||||
The issue would be assigned to `user1`.
|
||||
The issue would also be assigned two labels,
|
||||
`bug` and `help needed`, and the issue will have a reference to `main`.
|
||||
|
||||
## Syntax for yaml template
|
||||
|
||||
This example YAML configuration file defines an issue form using several inputs to report a bug.
|
||||
|
||||
```yaml
|
||||
name: Bug Report
|
||||
about: File a bug report
|
||||
title: "[Bug]: "
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for taking the time to fill out this bug report!
|
||||
# some markdown that will only be visible once the issue has been created
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
This issue was created by an issue **template** :)
|
||||
visible: [content]
|
||||
- type: input
|
||||
id: contact
|
||||
attributes:
|
||||
label: Contact Details
|
||||
description: How can we get in touch with you if we need more info?
|
||||
placeholder: ex. email@example.com
|
||||
validations:
|
||||
required: false
|
||||
- type: textarea
|
||||
id: what-happened
|
||||
attributes:
|
||||
label: What happened?
|
||||
description: Also tell us, what did you expect to happen?
|
||||
placeholder: Tell us what you see!
|
||||
value: "A bug happened!"
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: version
|
||||
attributes:
|
||||
label: Version
|
||||
description: What version of our software are you running?
|
||||
options:
|
||||
- 1.0.2 (Default)
|
||||
- 1.0.3 (Edge)
|
||||
validations:
|
||||
required: true
|
||||
- type: dropdown
|
||||
id: browsers
|
||||
attributes:
|
||||
label: What browsers are you seeing the problem on?
|
||||
multiple: true
|
||||
options:
|
||||
- Firefox
|
||||
- Chrome
|
||||
- Safari
|
||||
- Microsoft Edge
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
||||
render: shell
|
||||
- type: checkboxes
|
||||
id: terms
|
||||
attributes:
|
||||
label: Code of Conduct
|
||||
hide_label: true
|
||||
description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com)
|
||||
options:
|
||||
- label: I agree to follow this project's Code of Conduct
|
||||
required: true
|
||||
- label: I have also read the CONTRIBUTION.MD
|
||||
required: true
|
||||
visible: [form]
|
||||
- label: This is a TODO only visible after issue creation
|
||||
visible: [content]
|
||||
```
|
||||
|
||||
### Markdown
|
||||
|
||||
You can use a `markdown` element to display Markdown in your form that provides extra context to the user, but is not submitted by default.
|
||||
|
||||
Attributes:
|
||||
|
||||
| Key | Description | Required | Type | Default | Valid values |
|
||||
|-------|--------------------------------------------------------------|----------|--------|---------|--------------|
|
||||
| value | The text that is rendered. Markdown formatting is supported. | Required | String | - | - |
|
||||
|
||||
visible: Default is **[form]**
|
||||
|
||||
### Textarea
|
||||
|
||||
You can use a `textarea` element to add a multi-line text field to your form. Contributors can also attach files in `textarea` fields.
|
||||
|
||||
Attributes:
|
||||
|
||||
| Key | Description | Required | Type | Default | Valid values |
|
||||
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|---------|--------------|---------------------------|
|
||||
| label | A brief description of the expected user input, which is also displayed in the form. | Required | String | - | - |
|
||||
| hide_label | If true, the label normally used as a headline is not visible. | Optional | Boolean | false | - |
|
||||
| description | A description of the text area to provide context or guidance, which is displayed in the form. | Optional | String | Empty String | - |
|
||||
| placeholder | A semi-opaque placeholder that renders in the text area when empty. | Optional | String | Empty String | - |
|
||||
| value | Text that is pre-filled in the text area. | Optional | String | - | - |
|
||||
| render | If a value is provided, submitted text will be formatted into a codeblock. When this key is provided, the text area will not expand for file attachments or Markdown editing. | Optional | String | - | Languages known to Gitea. |
|
||||
|
||||
Validations:
|
||||
|
||||
| Key | Description | Required | Type | Default | Valid values |
|
||||
|----------|------------------------------------------------------|----------|---------|---------|--------------|
|
||||
| required | Prevents form submission until element is completed. | Optional | Boolean | false | - |
|
||||
|
||||
visible: Default is **[form, content]**
|
||||
|
||||
### Input
|
||||
|
||||
You can use an `input` element to add a single-line text field to your form.
|
||||
|
||||
Attributes:
|
||||
|
||||
| Key | Description | Required | Type | Default | Valid values |
|
||||
|-------------|--------------------------------------------------------------------------------------------|----------|---------|--------------|--------------|
|
||||
| label | A brief description of the expected user input, which is also displayed in the form. | Required | String | - | - |
|
||||
| hide_label | If true, the label normally used as a headline is not visible. | Optional | Boolean | false | - |
|
||||
| description | A description of the field to provide context or guidance, which is displayed in the form. | Optional | String | Empty String | - |
|
||||
| placeholder | A semi-transparent placeholder that renders in the field when empty. | Optional | String | Empty String | - |
|
||||
| value | Text that is pre-filled in the field. | Optional | String | - | - |
|
||||
|
||||
Validations:
|
||||
|
||||
| Key | Description | Required | Type | Default | Valid values |
|
||||
|-----------|--------------------------------------------------------------------------------------------------|----------|---------|---------|--------------------------------------------------------------------------|
|
||||
| required | Prevents form submission until element is completed. | Optional | Boolean | false | - |
|
||||
| is_number | Prevents form submission until element is filled with a number. | Optional | Boolean | false | - |
|
||||
| regex | Prevents form submission until element is filled with a value that match the regular expression. | Optional | String | - | a [regular expression](https://en.wikipedia.org/wiki/Regular_expression) |
|
||||
|
||||
visible: Default is **[form, content]**
|
||||
|
||||
### Dropdown
|
||||
|
||||
You can use a `dropdown` element to add a dropdown menu in your form.
|
||||
|
||||
Attributes:
|
||||
|
||||
| Key | Description | Required | Type | Default | Valid values |
|
||||
|-------------|-----------------------------------------------------------------------------------------------------|----------|--------------|--------------|--------------|
|
||||
| label | A brief description of the expected user input, which is displayed in the form. | Required | String | - | - |
|
||||
| hide_label | If true, the label normally used as a headline is not visible. | Optional | Boolean | false | - |
|
||||
| description | A description of the dropdown to provide extra context or guidance, which is displayed in the form. | Optional | String | Empty String | - |
|
||||
| multiple | Determines if the user can select more than one option. | Optional | Boolean | false | - |
|
||||
| list | If true, display as a list. If false, print items on one line with commas. | Optional | Boolean | false | - |
|
||||
| options | An array of options the user can choose from. Cannot be empty and all choices must be distinct. | Required | String array | - | - |
|
||||
|
||||
Validations:
|
||||
|
||||
| Key | Description | Required | Type | Default | Valid values |
|
||||
|----------|------------------------------------------------------|----------|---------|---------|--------------|
|
||||
| required | Prevents form submission until element is completed. | Optional | Boolean | false | - |
|
||||
|
||||
visible: Default is **[form, content]**
|
||||
|
||||
### Checkboxes
|
||||
|
||||
You can use the `checkboxes` element to add a set of checkboxes to your form.
|
||||
|
||||
Attributes:
|
||||
|
||||
| Key | Description | Required | Type | Default | Valid values |
|
||||
|-------------|-------------------------------------------------------------------------------------------------------|----------|---------|--------------|--------------|
|
||||
| label | A brief description of the expected user input, which is displayed in the form. | Required | String | - | - |
|
||||
| hide_label | If true, the label normally used as a headline is not visible. | Optional | Boolean | false | - |
|
||||
| description | A description of the set of checkboxes, which is displayed in the form. Supports Markdown formatting. | Optional | String | Empty String | - |
|
||||
| options | An array of checkboxes that the user can select. For syntax, see below. | Required | Array | - | - |
|
||||
|
||||
For each value in the options array, you can set the following keys.
|
||||
|
||||
| Key | Description | Required | Type | Default | Options |
|
||||
|--------------|------------------------------------------------------------------------------------------------------------------------------------------|----------|--------------|---------|---------|
|
||||
| label | The identifier for the option, which is displayed in the form. Markdown is supported for bold or italic text formatting, and hyperlinks. | Required | String | - | - |
|
||||
| required | Prevents form submission until element is completed. | Optional | Boolean | false | - |
|
||||
| visible | Whether a specific checkbox appears in the form only, in the created issue only, or both. Valid options are "form" and "content". | Optional | String array | false | - |
|
||||
|
||||
visible: Default is **[form, content]**
|
||||
|
||||
## Syntax for issue config
|
||||
|
||||
This is a example for a issue config file
|
||||
|
||||
```yaml
|
||||
blank_issues_enabled: true
|
||||
contact_links:
|
||||
- name: Gitea
|
||||
url: https://gitea.com
|
||||
about: Visit the Gitea Website
|
||||
```
|
||||
|
||||
### Possible Options
|
||||
|
||||
| Key | Description | Type | Default |
|
||||
|----------------------|-------------------------------------------------------|--------------------|-------------|
|
||||
| blank_issues_enabled | If set to false, the User is forced to use a Template | Boolean | true |
|
||||
| contact_links | Custom Links to show in the Choose Box | Contact Link Array | Empty Array |
|
||||
|
||||
### Contact Link
|
||||
|
||||
| Key | Description | Type | Required |
|
||||
|-------|----------------------------------|--------|----------|
|
||||
| name | the name of your link | String | true |
|
||||
| url | The URL of your Link | String | true |
|
||||
| about | A short description of your Link | String | true |
|
||||
33
versioned_docs/version-1.24/usage/labels.md
Normal file
33
versioned_docs/version-1.24/usage/labels.md
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
date: "2023-03-04T19:00:00+00:00"
|
||||
slug: "labels"
|
||||
sidebar_position: 13
|
||||
aliases:
|
||||
- /en-us/labels
|
||||
---
|
||||
|
||||
# Labels
|
||||
|
||||
You can use labels to classify issues and pull requests and to improve your overview over them.
|
||||
|
||||
## Creating Labels
|
||||
|
||||
For repositories, labels can be created by going to `Issues` and clicking on `Labels`.
|
||||
|
||||
For organizations, you can define organization-wide labels that are shared with all organization repositories, including both already-existing repositories as well as newly created ones. Organization-wide labels can be created in the organization `Settings`.
|
||||
|
||||
Labels have a mandatory name, a mandatory color, an optional description, and must either be exclusive or not (see `Scoped Labels` below).
|
||||
|
||||
When you create a repository, you can ensure certain labels exist by using the `Issue Labels` option. This option lists a number of available label sets that are [configured globally on your instance](../administration/customizing-gitea.md#labels). Its contained labels will all be created as well while creating the repository.
|
||||
|
||||
## Scoped Labels
|
||||
|
||||
Scoped labels are used to ensure at most a single label with the same scope is assigned to an issue or pull request. For example, if labels `kind/bug` and `kind/enhancement` have the Exclusive option set, an issue can only be classified as a bug or an enhancement.
|
||||
|
||||
A scoped label must contain `/` in its name (not at either end of the name). The scope of a label is determined based on the **last** `/`, so for example the scope of label `scope/subscope/item` is `scope/subscope`.
|
||||
|
||||
## Filtering by Label
|
||||
|
||||
Issue and pull request lists can be filtered by label. Selecting multiple labels shows issues and pull requests that have all selected labels assigned.
|
||||
|
||||
By holding alt to click the label, issues and pull requests with the chosen label are excluded from the list.
|
||||
194
versioned_docs/version-1.24/usage/linked-references.md
Normal file
194
versioned_docs/version-1.24/usage/linked-references.md
Normal file
@@ -0,0 +1,194 @@
|
||||
---
|
||||
date: "2019-11-21T17:00:00-03:00"
|
||||
slug: "automatically-linked-references"
|
||||
sidebar_position: 15
|
||||
aliases:
|
||||
- /en-us/automatically-linked-references
|
||||
---
|
||||
|
||||
# Automatically Linked References
|
||||
|
||||
When an issue, pull request or comment is posted, the text description is parsed
|
||||
in search for references. These references will be shown as links in the Issue View
|
||||
and, in some cases, produce certain _actions_.
|
||||
|
||||
Likewise, commit messages are parsed when they are listed, and _actions_
|
||||
can be triggered when they are pushed to the main branch.
|
||||
|
||||
To prevent the creation of unintended references, there are certain rules
|
||||
for them to be recognized. For example, they should not be included inside code
|
||||
text. They should also be reasonably cleared from their surrounding text
|
||||
(for example, using spaces).
|
||||
|
||||
## User, Team and Organization Mentions
|
||||
|
||||
When a text in the form `@username` is found and `username` matches the name
|
||||
of an existing user, a _mention_ reference is created. This will be shown
|
||||
by changing the text into a link to said user's profile, and possibly create
|
||||
a notification for the mentioned user depending on whether they have
|
||||
the necessary permission to access the contents.
|
||||
|
||||
Example:
|
||||
|
||||
> [@John](#), can you give this a look?
|
||||
|
||||
This is also valid for teams and organizations:
|
||||
|
||||
> [@Documenters](#), we need to plan for this.
|
||||
> [@CoolCompanyInc](#), this issue concerns us all!
|
||||
|
||||
Teams will receive mail notifications when appropriate, but whole organizations won't.
|
||||
|
||||
Commit messages do not produce user notifications.
|
||||
|
||||
## Commits
|
||||
|
||||
Commits can be referenced using their SHA1 hash, or a portion of it of
|
||||
at least seven characters. They will be shown as a link to the corresponding
|
||||
commit.
|
||||
|
||||
Example:
|
||||
|
||||
> This bug was introduced in [e59ff077](#)
|
||||
|
||||
## Issues and Pull Requests
|
||||
|
||||
A reference to another issue or pull request can be created using the simple
|
||||
notation `#1234`, where _1234_ is the number of an issue or pull request
|
||||
in the same repository. These references will be shown as links to the
|
||||
referenced content.
|
||||
|
||||
The effect of creating this type of reference is that a _notice_ will be
|
||||
created in the referenced document, provided the creator of the reference
|
||||
has reading permissions on it.
|
||||
|
||||
Example:
|
||||
|
||||
> This seems related to [#1234](#)
|
||||
|
||||
Issues and pull requests in other repositories can be referred to as well
|
||||
using the form `owner/repository#1234`:
|
||||
|
||||
> This seems related to [mike/compiler#1234](#)
|
||||
|
||||
Alternatively, the `!1234` notation can be used as well. Even when in Gitea
|
||||
a pull request is a form of issue, the `#1234` form will always link to
|
||||
an issue; if the linked entry happens to be a pull request instead, Gitea
|
||||
will redirect as appropriate. With the `!1234` notation, a pull request
|
||||
link will be created, which will be redirected to an issue if required.
|
||||
However, this distinction could be important if an external tracker is
|
||||
used, where links to issues and pull requests are not interchangeable.
|
||||
|
||||
## Actionable References in Pull Requests and Commit Messages
|
||||
|
||||
Sometimes a commit or pull request may fix or bring back a problem documented
|
||||
in a particular issue. Gitea supports closing and reopening the referenced
|
||||
issues by preceding the reference with a particular _keyword_. Common keywords
|
||||
include "closes", "fixes", "reopens", etc. This list can be
|
||||
[customized](../administration/config-cheat-sheet.md) by the
|
||||
site administrator.
|
||||
|
||||
Example:
|
||||
|
||||
> This PR _closes_ [#1234](#)
|
||||
|
||||
If the actionable reference is accepted, this will create a notice on the
|
||||
referenced issue announcing that it will be closed when the referencing PR
|
||||
is merged.
|
||||
|
||||
For an actionable reference to be accepted, _at least one_ of the following
|
||||
conditions must be met:
|
||||
|
||||
- The commenter has permissions to close or reopen the issue at the moment
|
||||
of creating the reference.
|
||||
- The reference is inside a commit message.
|
||||
- The reference is posted as part of the pull request description.
|
||||
|
||||
In the last case, the issue will be closed or reopened only if the merger
|
||||
of the pull request has permissions to do so.
|
||||
|
||||
Additionally, only pull requests and commit messages can create an action,
|
||||
and only issues can be closed or reopened this way.
|
||||
|
||||
The default _keywords_ are:
|
||||
|
||||
- **Closing**: close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved
|
||||
- **Reopening**: reopen, reopens, reopened
|
||||
|
||||
## Time tracking in Pull Requests and Commit Messages
|
||||
|
||||
When commit or merging of pull request results in automatic closing of issue
|
||||
it is possible to also add spent time resolving this issue through commit message.
|
||||
|
||||
To specify spent time on resolving issue you need to specify time in format
|
||||
`@<number><time-unit>` after issue number. In one commit message you can specify
|
||||
multiple fixed issues and spent time for each of them.
|
||||
|
||||
Supported time units (`<time-unit>`):
|
||||
|
||||
- `m` - minutes
|
||||
- `h` - hours
|
||||
- `d` - days (equals to 8 hours)
|
||||
- `w` - weeks (equals to 5 days)
|
||||
- `mo` - months (equals to 4 weeks)
|
||||
|
||||
Numbers to specify time (`<number>`) can be also decimal numbers, ex. `@1.5h` would
|
||||
result in one and half hours. Multiple time units can be combined, ex. `@1h10m` would
|
||||
mean 1 hour and 10 minutes.
|
||||
|
||||
Example of commit message:
|
||||
|
||||
> Fixed #123 spent @1h, refs #102, fixes #124 @1.5h
|
||||
|
||||
This would result in 1 hour added to issue #123 and 1 and half hours added to issue #124.
|
||||
|
||||
## External Trackers
|
||||
|
||||
Gitea supports the use of external issue trackers, and references to issues
|
||||
hosted externally can be created in pull requests. However, if the external
|
||||
tracker uses numbers to identify issues, they will be indistinguishable from
|
||||
the pull requests hosted in Gitea. To address this, Gitea allows the use of
|
||||
the `!` marker to identify pull requests. For example:
|
||||
|
||||
> This is issue [#1234](#), and links to the external tracker.
|
||||
> This is pull request [!1234](#), and links to a pull request in Gitea.
|
||||
|
||||
The `!` and `#` can be used interchangeably for issues and pull request _except_
|
||||
for this case, where a distinction is required. If the repository uses external
|
||||
tracker, commit message for squash merge will use `!` as reference by default.
|
||||
|
||||
## Issues and Pull Requests References Summary
|
||||
|
||||
This table illustrates the different kinds of cross-reference for issues and pull requests.
|
||||
In the examples, `User1/Repo1` refers to the repository where the reference is used, while
|
||||
`UserZ/RepoZ` indicates a different repository.
|
||||
|
||||
| Reference in User1/Repo1 | Repo1 issues are external | RepoZ issues are external | Should render |
|
||||
| --------------------------- | :-----------------------: | :-----------------------: | ------------------------------------------------------- |
|
||||
| `#1234` | no | - | A link to issue/pull 1234 in `User1/Repo1` |
|
||||
| `!1234` | no | - | A link to issue/pull 1234 in `User1/Repo1` |
|
||||
| `#1234` | yes | - | A link to _external issue_ 1234 for `User1/Repo1` |
|
||||
| `!1234` | yes | - | A link to _PR_ 1234 for `User1/Repo1` |
|
||||
| `User1/Repo1#1234` | no | - | A link to issue/pull 1234 in `User1/Repo1` |
|
||||
| `User1/Repo1!1234` | no | - | A link to issue/pull 1234 in `User1/Repo1` |
|
||||
| `User1/Repo1#1234` | yes | - | A link to _external issue_ 1234 for `User1/Repo1` |
|
||||
| `User1/Repo1!1234` | yes | - | A link to _PR_ 1234 for `User1/Repo1` |
|
||||
| `UserZ/RepoZ#1234` | - | no | A link to issue/pull 1234 in `UserZ/RepoZ` |
|
||||
| `UserZ/RepoZ!1234` | - | no | A link to issue/pull 1234 in `UserZ/RepoZ` |
|
||||
| `UserZ/RepoZ#1234` | - | yes | A link to _external issue_ 1234 for `UserZ/RepoZ` |
|
||||
| `UserZ/RepoZ!1234` | - | yes | A link to _PR_ 1234 for `UserZ/RepoZ` |
|
||||
| **Alphanumeric issue IDs:** | - | - | - |
|
||||
| `AAA-1234` | yes | - | A link to _external issue_ `AAA-1234` for `User1/Repo1` |
|
||||
| `!1234` | yes | - | A link to _PR_ 1234 for `User1/Repo1` |
|
||||
| `User1/Repo1!1234` | yes | - | A link to _PR_ 1234 for `User1/Repo1` |
|
||||
| _Not supported_ | - | yes | A link to _external issue_ `AAA-1234` for `UserZ/RepoZ` |
|
||||
| `UserZ/RepoZ!1234` | - | yes | A link to _PR_ 1234 in `UserZ/RepoZ` |
|
||||
|
||||
_The last section is for repositories with external issue trackers that use alphanumeric format._
|
||||
|
||||
_**-**: not applicable._
|
||||
|
||||
:::note
|
||||
Automatic references between repositories with different types of issues (external vs. internal) are not fully supported
|
||||
and may render invalid links.
|
||||
:::
|
||||
102
versioned_docs/version-1.24/usage/markdown.md
Normal file
102
versioned_docs/version-1.24/usage/markdown.md
Normal file
@@ -0,0 +1,102 @@
|
||||
---
|
||||
date: "2025-04-05T00:00:00+08:00"
|
||||
slug: "markdown"
|
||||
---
|
||||
|
||||
# Markdown
|
||||
|
||||
Gitea uses MarkDown structured text in many places, you can recognise it by the `.md` file extension.
|
||||
Markdown is plain text format for writing structured documents, allowing one to write
|
||||
"plain" text files that nonetheless have _"fancy"_ **formatting**, while still keeping the plain-text version readable.
|
||||
|
||||
Unfortunately, due to historical implementation differences, many subtle dialects exist.
|
||||
To avoid adding to the confusion, Gitea tries to follow "[GitHub Flavoured Markdown (GFM)](https://help.github.com/articles/github-flavored-markdown/)" as close as possible.
|
||||
"GFM" is an extension on top of the rigorously-specified [CommonMark](https://commonmark.org/) standard.
|
||||
CommonMark flavours are used by most major web platforms (e.g. Reddit, Stack Overflow, Discourse)
|
||||
and git forges (GitHub, GitLab and our very own Gitea), thus you shouldn't run into any surprises with Gitea.
|
||||
|
||||
For a quick introduction to the syntax and features of GitHub Flavoured Markdown, see the GitHub documentation:
|
||||
- [Basic formatting](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax)
|
||||
- [Advanced formatting](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting)
|
||||
|
||||
For a deeper history about CommonMark, its spec, and its reason for existence, see [CommonMark.org](https://commonmark.org/).
|
||||
|
||||
## Rendering options
|
||||
|
||||
Some Gitea's markdown rendering behaviors can be fine-tuned by global config options, see the `[markdown]` config section in the `app.example.ini`
|
||||
|
||||
|
||||
## Link path resolving
|
||||
|
||||
When rendering links for `<a href>`, `<img src>` and `<video src>`, Gitea resolves the link paths in the rendering context.
|
||||
|
||||
- If the link is an absolute path with scheme, the link is kept as-is.
|
||||
- If the link is an URL path, it is resolved with the base path of current rendering context.
|
||||
- In a comment-like context (issues, pull-requests, commit message), the base path is current repository's home link: `/owner-name/repo-name`.
|
||||
- In a repository file context (markdown files in the repository), the base path is current git ref path.
|
||||
|
||||
### Special link tokens
|
||||
|
||||
To make users easier to resolve a link to the Gitea instance's root path, Gitea has a special `/:root` path syntax.
|
||||
This will always resolve to Gitea's ROOT_URL.
|
||||
|
||||
Gitea also supports GitHub's `?raw=1` query parameter.
|
||||
A request to `/owner-name/repo-name/src/branch/main/file?raw=1` will be redirected to
|
||||
`/owner-name/repo-name/raw/branch/main/file`. This makes it possible to target raw contents from relative links
|
||||
(normally, the `src/` section of the path is provided automatically by Gitea and cannot be overriden).
|
||||
|
||||
### Link handling examples
|
||||
|
||||
For example, when rendering a markdown file in `/owner-name/repo-name/src/branch/main/dir`:
|
||||
1) Absolute with scheme: Link `https://example.org` will be rendered as-is.
|
||||
2) Relative from current file: Link `sub/file`is resolved to `/owner-name/repo-name/src/branch/main/dir/sub/file`
|
||||
3) Relative from repo root: Link `/sub/file` (note leading slash) is resolved to `/owner-name/repo-name/src/branch/main/sub/file`
|
||||
4) Raw media: If the link is used as `src` of an image or video, then it is resolved to `/owner-name/repo-name/raw/...`
|
||||
5) Raw relative: `sub/file?raw=1` will resolve to `/owner-name/repo-name/src/branch/main/dir/sub/file?raw=1`,
|
||||
which will redirect to `/owner-name/repo-name/raw/branch/main/dir/sub/file`.
|
||||
6) explicit root: Link `/:root/any-path` is always resolved to `$ROOT_URL/any-path` without any further processing.
|
||||
|
||||
|
||||
## Issue and pull-request reference
|
||||
|
||||
Using issue/pull-request numbers in a list:
|
||||
|
||||
```
|
||||
* #123
|
||||
* #456
|
||||
```
|
||||
|
||||
It will be rendered with issue titles to:
|
||||
|
||||
```
|
||||
* the issue title (#123)
|
||||
* the other issue title (#456)
|
||||
```
|
||||
|
||||
## Math expressions
|
||||
|
||||
Gitea supports GitHub-like math expression formatting.
|
||||
|
||||
### Inline expression
|
||||
|
||||
- ``` $\alpha$ ```: quoted by single-dollar `$`
|
||||
- ``` $$\alpha$$ ```: quoted by double-dollar `$$`
|
||||
- ``` $`\alpha`$ ```: quoted by dollar with backquotes, the backquotes could repeat like normal code blocks.
|
||||
|
||||
### Block expression
|
||||
|
||||
Using `$$`:
|
||||
|
||||
````
|
||||
$$
|
||||
\alpha
|
||||
$$
|
||||
````
|
||||
|
||||
Using code-block with language:
|
||||
|
||||
````
|
||||
```math
|
||||
\alpha
|
||||
```
|
||||
````
|
||||
46
versioned_docs/version-1.24/usage/merge-message-templates.md
Normal file
46
versioned_docs/version-1.24/usage/merge-message-templates.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
date: "2022-08-31T17:35:40+08:00"
|
||||
slug: "merge-message-templates"
|
||||
sidebar_position: 15
|
||||
aliases:
|
||||
- /en-us/merge-message-templates
|
||||
---
|
||||
|
||||
# Merge Message templates
|
||||
|
||||
## File names
|
||||
|
||||
Possible file names for PR default merge message templates:
|
||||
|
||||
- `.gitea/default_merge_message/MERGE_TEMPLATE.md`
|
||||
- `.gitea/default_merge_message/REBASE_TEMPLATE.md`
|
||||
- `.gitea/default_merge_message/REBASE-MERGE_TEMPLATE.md`
|
||||
- `.gitea/default_merge_message/SQUASH_TEMPLATE.md`
|
||||
- `.gitea/default_merge_message/MANUALLY-MERGED_TEMPLATE.md`
|
||||
- `.gitea/default_merge_message/REBASE-UPDATE-ONLY_TEMPLATE.md`
|
||||
|
||||
## Variables
|
||||
|
||||
You can use the following variables enclosed in `${}` inside these templates which follow [os.Expand](https://pkg.go.dev/os#Expand) syntax:
|
||||
|
||||
- BaseRepoOwnerName: Base repository owner name of this pull request
|
||||
- BaseRepoName: Base repository name of this pull request
|
||||
- BaseBranch: Base repository target branch name of this pull request
|
||||
- HeadRepoOwnerName: Head repository owner name of this pull request
|
||||
- HeadRepoName: Head repository name of this pull request
|
||||
- HeadBranch: Head repository branch name of this pull request
|
||||
- PullRequestTitle: Pull request's title
|
||||
- PullRequestDescription: Pull request's description
|
||||
- PullRequestPosterName: Pull request's poster name
|
||||
- PullRequestIndex: Pull request's index number
|
||||
- PullRequestReference: Pull request's reference char with index number. i.e. #1, !2
|
||||
- ClosingIssues: return a string contains all issues which will be closed by this pull request i.e. `close #1, close #2`
|
||||
- ReviewedOn: Which pull request this commit belongs to. For example `Reviewed-on: https://gitea.com/foo/bar/pulls/1`
|
||||
- ReviewedBy: Who approved the pull request before the merge. For example `Reviewed-by: Jane Doe <jane.doe@example.com>`
|
||||
|
||||
## Rebase
|
||||
|
||||
When rebasing without a merge commit, `REBASE_TEMPLATE.md` modifies the message of the last commit. The following additional variables are available in this template:
|
||||
|
||||
- CommitTitle: Commit's title
|
||||
- CommitBody: Commits's body text
|
||||
53
versioned_docs/version-1.24/usage/migration.md
Normal file
53
versioned_docs/version-1.24/usage/migration.md
Normal file
@@ -0,0 +1,53 @@
|
||||
---
|
||||
date: "2024-09-11T09:30:00+08:00"
|
||||
slug: "migration"
|
||||
sidebar_position: 45
|
||||
---
|
||||
|
||||
# Migration
|
||||
|
||||
You can migrate repositories from other Git services to your Gitea instance.
|
||||
|
||||
## How to migrate from Gogs/GitHub/GitLab to Gitea
|
||||
|
||||
To migrate from Gogs to Gitea:
|
||||
|
||||
- [Gogs version 0.11.46.0418](https://github.com/go-gitea/gitea/issues/4286)
|
||||
|
||||
To migrate from GitHub to Gitea, you can use Gitea's built-in migration form.
|
||||
|
||||
In order to migrate items such as issues, pull requests, etc. you will need to input at least your username.
|
||||
|
||||
[Example (requires login)](https://demo.gitea.com/repo/migrate)
|
||||
|
||||
To migrate from GitLab to Gitea, you can use this non-affiliated tool:
|
||||
|
||||
https://github.com/loganinak/MigrateGitlabToGogs
|
||||
|
||||
## How to migrate from AWS CodeCommit to Gitea
|
||||
|
||||
- To use the AWS CodeCommit API, Gitea requires an access key ID and a secret access key. For security reasons, we recommend creating a new user with the minimum necessary permissions and generating an access key ID and secret access key for the migration. The minimum permissions required for this user are as follows:
|
||||
```
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Action": [
|
||||
"codecommit:GetRepository",
|
||||
"codecommit:GitPull",
|
||||
"codecommit:ListPullRequests",
|
||||
"codecommit:GetPullRequest",
|
||||
"codecommit:GetCommentsForPullRequest"
|
||||
],
|
||||
"Resource": [
|
||||
"arn:aws:codecommit:<region>:<account>:<Repo-to-Migrate>
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
- If you do not need to migrate pull requests, you can remove the `ListPullRequests`, `GetPullRequest`, and `GetCommentsForPullRequest` actions.
|
||||
|
||||
- For instructions on how to create an IAM user and assign permissions, you can refer to this [AWS documentation](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html).
|
||||
|
||||
- To clone this repository, Gitea requires HTTPS Git credentials. You can create HTTPS Git credentials according to this [AWS documentation](https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html).
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
date: "2023-08-22T14:21:00+08:00"
|
||||
slug: "multi-factor-authentication"
|
||||
weight: 15
|
||||
---
|
||||
|
||||
# Multi-factor Authentication (MFA)
|
||||
|
||||
Multi-factor Authentication (also referred to as MFA or 2FA) enhances security by requiring a time-sensitive set of credentials in addition to a password.
|
||||
If a password were later to be compromised, logging into Gitea will not be possible without the additional credentials and the account would remain secure.
|
||||
Gitea supports both TOTP (Time-based One-Time Password) tokens and FIDO-based hardware keys using the Webauthn API.
|
||||
|
||||
MFA can be configured within the "Security" tab of the user settings page.
|
||||
|
||||
## MFA Considerations
|
||||
|
||||
Enabling MFA on a user does affect how the Git HTTP protocol can be used with the Git CLI.
|
||||
This interface does not support MFA, and trying to use a password normally will no longer be possible whilst MFA is enabled.
|
||||
If SSH is not an option for Git operations, an access token can be generated within the "Applications" tab of the user settings page.
|
||||
This access token can be used as if it were a password in order to allow the Git CLI to function over HTTP.
|
||||
|
||||
:::warning
|
||||
By its very nature, an access token sidesteps the security benefits of MFA.
|
||||
It must be kept secure and should only be used as a last resort.
|
||||
:::
|
||||
|
||||
The Gitea API supports providing the relevant TOTP password in the `X-Gitea-OTP` header, as described in [API Usage](development/api-usage.md).
|
||||
This should be used instead of an access token where possible.
|
||||
122
versioned_docs/version-1.24/usage/packages/alpine.md
Normal file
122
versioned_docs/version-1.24/usage/packages/alpine.md
Normal file
@@ -0,0 +1,122 @@
|
||||
---
|
||||
date: "2023-03-25T00:00:00+00:00"
|
||||
slug: "alpine"
|
||||
sidebar_position: 4
|
||||
---
|
||||
|
||||
# Alpine Package Registry
|
||||
|
||||
Publish [Alpine](https://pkgs.alpinelinux.org/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Alpine registry, you need to use a HTTP client like `curl` to upload and a package manager like `apk` to consume packages.
|
||||
|
||||
The following examples use `apk`.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the Alpine registry add the url to the list of known apk sources (`/etc/apk/repositories`):
|
||||
|
||||
```
|
||||
https://gitea.example.com/api/packages/{owner}/alpine/<branch>/<repository>
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| ------------ | ----------- |
|
||||
| `owner` | The owner of the packages. |
|
||||
| `branch` | The branch to use. |
|
||||
| `repository` | The repository to use. |
|
||||
|
||||
If the registry is private, provide credentials in the url. You can use a password or a [personal access token](development/api-usage.md#authentication):
|
||||
|
||||
```
|
||||
https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/alpine/<branch>/<repository>
|
||||
```
|
||||
|
||||
The Alpine registry files are signed with a RSA key which must be known to apk. Download the public key and store it in `/etc/apk/keys/`:
|
||||
|
||||
```shell
|
||||
curl -JO https://gitea.example.com/api/packages/{owner}/alpine/key
|
||||
```
|
||||
|
||||
Afterwards update the local package index:
|
||||
|
||||
```shell
|
||||
apk update
|
||||
```
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish an Alpine package (`*.apk`), perform a HTTP `PUT` operation with the package content in the request body.
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/alpine/{branch}/{repository}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ------------ | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `branch` | The branch may match the release version of the OS, ex: `v3.17`. |
|
||||
| `repository` | The repository can be used [to group packages](https://wiki.alpinelinux.org/wiki/Repositories) or just `main` or similar. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/file.apk \
|
||||
https://gitea.example.com/api/packages/testuser/alpine/v3.17/main
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
You cannot publish a file with the same name twice to a package. You must delete the existing package file first.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package name, version, branch, repository or architecture are invalid. |
|
||||
| `409 Conflict` | A package file with the same combination of parameters exist already in the package. |
|
||||
|
||||
## Delete a package
|
||||
|
||||
To delete an Alpine package perform a HTTP `DELETE` operation. This will delete the package version too if there is no file left.
|
||||
|
||||
```
|
||||
DELETE https://gitea.example.com/api/packages/{owner}/alpine/{branch}/{repository}/{architecture}/{filename}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `branch` | The branch to use. |
|
||||
| `repository` | The repository to use. |
|
||||
| `architecture` | The package architecture. |
|
||||
| `filename` | The file to delete. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_token_or_password -X DELETE \
|
||||
https://gitea.example.com/api/packages/testuser/alpine/v3.17/main/test-package-1.0.0.apk
|
||||
```
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `204 No Content` | Success |
|
||||
| `404 Not Found` | The package or file was not found. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a package from the Alpine registry, execute the following commands:
|
||||
|
||||
```shell
|
||||
# use latest version
|
||||
apk add {package_name}
|
||||
# use specific version
|
||||
apk add {package_name}={package_version}
|
||||
```
|
||||
132
versioned_docs/version-1.24/usage/packages/arch.md
Normal file
132
versioned_docs/version-1.24/usage/packages/arch.md
Normal file
@@ -0,0 +1,132 @@
|
||||
---
|
||||
date: "2023-05-15T00:00:00+00:00"
|
||||
slug: "arch"
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
# Arch package registry
|
||||
|
||||
Publish [Arch](https://archlinux.org/packages/) packages for your user or organization. The registry can act as a fully working [Arch linux mirror](https://wiki.archlinux.org/title/mirrors) connected directly in `/etc/pacman.conf`.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Arch registry, you need to use a HTTP client like `curl` to upload and a package manager like `pacman` to consume packages.
|
||||
|
||||
The following examples use `pacman`.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
Before you can use the package registry, you need to download the package verification key and add the registry to the pacman config.
|
||||
|
||||
Download the package verification key.
|
||||
```sh
|
||||
wget https://gitea.example.com/api/packages/{owner}/arch/repository.key
|
||||
```
|
||||
|
||||
Display the id the key (the long line with hex characters).
|
||||
```sh
|
||||
gpg --show-keys repository.key
|
||||
```
|
||||
|
||||
Add the key to pacman and sign it (use the key id from the previous step).
|
||||
```sh
|
||||
pacman-key --add repository.key
|
||||
pacman-key --lsign-key {key id}
|
||||
```
|
||||
|
||||
Now add the registry configuration to `/etc/pacman.conf`.
|
||||
```conf
|
||||
[{owner}.gitea.example.com]
|
||||
SigLevel = Required
|
||||
Server = https://gitea.example.com/api/packages/{owner}/arch/{repository}/{architecture}
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| -------------- | ----------- |
|
||||
| `owner` | The owner of the packages. |
|
||||
| `repository` | The repository to use. |
|
||||
| `architecture` | The architecture to use. |
|
||||
|
||||
Consult the owners package overview to see what `repository` and `architecture` is available.
|
||||
|
||||
If the registry is private, provide credentials in the url. You can use a password or a [personal access token](development/api-usage.md#authentication):
|
||||
|
||||
```
|
||||
Server = https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/arch/{repository}/{architecture}
|
||||
```
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish an Arch package, perform a HTTP `PUT` operation with the package content in the request body.
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/arch/{repository}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ------------ | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `repository` | The repository can be used to group packages or just `core` or similar. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/file.pkg.tar.zst \
|
||||
https://gitea.example.com/api/packages/testuser/arch/core
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
You cannot publish a file with the same name twice to a package. You must delete the existing package file first.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | Something of the package is invalid. The error message contains more information. |
|
||||
| `409 Conflict` | A package file with the same combination of parameters exist already in the package. |
|
||||
|
||||
## Install packages
|
||||
|
||||
To install a package run the pacman sync command:
|
||||
|
||||
```sh
|
||||
pacman -Sy {package_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
## Delete a package
|
||||
|
||||
To delete an Arch package perform a HTTP `DELETE` operation. This will delete the package version too if there is no file left.
|
||||
|
||||
```
|
||||
DELETE https://gitea.example.com/api/packages/{owner}/arch/{repository}/{package_name}/{package_version}/{architecture}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `repository` | The repository to use. |
|
||||
| `architecture` | The package architecture. |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_token_or_password -X DELETE \
|
||||
https://gitea.example.com/api/packages/testuser/arch/core/test-package/1.0.0/x86-64
|
||||
```
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `204 No Content` | Success |
|
||||
| `404 Not Found` | The package or file was not found. |
|
||||
104
versioned_docs/version-1.24/usage/packages/cargo.md
Normal file
104
versioned_docs/version-1.24/usage/packages/cargo.md
Normal file
@@ -0,0 +1,104 @@
|
||||
---
|
||||
date: "2022-11-20T00:00:00+00:00"
|
||||
slug: "cargo"
|
||||
sidebar_position: 5
|
||||
---
|
||||
|
||||
# Cargo Package Registry
|
||||
|
||||
Publish [Cargo](https://doc.rust-lang.org/stable/cargo/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Cargo package registry, you need [Rust and Cargo](https://www.rust-lang.org/tools/install).
|
||||
|
||||
Cargo stores information about the available packages in a package index stored in a git repository.
|
||||
This repository is needed to work with the registry.
|
||||
The following section describes how to create it.
|
||||
|
||||
## Index Repository
|
||||
|
||||
Cargo stores information about the available packages in a package index stored in a git repository.
|
||||
In Gitea this repository has the special name `_cargo-index`.
|
||||
After a package was uploaded, its metadata is automatically written to the index.
|
||||
The content of this repository should not be manually modified.
|
||||
|
||||
The user or organization package settings page allows to create the index repository along with the configuration file.
|
||||
If needed this action will rewrite the configuration file.
|
||||
This can be useful if for example the Gitea instance domain was changed.
|
||||
|
||||
If the case arises where the packages stored in Gitea and the information in the index repository are out of sync, the settings page allows to rebuild the index repository.
|
||||
This action iterates all packages in the registry and writes their information to the index.
|
||||
If there are lot of packages this process may take some time.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry the Cargo configuration must be updated.
|
||||
Add the following text to the configuration file located in the current users home directory (for example `~/.cargo/config.toml`):
|
||||
|
||||
```
|
||||
[registry]
|
||||
default = "gitea"
|
||||
|
||||
[registries.gitea]
|
||||
index = "sparse+https://gitea.example.com/api/packages/{owner}/cargo/" # Sparse index
|
||||
# index = "https://gitea.example.com/{owner}/_cargo-index.git" # Git
|
||||
|
||||
# [net]
|
||||
# git-fetch-with-cli = true
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
If the registry is private or you want to publish new packages, you have to configure your credentials.
|
||||
Add the credentials section to the credentials file located in the current users home directory (for example `~/.cargo/credentials.toml`):
|
||||
|
||||
```
|
||||
[registries.gitea]
|
||||
token = "Bearer {token}"
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| `token` | Your [personal access token](development/api-usage.md#authentication) |
|
||||
|
||||
## Git vs Sparse
|
||||
|
||||
Currently, cargo supports two ways for fetching crates in a registry: Git index & sparse index.
|
||||
Sparse index is the newest method and offers better performance when updating crates compared to git.
|
||||
Since Rust 1.68, sparse is the default method for crates.io.
|
||||
|
||||
## Publish a package
|
||||
|
||||
Publish a package by running the following command in your project:
|
||||
|
||||
```shell
|
||||
cargo publish
|
||||
```
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a package from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
cargo add {package_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
## Supported commands
|
||||
|
||||
```
|
||||
cargo publish
|
||||
cargo add
|
||||
cargo install
|
||||
cargo yank
|
||||
cargo unyank
|
||||
cargo search
|
||||
```
|
||||
84
versioned_docs/version-1.24/usage/packages/chef.md
Normal file
84
versioned_docs/version-1.24/usage/packages/chef.md
Normal file
@@ -0,0 +1,84 @@
|
||||
---
|
||||
date: "2023-01-20T00:00:00+00:00"
|
||||
slug: "chef"
|
||||
sidebar_position: 10
|
||||
---
|
||||
|
||||
# Chef Package Registry
|
||||
|
||||
Publish [Chef](https://chef.io/) cookbooks for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Chef package registry, you have to use [`knife`](https://docs.chef.io/workstation/knife/).
|
||||
|
||||
## Authentication
|
||||
|
||||
The Chef package registry does not use an username:password authentication but signed requests with a private:public key pair.
|
||||
Visit the package owner settings page to create the necessary key pair.
|
||||
Only the public key is stored inside Gitea. if you loose access to the private key you must re-generate the key pair.
|
||||
[Configure `knife`](https://docs.chef.io/workstation/knife_setup/) to use the downloaded private key with your Gitea username as `client_name`.
|
||||
|
||||
## Configure the package registry
|
||||
|
||||
To [configure `knife`](https://docs.chef.io/workstation/knife_setup/) to use the Gitea package registry add the url to the `~/.chef/config.rb` file.
|
||||
|
||||
```
|
||||
knife[:supermarket_site] = 'https://gitea.example.com/api/packages/{owner}/chef'
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a Chef package execute the following command:
|
||||
|
||||
```shell
|
||||
knife supermarket share {package_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a package from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
knife supermarket install {package_name}
|
||||
```
|
||||
|
||||
Optional you can specify the package version:
|
||||
|
||||
```shell
|
||||
knife supermarket install {package_name} {package_version}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
|
||||
## Delete a package
|
||||
|
||||
If you want to remove a package from the registry, execute the following command:
|
||||
|
||||
```shell
|
||||
knife supermarket unshare {package_name}
|
||||
```
|
||||
|
||||
Optional you can specify the package version:
|
||||
|
||||
```shell
|
||||
knife supermarket unshare {package_name}/versions/{package_version}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
112
versioned_docs/version-1.24/usage/packages/composer.md
Normal file
112
versioned_docs/version-1.24/usage/packages/composer.md
Normal file
@@ -0,0 +1,112 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "composer"
|
||||
sidebar_position: 15
|
||||
---
|
||||
|
||||
# Composer Package Registry
|
||||
|
||||
Publish [Composer](https://getcomposer.org/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Composer package registry, you can use [Composer](https://getcomposer.org/download/) to consume and a HTTP upload client like `curl` to publish packages.
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a Composer package perform a HTTP PUT operation with the package content in the request body.
|
||||
The package content must be the zipped PHP project with the `composer.json` file.
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/composer
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ---------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
If the `composer.json` file does not contain a `version` property, you must provide it as a query parameter:
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/composer?version={x.y.z}
|
||||
```
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/project.zip \
|
||||
https://gitea.example.com/api/packages/testuser/composer
|
||||
```
|
||||
|
||||
Or specify the package version as query parameter:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/project.zip \
|
||||
https://gitea.example.com/api/packages/testuser/composer?version=1.0.3
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package is invalid. |
|
||||
| `409 Conflict` | A package file with the same combination of parameters exists already. |
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry you need to add it to the Composer `config.json` file (which can usually be found under `<user-home-dir>/.composer/config.json`):
|
||||
|
||||
```json
|
||||
{
|
||||
"repositories": [{
|
||||
"type": "composer",
|
||||
"url": "https://gitea.example.com/api/packages/{owner}/composer"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
To access the package registry using credentials, you must specify them in the `auth.json` file as follows:
|
||||
|
||||
```json
|
||||
{
|
||||
"http-basic": {
|
||||
"gitea.example.com": {
|
||||
"username": "{username}",
|
||||
"password": "{password}"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ---------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `username` | Your Gitea username. |
|
||||
| `password` | Your Gitea password or a personal access token. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a package from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
composer require {package_name}
|
||||
```
|
||||
|
||||
Optional you can specify the package version:
|
||||
|
||||
```shell
|
||||
composer require {package_name}:{package_version}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
91
versioned_docs/version-1.24/usage/packages/conan.md
Normal file
91
versioned_docs/version-1.24/usage/packages/conan.md
Normal file
@@ -0,0 +1,91 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "conan"
|
||||
sidebar_position: 20
|
||||
---
|
||||
|
||||
# Conan Package Registry
|
||||
|
||||
Publish [Conan](https://conan.io/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Conan package registry, you need to use the [conan](https://conan.io/downloads.html) command line tool to consume and publish packages.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry you need to configure a new Conan remote:
|
||||
|
||||
```shell
|
||||
conan remote add {remote} https://gitea.example.com/api/packages/{owner}/conan
|
||||
conan user --remote {remote} --password {password} {username}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -----------| ----------- |
|
||||
| `remote` | The remote name. |
|
||||
| `username` | Your Gitea username. |
|
||||
| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
conan remote add gitea https://gitea.example.com/api/packages/testuser/conan
|
||||
conan user --remote gitea --password password123 testuser
|
||||
```
|
||||
|
||||
## Publish a package
|
||||
|
||||
Publish a Conan package by running the following command:
|
||||
|
||||
```shell
|
||||
conan upload --remote={remote} {recipe}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------| ----------- |
|
||||
| `remote` | The remote name. |
|
||||
| `recipe` | The recipe to upload. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
conan upload --remote=gitea ConanPackage/1.2@gitea/final
|
||||
```
|
||||
|
||||
You cannot publish a file with the same name twice to a package. You must delete the existing package or file first.
|
||||
|
||||
The Gitea Conan package registry has full [revision](https://docs.conan.io/en/latest/versioning/revisions.html) support.
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a Conan package from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
conan install --remote={remote} {recipe}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------| ----------- |
|
||||
| `remote` | The remote name. |
|
||||
| `recipe` | The recipe to download. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
conan install --remote=gitea ConanPackage/1.2@gitea/final
|
||||
```
|
||||
|
||||
## Supported commands
|
||||
|
||||
```
|
||||
conan install
|
||||
conan get
|
||||
conan info
|
||||
conan search
|
||||
conan upload
|
||||
conan user
|
||||
conan download
|
||||
conan remove
|
||||
```
|
||||
83
versioned_docs/version-1.24/usage/packages/conda.md
Normal file
83
versioned_docs/version-1.24/usage/packages/conda.md
Normal file
@@ -0,0 +1,83 @@
|
||||
---
|
||||
date: "2022-12-28T00:00:00+00:00"
|
||||
slug: "conda"
|
||||
sidebar_position: 25
|
||||
---
|
||||
|
||||
# Conda Package Registry
|
||||
|
||||
Publish [Conda](https://docs.conda.io/en/latest/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Conda package registry, you need to use [conda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html).
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry and provide credentials, edit your `.condarc` file:
|
||||
|
||||
```yaml
|
||||
channel_alias: https://gitea.example.com/api/packages/{owner}/conda
|
||||
channels:
|
||||
- https://gitea.example.com/api/packages/{owner}/conda
|
||||
default_channels:
|
||||
- https://gitea.example.com/api/packages/{owner}/conda
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| ------------ | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
See the [official documentation](https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html) for explanations of the individual settings.
|
||||
|
||||
If you need to provide credentials, you may embed them as part of the channel url (`https://user:password@gitea.example.com/...`).
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a package, perform a HTTP PUT operation with the package content in the request body.
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/conda/{channel}/{filename}
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| ------------ | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `channel` | The [channel](https://conda.io/projects/conda/en/latest/user-guide/concepts/channels.html) of the package. (optional) |
|
||||
| `filename` | The name of the file. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/package-1.0.conda \
|
||||
https://gitea.example.com/api/packages/testuser/conda/package-1.0.conda
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package is invalid. |
|
||||
| `409 Conflict` | A package file with the same combination of parameters exists already. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a package from the package registry, execute one of the following commands:
|
||||
|
||||
```shell
|
||||
conda install {package_name}
|
||||
conda install {package_name}={package_version}
|
||||
conda install -c {channel} {package_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
| `channel` | The channel of the package. (optional) |
|
||||
93
versioned_docs/version-1.24/usage/packages/container.md
Normal file
93
versioned_docs/version-1.24/usage/packages/container.md
Normal file
@@ -0,0 +1,93 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "container"
|
||||
sidebar_position: 30
|
||||
---
|
||||
|
||||
# Container Registry
|
||||
|
||||
Publish [Open Container Initiative](https://opencontainers.org/) compliant images for your user or organization.
|
||||
The container registry follows the OCI specs and supports all compatible images like [Docker](https://www.docker.com/) and [Helm Charts](https://helm.sh/).
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Container registry, you can use the tools for your specific image type.
|
||||
The following examples use the `docker` client.
|
||||
|
||||
## Login to the container registry
|
||||
|
||||
To push an image or if the image is in a private registry, you have to authenticate:
|
||||
|
||||
```shell
|
||||
docker login gitea.example.com
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
## Image naming convention
|
||||
|
||||
Images must follow this naming convention:
|
||||
|
||||
`{registry}/{owner}/{image}`
|
||||
|
||||
When building your docker image, using the naming convention above, this looks like:
|
||||
|
||||
```shell
|
||||
# build an image with tag
|
||||
docker build -t {registry}/{owner}/{image}:{tag} .
|
||||
# name an existing image with tag
|
||||
docker tag {some-existing-image}:{tag} {registry}/{owner}/{image}:{tag}
|
||||
```
|
||||
|
||||
where your registry is the domain of your gitea instance (e.g. gitea.example.com).
|
||||
For example, these are all valid image names for the owner `testuser`:
|
||||
|
||||
`gitea.example.com/testuser/myimage`
|
||||
|
||||
`gitea.example.com/testuser/my-image`
|
||||
|
||||
`gitea.example.com/testuser/my/image`
|
||||
|
||||
:::note
|
||||
The registry only supports case-insensitive tag names. So `image:tag` and `image:Tag` get treated as the same image and tag.
|
||||
:::
|
||||
|
||||
## Push an image
|
||||
|
||||
Push an image by executing the following command:
|
||||
|
||||
```shell
|
||||
docker push gitea.example.com/{owner}/{image}:{tag}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------| ----------- |
|
||||
| `owner` | The owner of the image. |
|
||||
| `image` | The name of the image. |
|
||||
| `tag` | The tag of the image. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
docker push gitea.example.com/testuser/myimage:latest
|
||||
```
|
||||
|
||||
## Pull an image
|
||||
|
||||
Pull an image by executing the following command:
|
||||
|
||||
```shell
|
||||
docker pull gitea.example.com/{owner}/{image}:{tag}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------| ----------- |
|
||||
| `owner` | The owner of the image. |
|
||||
| `image` | The name of the image. |
|
||||
| `tag` | The tag of the image. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
docker pull gitea.example.com/testuser/myimage:latest
|
||||
```
|
||||
91
versioned_docs/version-1.24/usage/packages/cran.md
Normal file
91
versioned_docs/version-1.24/usage/packages/cran.md
Normal file
@@ -0,0 +1,91 @@
|
||||
---
|
||||
date: "2023-01-01T00:00:00+00:00"
|
||||
slug: "cran"
|
||||
sidebar_position: 35
|
||||
---
|
||||
|
||||
# CRAN Package Registry
|
||||
|
||||
Publish [R](https://www.r-project.org/) packages to a [CRAN](https://cran.r-project.org/)-like registry for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the CRAN package registry, you need to install [R](https://cran.r-project.org/).
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry you need to add it to `Rprofile.site`, either on the system-level, user-level (`~/.Rprofile`) or project-level:
|
||||
|
||||
```
|
||||
options("repos" = c(getOption("repos"), c(gitea="https://gitea.example.com/api/packages/{owner}/cran")))
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
If you need to provide credentials, you may embed them as part of the url (`https://user:password@gitea.example.com/...`).
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a R package, perform a HTTP `PUT` operation with the package content in the request body.
|
||||
|
||||
Source packages:
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/cran/src
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
Binary packages:
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/cran/bin?platform={platform}&rversion={rversion}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ---------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `platform` | The name of the platform. |
|
||||
| `rversion` | The R version of the binary. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/package.zip \
|
||||
https://gitea.example.com/api/packages/testuser/cran/bin?platform=windows&rversion=4.2
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package is invalid. |
|
||||
| `409 Conflict` | A package file with the same combination of parameters exists already. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a R package from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
install.packages("{package_name}")
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
install.packages("testpackage")
|
||||
```
|
||||
123
versioned_docs/version-1.24/usage/packages/debian.md
Normal file
123
versioned_docs/version-1.24/usage/packages/debian.md
Normal file
@@ -0,0 +1,123 @@
|
||||
---
|
||||
date: "2023-01-07T00:00:00+00:00"
|
||||
slug: "debian"
|
||||
sidebar_position: 40
|
||||
---
|
||||
|
||||
# Debian Package Registry
|
||||
|
||||
Publish [Debian](https://www.debian.org/distrib/packages) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Debian registry, you need to use a HTTP client like `curl` to upload and a package manager like `apt` to consume packages.
|
||||
|
||||
The following examples use `apt`.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the Debian registry add the url to the list of known apt sources:
|
||||
|
||||
```shell
|
||||
echo "deb [signed-by=/etc/apt/keyrings/gitea-{owner}.asc] https://gitea.example.com/api/packages/{owner}/debian {distribution} {component}" | sudo tee -a /etc/apt/sources.list.d/gitea.list
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| -------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `distribution` | The distribution to use. |
|
||||
| `component` | The component to use. |
|
||||
|
||||
If the registry is private, provide credentials in the url. You can use a password or a [personal access token](development/api-usage.md#authentication):
|
||||
|
||||
```shell
|
||||
echo "deb [signed-by=/etc/apt/keyrings/gitea-{owner}.asc] https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/debian {distribution} {component}" | sudo tee -a /etc/apt/sources.list.d/gitea.list
|
||||
```
|
||||
|
||||
The Debian registry files are signed with a PGP key which must be known to apt:
|
||||
|
||||
```shell
|
||||
sudo curl https://gitea.example.com/api/packages/{owner}/debian/repository.key -o /etc/apt/keyrings/gitea-{owner}.asc
|
||||
```
|
||||
|
||||
Afterwards update the local package index:
|
||||
|
||||
```shell
|
||||
apt update
|
||||
```
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a Debian package (`*.deb`), perform a HTTP `PUT` operation with the package content in the request body.
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/debian/pool/{distribution}/{component}/upload
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `distribution` | The distribution may match the release name of the OS, ex: `bionic`. |
|
||||
| `component` | The component can be used to group packages or just `main` or similar. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/file.deb \
|
||||
https://gitea.example.com/api/packages/testuser/debian/pool/bionic/main/upload
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
You cannot publish a package if a package of the same name, version, distribution, component and architecture already exists. You must delete the existing package first.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package is invalid. |
|
||||
| `409 Conflict` | A package file with the same combination of parameters exists already. |
|
||||
|
||||
## Delete a package
|
||||
|
||||
To delete a Debian package perform a HTTP `DELETE` operation. This will delete the package version too if there is no file left.
|
||||
|
||||
```
|
||||
DELETE https://gitea.example.com/api/packages/{owner}/debian/pool/{distribution}/{component}/{package_name}/{package_version}/{architecture}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
| `distribution` | The package distribution. |
|
||||
| `component` | The package component. |
|
||||
| `architecture` | The package architecture. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_token_or_password -X DELETE \
|
||||
https://gitea.example.com/api/packages/testuser/debian/pool/bionic/main/test-package/1.0.0/amd64
|
||||
```
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `204 No Content` | Success |
|
||||
| `404 Not Found` | The package or file was not found. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a package from the Debian registry, execute the following commands:
|
||||
|
||||
```shell
|
||||
# use latest version
|
||||
apt install {package_name}
|
||||
# use specific version
|
||||
apt install {package_name}={package_version}
|
||||
```
|
||||
135
versioned_docs/version-1.24/usage/packages/generic.md
Normal file
135
versioned_docs/version-1.24/usage/packages/generic.md
Normal file
@@ -0,0 +1,135 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "generic"
|
||||
sidebar_position: 500
|
||||
---
|
||||
|
||||
# Generic Package Registry
|
||||
|
||||
Publish generic files, like release binaries or other output, for your user or organization.
|
||||
|
||||
## Authenticate to the package registry
|
||||
|
||||
To authenticate to the Package Registry, you need to provide [custom HTTP headers or use HTTP Basic authentication](development/api-usage.md#authentication).
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a generic package perform a HTTP PUT operation with the package content in the request body.
|
||||
You cannot publish a file with the same name twice to a package. You must delete the existing package version first.
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). |
|
||||
| `package_version` | The package version, a non-empty string without trailing or leading whitespaces. |
|
||||
| `file_name` | The filename. It can contain only lowercase letters (`a-z`), uppercase letter (`A-Z`), numbers (`0-9`), dots (`.`), hyphens (`-`), pluses (`+`), or underscores (`_`). |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/file.bin \
|
||||
https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0/file.bin
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package name and/or version and/or file name are invalid. |
|
||||
| `409 Conflict` | A file with the same name exist already in the package. |
|
||||
|
||||
## Download a package
|
||||
|
||||
To download a generic package perform a HTTP GET operation.
|
||||
|
||||
```
|
||||
GET https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{file_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
| `file_name` | The filename. |
|
||||
|
||||
The file content is served in the response body. The response content type is `application/octet-stream`.
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_token_or_password \
|
||||
https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0/file.bin
|
||||
```
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `200 OK` | Success |
|
||||
| `404 Not Found` | The package or file was not found. |
|
||||
|
||||
## Delete a package
|
||||
|
||||
To delete a generic package perform a HTTP DELETE operation. This will delete all files of this version.
|
||||
|
||||
```
|
||||
DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_token_or_password -X DELETE \
|
||||
https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0
|
||||
```
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `204 No Content` | Success |
|
||||
| `404 Not Found` | The package was not found. |
|
||||
|
||||
## Delete a package file
|
||||
|
||||
To delete a file of a generic package perform a HTTP DELETE operation. This will delete the package version too if there is no file left.
|
||||
|
||||
```
|
||||
DELETE https://gitea.example.com/api/packages/{owner}/generic/{package_name}/{package_version}/{filename}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
| `filename` | The filename. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_token_or_password -X DELETE \
|
||||
https://gitea.example.com/api/packages/testuser/generic/test_package/1.0.0/file.bin
|
||||
```
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `204 No Content` | Success |
|
||||
| `404 Not Found` | The package or file was not found. |
|
||||
66
versioned_docs/version-1.24/usage/packages/go.md
Normal file
66
versioned_docs/version-1.24/usage/packages/go.md
Normal file
@@ -0,0 +1,66 @@
|
||||
---
|
||||
date: "2023-05-10T00:00:00+00:00"
|
||||
slug: "go"
|
||||
sidebar_position: 45
|
||||
---
|
||||
|
||||
# Go Package Registry
|
||||
|
||||
Publish Go packages for your user or organization.
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a Go package perform a HTTP `PUT` operation with the package content in the request body.
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
The package must follow the [documented structure](https://go.dev/ref/mod#zip-files).
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/go/upload
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
To authenticate to the package registry, you need to provide [custom HTTP headers or use HTTP Basic authentication](development/api-usage.md#authentication):
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/file.zip \
|
||||
https://gitea.example.com/api/packages/testuser/go/upload
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package is invalid. |
|
||||
| `409 Conflict` | A package with the same name exist already. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a Go package instruct Go to use the package registry as proxy:
|
||||
|
||||
```shell
|
||||
# use latest version
|
||||
GOPROXY=https://gitea.example.com/api/packages/{owner}/go go install {package_name}
|
||||
# or
|
||||
GOPROXY=https://gitea.example.com/api/packages/{owner}/go go install {package_name}@latest
|
||||
# use specific version
|
||||
GOPROXY=https://gitea.example.com/api/packages/{owner}/go go install {package_name}@{package_version}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
|
||||
If the owner of the packages is private you need to [provide credentials](https://go.dev/ref/mod#private-module-proxy-auth).
|
||||
|
||||
More information about the `GOPROXY` environment variable and how to protect against data leaks can be found in [the documentation](https://go.dev/ref/mod#private-modules).
|
||||
55
versioned_docs/version-1.24/usage/packages/helm.md
Normal file
55
versioned_docs/version-1.24/usage/packages/helm.md
Normal file
@@ -0,0 +1,55 @@
|
||||
---
|
||||
date: "2022-04-14T00:00:00+00:00"
|
||||
slug: "helm"
|
||||
sidebar_position: 50
|
||||
---
|
||||
|
||||
# Helm Chart Registry
|
||||
|
||||
Publish [Helm](https://helm.sh/) charts for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Helm Chart registry use a simple HTTP client like `curl` or the [`helm cm-push`](https://github.com/chartmuseum/helm-push/) plugin.
|
||||
|
||||
## Publish a package
|
||||
|
||||
Publish a package by running the following command:
|
||||
|
||||
```shell
|
||||
curl --user {username}:{password} -X POST --upload-file ./{chart_file}.tgz https://gitea.example.com/api/packages/{owner}/helm/api/charts
|
||||
```
|
||||
|
||||
or with the `helm cm-push` plugin:
|
||||
|
||||
```shell
|
||||
helm repo add --username {username} --password {password} {repo} https://gitea.example.com/api/packages/{owner}/helm
|
||||
helm cm-push ./{chart_file}.tgz {repo}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ------------ | ----------- |
|
||||
| `username` | Your Gitea username. |
|
||||
| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. |
|
||||
| `repo` | The name for the repository. |
|
||||
| `chart_file` | The Helm Chart archive. |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a Helm char from the registry, execute the following command:
|
||||
|
||||
```shell
|
||||
helm repo add --username {username} --password {password} {repo} https://gitea.example.com/api/packages/{owner}/helm
|
||||
helm repo update
|
||||
helm install {name} {repo}/{chart}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ---------- | ----------- |
|
||||
| `username` | Your Gitea username. |
|
||||
| `password` | Your Gitea password or a personal access token. |
|
||||
| `repo` | The name for the repository. |
|
||||
| `owner` | The owner of the package. |
|
||||
| `name` | The local name. |
|
||||
| `chart` | The name Helm Chart. |
|
||||
154
versioned_docs/version-1.24/usage/packages/maven.md
Normal file
154
versioned_docs/version-1.24/usage/packages/maven.md
Normal file
@@ -0,0 +1,154 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "maven"
|
||||
sidebar_position: 60
|
||||
---
|
||||
|
||||
# Maven Package Registry
|
||||
|
||||
Publish [Maven](https://maven.apache.org) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Maven package registry, you can use [Maven](https://maven.apache.org/install.html) or [Gradle](https://gradle.org/install/).
|
||||
The following examples use `Maven` and `Gradle Groovy`.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry you first need to add your access token to the [`settings.xml`](https://maven.apache.org/settings.html) file:
|
||||
|
||||
```xml
|
||||
<settings>
|
||||
<servers>
|
||||
<server>
|
||||
<id>gitea</id>
|
||||
<configuration>
|
||||
<httpHeaders>
|
||||
<property>
|
||||
<name>Authorization</name>
|
||||
<value>token {access_token}</value>
|
||||
</property>
|
||||
</httpHeaders>
|
||||
</configuration>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
||||
```
|
||||
|
||||
Afterwards add the following sections to your project `pom.xml` file:
|
||||
|
||||
```xml
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.example.com/api/packages/{owner}/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.example.com/api/packages/{owner}/maven</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>gitea</id>
|
||||
<url>https://gitea.example.com/api/packages/{owner}/maven</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `access_token` | Your [personal access token](development/api-usage.md#authentication). |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
### Gradle variant
|
||||
|
||||
When you plan to add some packages from Gitea instance in your project, you should add it in repositories section:
|
||||
|
||||
```groovy
|
||||
repositories {
|
||||
// other repositories
|
||||
maven { url "https://gitea.example.com/api/packages/{owner}/maven" }
|
||||
}
|
||||
```
|
||||
|
||||
In Groovy gradle you may include next script in your publishing part:
|
||||
|
||||
```groovy
|
||||
publishing {
|
||||
// other settings of publication
|
||||
repositories {
|
||||
maven {
|
||||
name = "Gitea"
|
||||
url = uri("https://gitea.example.com/api/packages/{owner}/maven")
|
||||
|
||||
credentials(HttpHeaderCredentials) {
|
||||
name = "Authorization"
|
||||
value = "token {access_token}"
|
||||
}
|
||||
|
||||
authentication {
|
||||
header(HttpHeaderAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a package simply run:
|
||||
|
||||
```shell
|
||||
mvn deploy
|
||||
```
|
||||
|
||||
Or call `gradle` with task `publishAllPublicationsToGiteaRepository` in case you are using gradle:
|
||||
|
||||
```groovy
|
||||
./gradlew publishAllPublicationsToGiteaRepository
|
||||
```
|
||||
|
||||
If you want to publish a prebuild package to the registry, you can use [`mvn deploy:deploy-file`](https://maven.apache.org/plugins/maven-deploy-plugin/deploy-file-mojo.html):
|
||||
|
||||
```shell
|
||||
mvn deploy:deploy-file -Durl=https://gitea.example.com/api/packages/{owner}/maven -DrepositoryId=gitea -Dfile=/path/to/package.jar
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a Maven package from the package registry, add a new dependency to your project `pom.xml` file:
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.test.package</groupId>
|
||||
<artifactId>test_project</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
And analog in gradle groovy:
|
||||
|
||||
```groovy
|
||||
implementation "com.test.package:test_project:1.0.0"
|
||||
```
|
||||
|
||||
Afterwards run:
|
||||
|
||||
```shell
|
||||
mvn install
|
||||
```
|
||||
|
||||
## Supported commands
|
||||
|
||||
```
|
||||
mvn install
|
||||
mvn deploy
|
||||
mvn dependency:get:
|
||||
```
|
||||
132
versioned_docs/version-1.24/usage/packages/npm.md
Normal file
132
versioned_docs/version-1.24/usage/packages/npm.md
Normal file
@@ -0,0 +1,132 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "npm"
|
||||
sidebar_position: 70
|
||||
---
|
||||
|
||||
# NPM Package Registry
|
||||
|
||||
Publish [npm](https://www.npmjs.com/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the npm package registry, you need [Node.js](https://nodejs.org/en/download/) coupled with a package manager such as [Yarn](https://classic.yarnpkg.com/en/docs/install) or [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm/) itself.
|
||||
|
||||
The registry supports [scoped](https://docs.npmjs.com/misc/scope/) and unscoped packages.
|
||||
|
||||
The following examples use the `npm` tool with the scope `@test`.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry you need to configure a new package source.
|
||||
|
||||
```shell
|
||||
npm config set {scope}:registry=https://gitea.example.com/api/packages/{owner}/npm/
|
||||
npm config set -- '//gitea.example.com/api/packages/{owner}/npm/:_authToken' "{token}"
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ------------ | ----------- |
|
||||
| `scope` | The scope of the packages. |
|
||||
| `owner` | The owner of the package. |
|
||||
| `token` | Your [personal access token](development/api-usage.md#authentication). |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
npm config set @test:registry=https://gitea.example.com/api/packages/testuser/npm/
|
||||
npm config set -- '//gitea.example.com/api/packages/testuser/npm/:_authToken' "personal_access_token"
|
||||
```
|
||||
|
||||
or without scope:
|
||||
|
||||
```shell
|
||||
npm config set registry https://gitea.example.com/api/packages/testuser/npm/
|
||||
npm config set -- '//gitea.example.com/api/packages/testuser/npm/:_authToken' "personal_access_token"
|
||||
```
|
||||
|
||||
## Publish a package
|
||||
|
||||
Publish a package by running the following command in your project:
|
||||
|
||||
```shell
|
||||
npm publish
|
||||
```
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
## Unpublish a package
|
||||
|
||||
Delete a package by running the following command:
|
||||
|
||||
```shell
|
||||
npm unpublish {package_name}[@{package_version}]
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
npm unpublish @test/test_package
|
||||
npm unpublish @test/test_package@1.0.0
|
||||
```
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a package from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
npm install {package_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
npm install @test/test_package
|
||||
```
|
||||
|
||||
## Tag a package
|
||||
|
||||
The registry supports [version tags](https://docs.npmjs.com/adding-dist-tags-to-packages/) which can be managed by `npm dist-tag`:
|
||||
|
||||
```shell
|
||||
npm dist-tag add {package_name}@{version} {tag}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `package_name` | The package name. |
|
||||
| `version` | The version of the package. |
|
||||
| `tag` | The tag name. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
npm dist-tag add test_package@1.0.2 release
|
||||
```
|
||||
|
||||
The tag name must not be a valid version. All tag names which are parsable as a version are rejected.
|
||||
|
||||
## Search packages
|
||||
|
||||
The registry supports [searching](https://docs.npmjs.com/cli/v7/commands/npm-search/) but does not support special search qualifiers like `author:gitea`.
|
||||
|
||||
## Supported commands
|
||||
|
||||
```
|
||||
npm install
|
||||
npm ci
|
||||
npm publish
|
||||
npm unpublish
|
||||
npm dist-tag
|
||||
npm view
|
||||
npm search
|
||||
```
|
||||
106
versioned_docs/version-1.24/usage/packages/nuget.md
Normal file
106
versioned_docs/version-1.24/usage/packages/nuget.md
Normal file
@@ -0,0 +1,106 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "nuget"
|
||||
sidebar_position: 80
|
||||
---
|
||||
|
||||
# NuGet Package Registry
|
||||
|
||||
Publish [NuGet](https://www.nuget.org/) packages for your user or organization. The package registry supports the V2 and V3 API protocol and you can work with [NuGet Symbol Packages](https://docs.microsoft.com/en-us/nuget/create-packages/symbol-packages-snupkg) too.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the NuGet package registry, you can use command-line interface tools as well as NuGet features in various IDEs like Visual Studio.
|
||||
More information about NuGet clients can be found in [the official documentation](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools).
|
||||
The following examples use the `dotnet nuget` tool.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry you need to configure a new NuGet feed source:
|
||||
|
||||
```shell
|
||||
dotnet nuget add source --name {source_name} --username {username} --password {password} https://gitea.example.com/api/packages/{owner}/nuget/index.json
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ------------- | ----------- |
|
||||
| `source_name` | The desired source name. |
|
||||
| `username` | Your Gitea username. |
|
||||
| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
dotnet nuget add source --name gitea --username testuser --password password123 https://gitea.example.com/api/packages/testuser/nuget/index.json
|
||||
```
|
||||
|
||||
You can add the source without credentials and use the [`--api-key`](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push) parameter when publishing packages. In this case you need to provide a [personal access token](development/api-usage.md#authentication).
|
||||
|
||||
## Publish a package
|
||||
|
||||
Publish a package by running the following command:
|
||||
|
||||
```shell
|
||||
dotnet nuget push --source {source_name} {package_file}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `source_name` | The desired source name. |
|
||||
| `package_file` | Path to the package `.nupkg` file. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
dotnet nuget push --source gitea test_package.1.0.0.nupkg
|
||||
```
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
### Symbol Packages
|
||||
|
||||
The NuGet package registry has build support for a symbol server. The PDB files embedded in a symbol package (`.snupkg`) can get requested by clients.
|
||||
To do so, register the NuGet package registry as symbol source:
|
||||
|
||||
```
|
||||
https://gitea.example.com/api/packages/{owner}/nuget/symbols
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| `owner` | The owner of the package registry. |
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
https://gitea.example.com/api/packages/testuser/nuget/symbols
|
||||
```
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a NuGet package from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
dotnet add package --source {source_name} --version {package_version} {package_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `source_name` | The desired source name. |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
dotnet add package --source gitea --version 1.0.0 test_package
|
||||
```
|
||||
|
||||
## Supported commands
|
||||
|
||||
```
|
||||
dotnet add
|
||||
dotnet nuget push
|
||||
dotnet nuget delete
|
||||
```
|
||||
100
versioned_docs/version-1.24/usage/packages/overview.md
Normal file
100
versioned_docs/version-1.24/usage/packages/overview.md
Normal file
@@ -0,0 +1,100 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "overview"
|
||||
sidebar_position: 1
|
||||
---
|
||||
|
||||
# Overview
|
||||
|
||||
Starting with Gitea **1.17**, the Package Registry can be used as a public or private registry for common package managers.
|
||||
|
||||
## Supported package managers
|
||||
|
||||
The following package managers are currently supported:
|
||||
|
||||
| Name | Language | Package client |
|
||||
| ---- | -------- | -------------- |
|
||||
| [Alpine](usage/packages/alpine.md) | - | `apk` |
|
||||
| [Arch](usage/packages/arch.md) | - | `pacman` |
|
||||
| [Cargo](usage/packages/cargo.md) | Rust | `cargo` |
|
||||
| [Chef](usage/packages/chef.md) | - | `knife` |
|
||||
| [Composer](usage/packages/composer.md) | PHP | `composer` |
|
||||
| [Conan](usage/packages/conan.md) | C++ | `conan` |
|
||||
| [Conda](usage/packages/conda.md) | - | `conda` |
|
||||
| [Container](usage/packages/container.md) | - | any OCI compliant client |
|
||||
| [CRAN](usage/packages/cran.md) | R | - |
|
||||
| [Debian](usage/packages/debian.md) | - | `apt` |
|
||||
| [Generic](usage/packages/generic.md) | - | any HTTP client |
|
||||
| [Go](usage/packages/go.md) | Go | `go` |
|
||||
| [Helm](usage/packages/helm.md) | - | any HTTP client, `cm-push` |
|
||||
| [Maven](usage/packages/maven.md) | Java | `mvn`, `gradle` |
|
||||
| [npm](usage/packages/npm.md) | JavaScript | `npm`, `yarn`, `pnpm` |
|
||||
| [NuGet](usage/packages/nuget.md) | .NET | `nuget` |
|
||||
| [Pub](usage/packages/pub.md) | Dart | `dart`, `flutter` |
|
||||
| [PyPI](usage/packages/pypi.md) | Python | `pip`, `twine` |
|
||||
| [RPM](usage/packages/rpm.md) | - | `yum`, `dnf`, `zypper` |
|
||||
| [RubyGems](usage/packages/rubygems.md) | Ruby | `gem`, `Bundler` |
|
||||
| [Swift](usage/packages/swift.md) | Swift | `swift` |
|
||||
| [Vagrant](usage/packages/vagrant.md) | - | `vagrant` |
|
||||
|
||||
**The following paragraphs only apply if Packages are not globally disabled!**
|
||||
|
||||
## Repository-Packages
|
||||
|
||||
A package always belongs to an owner (a user or organisation), not a repository.
|
||||
To link an (already uploaded) package to a repository, open the settings page
|
||||
on that package and choose a repository to link this package to.
|
||||
The entire package will be linked, not just a single version.
|
||||
|
||||
Linking a package results in showing that package in the repository's package list,
|
||||
and shows a link to the repository on the package site (as well as a link to the repository issues).
|
||||
|
||||
## Access Restrictions
|
||||
|
||||
| Package owner type | User | Organization |
|
||||
|--------------------|------|--------------|
|
||||
| **read** access | public, if user is public too; otherwise for this user only | public, if org is public, otherwise for org members only |
|
||||
| **write** access | owner only | org members with admin or write access to the org |
|
||||
|
||||
N.B.: These access restrictions are [subject to change](https://github.com/go-gitea/gitea/issues/19270), where more finegrained control will be added via a dedicated organization team permission.
|
||||
|
||||
## Create or upload a package
|
||||
|
||||
Depending on the type of package, use the respective package-manager for that. Check out the sub-page of a specific package manager for instructions.
|
||||
|
||||
## View packages
|
||||
|
||||
You can view the packages of a repository on the repository page.
|
||||
|
||||
1. Go to the repository.
|
||||
1. Go to **Packages** in the navigation bar.
|
||||
|
||||
To view more details about a package, select the name of the package.
|
||||
|
||||
## Download a package
|
||||
|
||||
To download a package from your repository:
|
||||
|
||||
1. Go to **Packages** in the navigation bar.
|
||||
1. Select the name of the package to view the details.
|
||||
1. In the **Assets** section, select the name of the package file you want to download.
|
||||
|
||||
## Delete a package
|
||||
|
||||
You cannot edit a package after you have published it in the Package Registry. Instead, you
|
||||
must delete and recreate it.
|
||||
|
||||
To delete a package from your repository:
|
||||
|
||||
1. Go to **Packages** in the navigation bar.
|
||||
1. Select the name of the package to view the details.
|
||||
1. Click **Delete package** to permanently delete the package.
|
||||
|
||||
## Disable the Package Registry
|
||||
|
||||
The Package Registry is automatically enabled. To disable it for a single repository:
|
||||
|
||||
1. Go to **Settings** in the navigation bar.
|
||||
1. Disable **Enable Repository Packages Registry**.
|
||||
|
||||
Previously published packages are not deleted by disabling the Package Registry.
|
||||
71
versioned_docs/version-1.24/usage/packages/pub.md
Normal file
71
versioned_docs/version-1.24/usage/packages/pub.md
Normal file
@@ -0,0 +1,71 @@
|
||||
---
|
||||
date: "2022-07-31T00:00:00+00:00"
|
||||
slug: "pub"
|
||||
sidebar_position: 90
|
||||
---
|
||||
|
||||
# Pub Package Registry
|
||||
|
||||
Publish [Pub](https://dart.dev/guides/packages) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Pub package registry, you need to use the tools [dart](https://dart.dev/tools/dart-tool) and/or [flutter](https://docs.flutter.dev/reference/flutter-cli).
|
||||
|
||||
The following examples use dart.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry and provide credentials, execute:
|
||||
|
||||
```shell
|
||||
dart pub token add https://gitea.example.com/api/packages/{owner}/pub
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| ------------ | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
You need to provide your [personal access token](development/api-usage.md#authentication).
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a package, edit the `pubspec.yaml` and add the following line:
|
||||
|
||||
```yaml
|
||||
publish_to: https://gitea.example.com/api/packages/{owner}/pub
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| ------------ | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
|
||||
Now you can publish the package by running the following command:
|
||||
|
||||
```shell
|
||||
dart pub publish
|
||||
```
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a Pub package from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
dart pub add {package_name} --hosted-url=https://gitea.example.com/api/packages/{owner}/pub/
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
# use latest version
|
||||
dart pub add mypackage --hosted-url=https://gitea.example.com/api/packages/testuser/pub/
|
||||
# specify version
|
||||
dart pub add mypackage:1.0.8 --hosted-url=https://gitea.example.com/api/packages/testuser/pub/
|
||||
```
|
||||
75
versioned_docs/version-1.24/usage/packages/pypi.md
Normal file
75
versioned_docs/version-1.24/usage/packages/pypi.md
Normal file
@@ -0,0 +1,75 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "pypi"
|
||||
sidebar_position: 100
|
||||
---
|
||||
|
||||
# PyPI Package Registry
|
||||
|
||||
Publish [PyPI](https://pypi.org/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the PyPI package registry, you need to use the tools [pip](https://pypi.org/project/pip/) to consume and [twine](https://pypi.org/project/twine/) to publish packages.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry you need to edit your local `~/.pypirc` file. Add
|
||||
|
||||
```ini
|
||||
[distutils]
|
||||
index-servers = gitea
|
||||
|
||||
[gitea]
|
||||
repository = https://gitea.example.com/api/packages/{owner}/pypi
|
||||
username = {username}
|
||||
password = {password}
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| ------------ | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `username` | Your Gitea username. |
|
||||
| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. |
|
||||
|
||||
## Publish a package
|
||||
|
||||
Publish a package by running the following command:
|
||||
|
||||
```shell
|
||||
python3 -m twine upload --repository gitea /path/to/files/*
|
||||
```
|
||||
|
||||
The package files have the extensions `.tar.gz` and `.whl`.
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a PyPI package from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
pip install --index-url https://{username}:{password}@gitea.example.com/api/packages/{owner}/pypi/simple --no-deps {package_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `username` | Your Gitea username. |
|
||||
| `password` | Your Gitea password or a personal access token. |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
pip install --index-url https://testuser:password123@gitea.example.com/api/packages/testuser/pypi/simple --no-deps test_package
|
||||
```
|
||||
|
||||
You can use `--extra-index-url` instead of `--index-url` but that makes you vulnerable to dependency confusion attacks because `pip` checks the official PyPi repository for the package before it checks the specified custom repository. Read the `pip` docs for more information.
|
||||
|
||||
## Supported commands
|
||||
|
||||
```
|
||||
pip install
|
||||
twine upload
|
||||
```
|
||||
130
versioned_docs/version-1.24/usage/packages/rpm.md
Normal file
130
versioned_docs/version-1.24/usage/packages/rpm.md
Normal file
@@ -0,0 +1,130 @@
|
||||
---
|
||||
date: "2023-03-08T00:00:00+00:00"
|
||||
slug: "rpm"
|
||||
sidebar_position: 105
|
||||
---
|
||||
|
||||
# RPM Package Registry
|
||||
|
||||
Publish [RPM](https://rpm.org/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the RPM registry, you need to use a package manager like `yum`, `dnf` or `zypper` to consume packages.
|
||||
|
||||
The following examples use `dnf`.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the RPM registry add the url to the list of known sources:
|
||||
|
||||
```shell
|
||||
dnf config-manager --add-repo https://gitea.example.com/api/packages/{owner}/rpm/{group}.repo
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| ----------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `group` | Optional: Everything, e.g. empty, `el7`, `rocky/el9`, `test/fc38`. |
|
||||
|
||||
Example:
|
||||
|
||||
```shell
|
||||
# without a group
|
||||
dnf config-manager --add-repo https://gitea.example.com/api/packages/testuser/rpm.repo
|
||||
|
||||
# with the group 'centos/el7'
|
||||
dnf config-manager --add-repo https://gitea.example.com/api/packages/testuser/rpm/centos/el7.repo
|
||||
```
|
||||
|
||||
If the registry is private, provide credentials in the url. You can use a password or a [personal access token](development/api-usage.md#authentication):
|
||||
|
||||
```shell
|
||||
dnf config-manager --add-repo https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/rpm/{group}.repo
|
||||
```
|
||||
|
||||
You have to add the credentials to the urls in the created `.repo` file in `/etc/yum.repos.d` too.
|
||||
|
||||
## Publish a package
|
||||
|
||||
To publish a RPM package (`*.rpm`), perform a HTTP PUT operation with the package content in the request body.
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/rpm/{group}/upload
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `group` | Optional: Everything, e.g. empty, `el7`, `rocky/el9`, `test/fc38`. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
# without a group
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/file.rpm \
|
||||
https://gitea.example.com/api/packages/testuser/rpm/upload
|
||||
|
||||
# with the group 'centos/el7'
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/file.rpm \
|
||||
https://gitea.example.com/api/packages/testuser/rpm/centos/el7/upload
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
You cannot publish a file with the same name twice to a package. You must delete the existing package version first.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package is invalid. |
|
||||
| `409 Conflict` | A package file with the same combination of parameters exist already in the package. |
|
||||
|
||||
## Delete a package
|
||||
|
||||
To delete an RPM package perform a HTTP DELETE operation. This will delete the package version too if there is no file left.
|
||||
|
||||
```
|
||||
DELETE https://gitea.example.com/api/packages/{owner}/rpm/{group}/package/{package_name}/{package_version}/{architecture}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `group` | Optional: The package group. |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version. |
|
||||
| `architecture` | The package architecture. |
|
||||
|
||||
Example request using HTTP Basic authentication:
|
||||
|
||||
```shell
|
||||
# without a group
|
||||
curl --user your_username:your_token_or_password -X DELETE \
|
||||
https://gitea.example.com/api/packages/testuser/rpm/package/test-package/1.0.0/x86_64
|
||||
|
||||
# with the group 'centos/el7'
|
||||
curl --user your_username:your_token_or_password -X DELETE \
|
||||
https://gitea.example.com/api/packages/testuser/rpm/centos/el7/package/test-package/1.0.0/x86_64
|
||||
```
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `204 No Content` | Success |
|
||||
| `404 Not Found` | The package or file was not found. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a package from the RPM registry, execute the following commands:
|
||||
|
||||
```shell
|
||||
# use latest version
|
||||
dnf install {package_name}
|
||||
# use specific version
|
||||
dnf install {package_name}-{package_version}.{architecture}
|
||||
```
|
||||
115
versioned_docs/version-1.24/usage/packages/rubygems.md
Normal file
115
versioned_docs/version-1.24/usage/packages/rubygems.md
Normal file
@@ -0,0 +1,115 @@
|
||||
---
|
||||
date: "2021-07-20T00:00:00+00:00"
|
||||
slug: "rubygems"
|
||||
sidebar_position: 110
|
||||
---
|
||||
|
||||
# RubyGems Package Registry
|
||||
|
||||
Publish [RubyGems](https://guides.rubygems.org/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the RubyGems package registry, you need to use the [gem](https://guides.rubygems.org/command-reference/) command line tool to consume and publish packages.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry edit the `~/.gem/credentials` file and add:
|
||||
|
||||
```ini
|
||||
---
|
||||
https://gitea.example.com/api/packages/{owner}/rubygems: Bearer {token}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `token` | Your [personal access token](development/api-usage.md#authentication). |
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
---
|
||||
https://gitea.example.com/api/packages/testuser/rubygems: Bearer 3bd626f84b01cd26b873931eace1e430a5773cc4
|
||||
```
|
||||
|
||||
## Publish a package
|
||||
|
||||
Publish a package by running the following command:
|
||||
|
||||
```shell
|
||||
gem push --host {host} {package_file}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `host` | URL to the package registry. |
|
||||
| `package_file` | Path to the package `.gem` file. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
gem push --host https://gitea.example.com/api/packages/testuser/rubygems test_package-1.0.0.gem
|
||||
```
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a package from the package registry you can use [Bundler](https://bundler.io) or `gem`.
|
||||
|
||||
### Bundler
|
||||
|
||||
Add a new `source` block to your `Gemfile`:
|
||||
|
||||
```
|
||||
source "https://gitea.example.com/api/packages/{owner}/rubygems" do
|
||||
gem "{package_name}"
|
||||
end
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
source "https://gitea.example.com/api/packages/testuser/rubygems" do
|
||||
gem "test_package"
|
||||
end
|
||||
```
|
||||
|
||||
Afterwards run the following command:
|
||||
|
||||
```shell
|
||||
bundle install
|
||||
```
|
||||
|
||||
### gem
|
||||
|
||||
Execute the following command:
|
||||
|
||||
```shell
|
||||
gem install --host https://gitea.example.com/api/packages/{owner}/rubygems {package_name}
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
gem install --host https://gitea.example.com/api/packages/testuser/rubygems test_package
|
||||
```
|
||||
|
||||
## Supported commands
|
||||
|
||||
```
|
||||
gem install
|
||||
bundle install
|
||||
gem push
|
||||
```
|
||||
72
versioned_docs/version-1.24/usage/packages/storage.md
Normal file
72
versioned_docs/version-1.24/usage/packages/storage.md
Normal file
@@ -0,0 +1,72 @@
|
||||
---
|
||||
date: "2022-11-01T00:00:00+00:00"
|
||||
slug: "storage"
|
||||
sidebar_position: 3
|
||||
---
|
||||
|
||||
# Storage
|
||||
|
||||
This document describes the storage of the package registry and how it can be managed.
|
||||
|
||||
## Deduplication
|
||||
|
||||
The package registry has a build-in deduplication of uploaded blobs.
|
||||
If two identical files are uploaded only one blob is saved on the filesystem.
|
||||
This ensures no space is wasted for duplicated files.
|
||||
|
||||
If two packages are uploaded with identical files, both packages will display the same size but on the filesystem they require only half of the size.
|
||||
Whenever a package gets deleted, only the references to the underlying blobs are removed.
|
||||
The blobs get not removed at this moment, so they still require space on the filesystem.
|
||||
When a new package gets uploaded the existing blobs may get referenced again.
|
||||
|
||||
These unreferenced blobs get deleted by a [clean up job](../../administration/config-cheat-sheet.md#cron---cleanup-expired-packages-croncleanup_packages).
|
||||
The config setting `OLDER_THAN` configures how long unreferenced blobs are kept before they get deleted.
|
||||
|
||||
## Cleanup Rules
|
||||
|
||||
Package registries can become large over time without cleanup.
|
||||
It's recommended to delete unnecessary packages and set up cleanup rules to automatically manage the package registry usage.
|
||||
Every package owner (user or organization) manages the cleanup rules which are applied to their packages.
|
||||
|
||||
|Setting|Description|
|
||||
|-|-|
|
||||
|Enabled|Turn the cleanup rule on or off.|
|
||||
|Type|Every rule manages a specific package type.|
|
||||
|Apply pattern to full package name|If enabled, the patterns below are applied to the full package name (`package/version`). Otherwise only the version (`version`) is used.|
|
||||
|Keep the most recent|How many versions to *always* keep for each package.|
|
||||
|Keep versions matching|The regex pattern that determines which versions to keep. An empty pattern keeps no version while `.+` keeps all versions. The container registry will always keep the `latest` version even if not configured.|
|
||||
|Remove versions older than|Remove only versions older than the selected days.|
|
||||
|Remove versions matching|The regex pattern that determines which versions to remove. An empty pattern or `.+` leads to the removal of every package if no other setting tells otherwise.|
|
||||
|
||||
Every cleanup rule can show a preview of the affected packages.
|
||||
This can be used to check if the cleanup rules is proper configured.
|
||||
|
||||
### Regex examples
|
||||
|
||||
Regex patterns are automatically surrounded with `\A` and `\z` anchors.
|
||||
Do not include any `\A`, `\z`, `^` or `$` token in the regex patterns as they are not necessary.
|
||||
The patterns are case-insensitive which matches the behaviour of the package registry in Gitea.
|
||||
|
||||
|Pattern|Description|
|
||||
|-|-|
|
||||
|`.*`|Match every possible version.|
|
||||
|`v.+`|Match versions that start with `v`.|
|
||||
|`release`|Match only the version `release`.|
|
||||
|`release.*`|Match versions that are either named or start with `release`.|
|
||||
|`.+-temp-.+`|Match versions that contain `-temp-`.|
|
||||
|`v.+\|release`|Match versions that either start with `v` or are named `release`.|
|
||||
|`package/v.+\|other/release`|Match versions of the package `package` that start with `v` or the version `release` of the package `other`. This needs the setting *Apply pattern to full package name* enabled.|
|
||||
|
||||
### How the cleanup rules work
|
||||
|
||||
The cleanup rules are part of the [clean up job](../../administration/config-cheat-sheet.md#cron---cleanup-expired-packages-croncleanup_packages) and run periodically.
|
||||
|
||||
The cleanup rule:
|
||||
|
||||
1. Collects all packages of the package type for the owners registry.
|
||||
2. For every package it collects all versions.
|
||||
3. Excludes from the list the # versions based on the *Keep the most recent* value.
|
||||
4. Excludes from the list any versions matching the *Keep versions matching* value.
|
||||
5. Excludes from the list the versions more recent than the *Remove versions older than* value.
|
||||
6. Excludes from the list any versions not matching the *Remove versions matching* value.
|
||||
7. Deletes the remaining versions.
|
||||
90
versioned_docs/version-1.24/usage/packages/swift.md
Normal file
90
versioned_docs/version-1.24/usage/packages/swift.md
Normal file
@@ -0,0 +1,90 @@
|
||||
---
|
||||
date: "2023-01-10T00:00:00+00:00"
|
||||
slug: "swift"
|
||||
sidebar_position: 115
|
||||
---
|
||||
|
||||
# Swift Package Registry
|
||||
|
||||
Publish [Swift](https://www.swift.org/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Swift package registry, you need to use [swift](https://www.swift.org/getting-started/) to consume and a HTTP client (like `curl`) to publish packages.
|
||||
|
||||
## Configuring the package registry
|
||||
|
||||
To register the package registry and provide credentials, execute:
|
||||
|
||||
```shell
|
||||
swift package-registry set https://gitea.example.com/api/packages/{owner}/swift
|
||||
swift package-registry login https://gitea.example.com/api/packages/{owner}/swift --username {username} --password {password}
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| ------------ | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `username` | Your Gitea username. |
|
||||
| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. |
|
||||
|
||||
The login is optional and only needed if the package registry is private.
|
||||
|
||||
## Publish a package
|
||||
|
||||
First you have to pack the contents of your package:
|
||||
|
||||
```shell
|
||||
swift package archive-source
|
||||
```
|
||||
|
||||
To publish the package perform a HTTP PUT request with the package content in the request body.
|
||||
|
||||
```shell --user your_username:your_password_or_token \
|
||||
curl -X PUT --user {username}:{password} \
|
||||
-H "Accept: application/vnd.swift.registry.v1+json" \
|
||||
-F source-archive=@/path/to/package.zip \
|
||||
-F metadata={metadata} \
|
||||
https://gitea.example.com/api/packages/{owner}/swift/{scope}/{name}/{version}
|
||||
```
|
||||
|
||||
| Placeholder | Description |
|
||||
| ----------- | ----------- |
|
||||
| `username` | Your Gitea username. |
|
||||
| `password` | Your Gitea password. If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password. |
|
||||
| `owner` | The owner of the package. |
|
||||
| `scope` | The package scope. |
|
||||
| `name` | The package name. |
|
||||
| `version` | The package version. |
|
||||
| `metadata` | (Optional) The metadata of the package. JSON encoded subset of https://schema.org/SoftwareSourceCode |
|
||||
|
||||
You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package is invalid. |
|
||||
| `409 Conflict` | A package file with the same combination of parameters exists already. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a Swift package from the package registry, add it in the `Package.swift` file dependencies list:
|
||||
|
||||
```
|
||||
dependencies: [
|
||||
.package(id: "{scope}.{name}", from:"{version}")
|
||||
]
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------- | ----------- |
|
||||
| `scope` | The package scope. |
|
||||
| `name` | The package name. |
|
||||
| `version` | The package version. |
|
||||
|
||||
Afterwards execute the following command to install it:
|
||||
|
||||
```shell
|
||||
swift package resolve
|
||||
```
|
||||
76
versioned_docs/version-1.24/usage/packages/vagrant.md
Normal file
76
versioned_docs/version-1.24/usage/packages/vagrant.md
Normal file
@@ -0,0 +1,76 @@
|
||||
---
|
||||
date: "2022-08-23T00:00:00+00:00"
|
||||
slug: "vagrant"
|
||||
sidebar_position: 120
|
||||
---
|
||||
|
||||
# Vagrant Package Registry
|
||||
|
||||
Publish [Vagrant](https://www.vagrantup.com/) packages for your user or organization.
|
||||
|
||||
## Requirements
|
||||
|
||||
To work with the Vagrant package registry, you need [Vagrant](https://www.vagrantup.com/downloads) and a tool to make HTTP requests like `curl`.
|
||||
|
||||
## Publish a package
|
||||
|
||||
Publish a Vagrant box by performing a HTTP PUT request to the registry:
|
||||
|
||||
```
|
||||
PUT https://gitea.example.com/api/packages/{owner}/vagrant/{package_name}/{package_version}/{provider}.box
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| ----------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
| `package_version` | The package version, semver compatible. |
|
||||
| `provider` | One of the [supported provider names](https://www.vagrantup.com/docs/providers). |
|
||||
|
||||
Example for uploading a Hyper-V box:
|
||||
|
||||
```shell
|
||||
curl --user your_username:your_password_or_token \
|
||||
--upload-file path/to/your/vagrant.box \
|
||||
https://gitea.example.com/api/packages/testuser/vagrant/test_system/1.0.0/hyperv.box
|
||||
```
|
||||
|
||||
If you are using 2FA or OAuth use a [personal access token](development/api-usage.md#authentication) instead of the password.
|
||||
|
||||
You cannot publish a box if a box of the same name, version and provider already exists. You must delete the existing package first.
|
||||
|
||||
The server responds with the following HTTP Status codes.
|
||||
|
||||
| HTTP Status Code | Meaning |
|
||||
| ----------------- | ------- |
|
||||
| `201 Created` | The package has been published. |
|
||||
| `400 Bad Request` | The package is invalid. |
|
||||
| `409 Conflict` | A package with the same combination of parameters exists already. |
|
||||
|
||||
## Install a package
|
||||
|
||||
To install a box from the package registry, execute the following command:
|
||||
|
||||
```shell
|
||||
vagrant box add "https://gitea.example.com/api/packages/{owner}/vagrant/{package_name}"
|
||||
```
|
||||
|
||||
| Parameter | Description |
|
||||
| -------------- | ----------- |
|
||||
| `owner` | The owner of the package. |
|
||||
| `package_name` | The package name. |
|
||||
|
||||
For example:
|
||||
|
||||
```shell
|
||||
vagrant box add "https://gitea.example.com/api/packages/testuser/vagrant/test_system"
|
||||
```
|
||||
|
||||
This will install the latest version of the package. To add a specific version, use the `--box-version` parameter.
|
||||
If the registry is private you can pass your [personal access token](development/api-usage.md#authentication) in the `VAGRANT_CLOUD_TOKEN` environment variable.
|
||||
|
||||
## Supported commands
|
||||
|
||||
```
|
||||
vagrant box add
|
||||
```
|
||||
77
versioned_docs/version-1.24/usage/permissions.md
Normal file
77
versioned_docs/version-1.24/usage/permissions.md
Normal file
@@ -0,0 +1,77 @@
|
||||
---
|
||||
date: "2021-12-13:10:10+08:00"
|
||||
slug: "permissions"
|
||||
sidebar_position: 14
|
||||
aliases:
|
||||
- /en-us/permissions
|
||||
---
|
||||
|
||||
# Permissions
|
||||
|
||||
Gitea supports permissions for repository so that you can give different access for different people. At first, we need to know about `Unit`.
|
||||
|
||||
## Unit
|
||||
|
||||
In Gitea, we call a sub module of a repository `Unit`. Now we have following possible units.
|
||||
|
||||
| Name | Description | Permissions |
|
||||
| --------------- | ---------------------------------------------------- | ----------- |
|
||||
| Code | Access source code, files, commits and branches. | Read Write |
|
||||
| Issues | Organize bug reports, tasks and milestones. | Read Write |
|
||||
| PullRequests | Enable pull requests and code reviews. | Read Write |
|
||||
| Releases | Track project versions and downloads. | Read Write |
|
||||
| Wiki | Write and share documentation with collaborators. | Read Write |
|
||||
| ExternalWiki | Link to an external wiki | Read |
|
||||
| ExternalTracker | Link to an external issue tracker | Read |
|
||||
| Projects | The URL to the template repository | Read Write |
|
||||
| Packages | Packages which linked to this repository | Read Write |
|
||||
| Actions | Review actions logs or restart/cacnel pipelines | Read Write |
|
||||
| Settings | Manage the repository | Admin |
|
||||
|
||||
With different permissions, people could do different things with these units.
|
||||
|
||||
| Name | Read | Write | Admin |
|
||||
| --------------- | ------------------------------------------------- | ---------------------------- | ------------------------- |
|
||||
| Code | View code trees, files, commits, branches and etc. | Push codes. | - |
|
||||
| Issues | View issues and create new issues. | Add labels, assign, close | - |
|
||||
| PullRequests | View pull requests and create new pull requests. | Add labels, assign, close | - |
|
||||
| Releases | View releases and download files. | Create/Edit releases | - |
|
||||
| Wiki | View wiki pages. Clone the wiki repository. | Create/Edit wiki pages, push | - |
|
||||
| ExternalWiki | Link to an external wiki | - | - |
|
||||
| ExternalTracker | Link to an external issue tracker | - | - |
|
||||
| Projects | View the columns of projects | Change issues across columns | - |
|
||||
| Packages | View the packages | Upload/Delete packages | - |
|
||||
| Actions | View the Actions logs | Approve / Cancel / Restart | - |
|
||||
| Settings | - | - | Manage the repository |
|
||||
|
||||
And there are some differences for permissions between individual repositories and organization repositories.
|
||||
|
||||
## Individual Repository
|
||||
|
||||
For individual repositories, the creators are the only owners of repositories and have no limit to change anything of this
|
||||
repository or delete it. Repositories owners could add collaborators to help maintain the repositories. Collaborators could have `Read`, `Write` and `Admin` permissions.
|
||||
|
||||
For a private repository, the experience is similar to visiting an anonymous public repository. You have access to all the available content within the repository, including the ability to clone the code, create issues, respond to issue comments, submit pull requests, and more. If you have 'Write' permission, you can push code to specific branches of the repository, provided it's permitted by the branch protection rules. Additionally, you can make changes to the wiki pages. With 'Admin' permission, you have the ability to modify the repository's settings.
|
||||
|
||||
But you cannot delete or transfer this repository if you are not that repository's owner.
|
||||
|
||||
## Organization Repository
|
||||
|
||||
For individual repositories, the owner is the user who created it. For organization repositories, the owners are the members of the owner team on this organization. All the permissions depends on the team permission settings.
|
||||
|
||||
### Owner Team
|
||||
|
||||
The owner team will be created when the organization is created, and the creator will become the first member of the owner team. The owner team cannot be deleted and there is at least one member.
|
||||
|
||||
### Admin Team
|
||||
|
||||
When creating teams, there are two types of teams. One is the admin team, another is the general team. An admin team can be created to manage some of the repositories, whose members can do anything with these repositories. Only members of the owner or admin team can create a new team.
|
||||
|
||||
### General Team
|
||||
|
||||
A general team in an organization has unit permissions settings. It can have members and repositories scope.
|
||||
|
||||
- A team could access all the repositories in this organization or special repositories.
|
||||
- A team could also be allowed to create new repositories or not.
|
||||
|
||||
The General team can be created to do the operations allowed by their permissions. One member could join multiple teams.
|
||||
16
versioned_docs/version-1.24/usage/profile-readme.md
Normal file
16
versioned_docs/version-1.24/usage/profile-readme.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
date: "2023-03-02T21:00:00+05:00"
|
||||
slug: "profile-readme"
|
||||
sidebar_position: 12
|
||||
---
|
||||
|
||||
# Profile READMEs
|
||||
|
||||
To display a Markdown file in your Gitea user or organization profile page, create a repository named `.profile` and add a new file named `README.md` to it.
|
||||
Gitea will automatically display the contents of the file on your profile, in a new "Overview" above your repositories.
|
||||
|
||||
Making the `.profile` repository private will hide the Profile README.
|
||||
|
||||
Example of user with `.profile/README.md`:
|
||||
|
||||

|
||||
46
versioned_docs/version-1.24/usage/protected-tags.md
Normal file
46
versioned_docs/version-1.24/usage/protected-tags.md
Normal file
@@ -0,0 +1,46 @@
|
||||
---
|
||||
date: "2021-05-14T00:00:00-00:00"
|
||||
slug: "protected-tags"
|
||||
sidebar_position: 45
|
||||
aliases:
|
||||
- /en-us/protected-tags
|
||||
---
|
||||
|
||||
# Protected tags
|
||||
|
||||
Protected tags allow control over who has permission to create or update Git tags. Each rule allows you to match either an individual tag name, or use an appropriate pattern to control multiple tags at once.
|
||||
|
||||
## Setting up protected tags
|
||||
|
||||
To protect a tag, you need to follow these steps:
|
||||
|
||||
1. Go to the repository’s **Settings** > **Tags** page.
|
||||
1. Type a pattern to match a name. You can use a single name, a [glob pattern](https://pkg.go.dev/github.com/gobwas/glob#Compile) or a regular expression.
|
||||
1. Choose the allowed users and/or teams. If you leave these fields empty no one is allowed to create or modify this tag.
|
||||
1. Select **Save** to save the configuration.
|
||||
|
||||
## Pattern protected tags
|
||||
|
||||
The pattern uses [glob](https://pkg.go.dev/github.com/gobwas/glob#Compile) or regular expressions to match a tag name. For regular expressions you need to enclose the pattern in slashes.
|
||||
|
||||
Examples:
|
||||
|
||||
| Type | Pattern Protected Tag | Possible Matching Tags |
|
||||
| ----- | ------------------------ | --------------------------------------- |
|
||||
| Glob | `v*` | `v`, `v-1`, `version2` |
|
||||
| Glob | `v[0-9]` | `v0`, `v1` up to `v9` |
|
||||
| Glob | `*-release` | `2.1-release`, `final-release` |
|
||||
| Glob | `gitea` | only `gitea` |
|
||||
| Glob | `*gitea*` | `gitea`, `2.1-gitea`, `1_gitea-release` |
|
||||
| Glob | `{v,rel}-*` | `v-`, `v-1`, `v-final`, `rel-`, `rel-x` |
|
||||
| Glob | `*` | matches all possible tag names |
|
||||
| Regex | `/\Av/` | `v`, `v-1`, `version2` |
|
||||
| Regex | `/\Av[0-9]\z/` | `v0`, `v1` up to `v9` |
|
||||
| Regex | `/\Av\d+\.\d+\.\d+\z/` | `v1.0.17`, `v2.1.0` |
|
||||
| Regex | `/\Av\d+(\.\d+){0,2}\z/` | `v1`, `v2.1`, `v1.2.34` |
|
||||
| Regex | `/-release\z/` | `2.1-release`, `final-release` |
|
||||
| Regex | `/gitea/` | `gitea`, `2.1-gitea`, `1_gitea-release` |
|
||||
| Regex | `/\Agitea\z/` | only `gitea` |
|
||||
| Regex | `/^gitea$/` | only `gitea` |
|
||||
| Regex | `/\A(v\|rel)-/` | `v-`, `v-1`, `v-final`, `rel-`, `rel-x` |
|
||||
| Regex | `/.+/` | matches all possible tag names |
|
||||
60
versioned_docs/version-1.24/usage/pull-request.md
Normal file
60
versioned_docs/version-1.24/usage/pull-request.md
Normal file
@@ -0,0 +1,60 @@
|
||||
---
|
||||
date: "2018-06-01T19:00:00+02:00"
|
||||
slug: "pull-request"
|
||||
sidebar_position: 13
|
||||
aliases:
|
||||
- /en-us/pull-request
|
||||
---
|
||||
|
||||
# Pull Request
|
||||
|
||||
A Pull Request (PR) is a way to propose changes to a repository.
|
||||
It is a request to merge one branch into another, accompanied by a description of the changes that were made.
|
||||
Pull Requests are commonly used as a way for contributors to propose changes and for maintainers to review and merge those changes.
|
||||
|
||||
## Creating a pull request
|
||||
|
||||
To create a PR, you'll need to follow these steps:
|
||||
|
||||
1. **Fork the repository** - If you don't have permission to make changes to the repository directly, you'll need to fork the repository to your own account.
|
||||
This creates a copy of the repository that you can make changes to.
|
||||
|
||||
2. **Create a branch (optional)** - Create a new branch on your forked repository that contains the changes you want to propose.
|
||||
Give the branch a descriptive name that indicates what the changes are for.
|
||||
|
||||
3. **Make your changes** - Make the changes you want, commit, and push them to your forked repository.
|
||||
|
||||
4. **Create the PR** - Go to the original repository and go to the "Pull Requests" tab. Click the "New Pull Request" button and select your new branch as the source branch.
|
||||
Enter a descriptive title and description for your Pull Request and click "Create Pull Request".
|
||||
|
||||
## Reviewing a pull request
|
||||
|
||||
When a PR is created, it triggers a review process. The maintainers of the repository are notified of the PR and can review the changes that were made.
|
||||
They can leave comments, request changes, or approve the changes.
|
||||
|
||||
If the maintainers request changes, you'll need to make those changes in your branch and push the changes to your forked repository.
|
||||
The PR will be updated automatically with the new changes.
|
||||
|
||||
If the maintainers approve the changes, they can merge the PR into the repository.
|
||||
|
||||
## Closing a pull request
|
||||
|
||||
If you decide that you no longer want to merge a PR, you can close it.
|
||||
To close a PR, go to the open PR and click the "Close Pull Request" button. This will close the PR without merging it.
|
||||
|
||||
## "Work In Progress" pull requests
|
||||
|
||||
Marking a pull request as being a work in progress will prevent that pull request from being accidentally merged.
|
||||
To mark a pull request as being a work in progress, you must prefix its title by `WIP:` or `[WIP]` (case insensitive).
|
||||
Those values are configurable in your `app.ini` file:
|
||||
|
||||
```ini
|
||||
[repository.pull-request]
|
||||
WORK_IN_PROGRESS_PREFIXES=WIP:,[WIP]
|
||||
```
|
||||
|
||||
The first value of the list will be used in helpers.
|
||||
|
||||
## Pull Request Templates
|
||||
|
||||
You can find more information about pull request templates at the page [Issue and Pull Request templates](usage/issue-pull-request-templates.md).
|
||||
63
versioned_docs/version-1.24/usage/push.md
Normal file
63
versioned_docs/version-1.24/usage/push.md
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
date: "2020-07-06T16:00:00+02:00"
|
||||
slug: "push"
|
||||
sidebar_position: 15
|
||||
aliases:
|
||||
- /en-us/push-to-create
|
||||
- /en-us/push-options
|
||||
---
|
||||
|
||||
# Push
|
||||
|
||||
There are some additional features when pushing commits to Gitea server.
|
||||
|
||||
## Open PR through Push
|
||||
|
||||
When you push commits to a non-default branch for the first time,
|
||||
you will receive a link you can click on to visit the compare page of your branch compared to your main branch.
|
||||
From there, it's easy to create a pull request, even if you want to target another branch.
|
||||
|
||||

|
||||
|
||||
## Push Options
|
||||
|
||||
In Gitea `1.13`, support for some [push options](https://git-scm.com/docs/git-push#Documentation/git-push.txt--oltoptiongt)
|
||||
were added.
|
||||
|
||||
### Supported Options
|
||||
|
||||
- `repo.private` (true|false) - Change the repository's visibility.
|
||||
|
||||
This is particularly useful when combined with push-to-create.
|
||||
|
||||
- `repo.template` (true|false) - Change whether the repository is a template.
|
||||
|
||||
Example of changing a repository's visibility to public:
|
||||
|
||||
```shell
|
||||
git push -o repo.private=false -u origin main
|
||||
```
|
||||
|
||||
## Push To Create
|
||||
|
||||
Push to create is a feature that allows you to push to a repository that does not exist yet in Gitea. This is useful for automation and for allowing users to create repositories without having to go through the web interface. This feature is disabled by default.
|
||||
|
||||
### Enabling Push To Create
|
||||
|
||||
In the `app.ini` file, set `ENABLE_PUSH_CREATE_USER` to `true` and `ENABLE_PUSH_CREATE_ORG` to `true` if you want to allow users to create repositories in their own user account and in organizations they are a member of respectively. Restart Gitea for the changes to take effect. You can read more about these two options in the [Configuration Cheat Sheet](../administration/config-cheat-sheet.md#repository-repository).
|
||||
|
||||
### Using Push To Create
|
||||
|
||||
Assuming you have a git repository in the current directory, you can push to a repository that does not exist yet in Gitea by running the following command:
|
||||
|
||||
```shell
|
||||
# Add the remote you want to push to
|
||||
git remote add origin git@{domain}:{username}/{repo name that does not exist yet}.git
|
||||
|
||||
# push to the remote
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
This assumes you are using an SSH remote, but you can also use HTTPS remotes as well.
|
||||
|
||||
Push-to-create will default to the visibility defined by `DEFAULT_PUSH_CREATE_PRIVATE` in `app.ini`.
|
||||
98
versioned_docs/version-1.24/usage/repo-mirror.md
Normal file
98
versioned_docs/version-1.24/usage/repo-mirror.md
Normal file
@@ -0,0 +1,98 @@
|
||||
---
|
||||
date: "2021-05-13T00:00:00-00:00"
|
||||
slug: "repo-mirror"
|
||||
sidebar_position: 45
|
||||
aliases:
|
||||
- /en-us/repo-mirror
|
||||
---
|
||||
|
||||
# Repository Mirror
|
||||
|
||||
Repository mirroring allows for the mirroring of repositories to and from external sources. You can use it to mirror branches, tags, and commits between repositories.
|
||||
|
||||
## Use cases
|
||||
|
||||
The following are some possible use cases for repository mirroring:
|
||||
|
||||
- You migrated to Gitea but still need to keep your project in another source. In that case, you can simply set it up to mirror to Gitea (pull) and all the essential history of commits, tags, and branches are available in your Gitea instance.
|
||||
- You have old projects in another source that you don’t use actively anymore, but don’t want to remove for archiving purposes. In that case, you can create a push mirror so that your active Gitea repository can push its changes to the old location.
|
||||
|
||||
## Pulling from a remote repository
|
||||
|
||||
For an existing remote repository, you can set up pull mirroring as follows:
|
||||
|
||||
1. Select **New Migration** in the **Create...** menu on the top right.
|
||||
2. Select the remote repository service.
|
||||
3. Enter a repository URL.
|
||||
4. If the repository needs authentication fill in your authentication information.
|
||||
5. Check the box **This repository will be a mirror**.
|
||||
6. Select **Migrate repository** to save the configuration.
|
||||
|
||||
The repository now gets mirrored periodically from the remote repository. You can force a sync by selecting **Synchronize Now** in the repository settings.
|
||||
|
||||
:::warning
|
||||
:exclamation::exclamation: You can only set up pull mirroring for repos that don't exist yet on your instance. Once the repo is created, you can't convert it into a pull mirror anymore. :exclamation::exclamation:
|
||||
:::
|
||||
|
||||
## Pushing to a remote repository
|
||||
|
||||
For an existing repository, you can set up push mirroring as follows:
|
||||
|
||||
1. In your repository, go to **Settings** > **Repository**, and then the **Mirror Settings** section.
|
||||
2. Enter a repository URL.
|
||||
3. If the repository needs authentication expand the **Authorization** section and fill in your authentication information. Note that the requested **password** can also be your access token.
|
||||
4. Select **Add Push Mirror** to save the configuration.
|
||||
|
||||
The repository now gets mirrored periodically to the remote repository. You can force a sync by selecting **Synchronize Now**. In case of an error a message displayed to help you resolve it.
|
||||
|
||||
:::warning
|
||||
:exclamation::exclamation: This will force push to the remote repository. This will overwrite any changes in the remote repository! :exclamation::exclamation:
|
||||
:::
|
||||
|
||||
### Setting up a push mirror from Gitea to GitHub
|
||||
|
||||
To set up a mirror from Gitea to GitHub, you need to follow these steps:
|
||||
|
||||
1. Create a [GitHub personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with the *public_repo* box checked. Also check the **workflow** checkbox in case your repo uses GitHub Actions for continuous integration.
|
||||
2. Create a repository with that name on GitHub. Unlike Gitea, GitHub does not support creating repositories by pushing to the remote. You can also use an existing remote repo if it has the same commit history as your Gitea repo.
|
||||
3. In the settings of your Gitea repo, fill in the **Git Remote Repository URL**: `https://github.com/<your_github_group>/<your_github_project>.git`.
|
||||
4. Fill in the **Authorization** fields with your GitHub username and the personal access token as **Password**.
|
||||
5. (Optional, available on Gitea 1.18+) Select `Sync when new commits are pushed` so that the mirror will be updated as well as soon as there are changes. You can also disable the periodic sync if you like.
|
||||
6. Select **Add Push Mirror** to save the configuration.
|
||||
|
||||
The repository pushes shortly thereafter. To force a push, select the **Synchronize Now** button.
|
||||
|
||||
### Setting up a push mirror from Gitea to GitLab
|
||||
|
||||
To set up a mirror from Gitea to GitLab, you need to follow these steps:
|
||||
|
||||
1. Create a [GitLab personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) with *write_repository* scope.
|
||||
2. Fill in the **Git Remote Repository URL**: `https://<destination host>/<your_gitlab_group_or_name>/<your_gitlab_project>.git`.
|
||||
3. Fill in the **Authorization** fields with `oauth2` as **Username** and your GitLab personal access token as **Password**.
|
||||
4. Select **Add Push Mirror** to save the configuration.
|
||||
|
||||
The repository pushes shortly thereafter. To force a push, select the **Synchronize Now** button.
|
||||
|
||||
### Setting up a push mirror from Gitea to Bitbucket
|
||||
|
||||
To set up a mirror from Gitea to Bitbucket, you need to follow these steps:
|
||||
|
||||
1. Create a [Bitbucket app password](https://support.atlassian.com/bitbucket-cloud/docs/app-passwords/) with the *Repository Write* box checked.
|
||||
2. Fill in the **Git Remote Repository URL**: `https://bitbucket.org/<your_bitbucket_group_or_name>/<your_bitbucket_project>.git`.
|
||||
3. Fill in the **Authorization** fields with your Bitbucket username and the app password as **Password**.
|
||||
4. Select **Add Push Mirror** to save the configuration.
|
||||
|
||||
The repository pushes shortly thereafter. To force a push, select the **Synchronize Now** button.
|
||||
|
||||
### Mirror an existing ssh repository
|
||||
|
||||
Currently Gitea supports no ssh push mirrors. You can work around this by adding a `post-receive` hook to your Gitea repository that pushes manually.
|
||||
|
||||
1. Make sure the user running Gitea has access to the git repo you are trying to mirror to from shell.
|
||||
2. On the web interface at the repository settings > git hooks add a post-receive hook for the mirror. I.e.
|
||||
|
||||
```
|
||||
#!/usr/bin/env bash
|
||||
git push --mirror --quiet git@github.com:username/repository.git &>/dev/null &
|
||||
echo "GitHub mirror initiated .."
|
||||
```
|
||||
86
versioned_docs/version-1.24/usage/template-repositories.md
Normal file
86
versioned_docs/version-1.24/usage/template-repositories.md
Normal file
@@ -0,0 +1,86 @@
|
||||
---
|
||||
date: "2019-11-28:00:00+02:00"
|
||||
slug: "template-repositories"
|
||||
sidebar_position: 14
|
||||
aliases:
|
||||
- /en-us/template-repositories
|
||||
---
|
||||
|
||||
# Template Repositories
|
||||
|
||||
Since Gitea `1.11`, you can create template repositories.
|
||||
When creating a repo based on a template, you can copy most of its content, and even auto-inject variables into it.
|
||||
|
||||
By default, variables will not be expanded in any file.
|
||||
Only files contained in a pattern inside the `.gitea/template` file will be checked for if they contain variables.
|
||||
When creating the template, all files are included except for this `.gitea/template` file.
|
||||
|
||||
Gitea uses [gobwas/glob](https://github.com/gobwas/glob) for its glob syntax.
|
||||
It closely resembles a traditional `.gitignore`, however there may be slight differences.
|
||||
|
||||
## Example `.gitea/template` file
|
||||
|
||||
All paths are relative to the base of the repository
|
||||
|
||||
```gitignore
|
||||
# Expand all .go files, anywhere in the repository
|
||||
**.go
|
||||
|
||||
# All text files in the text directory
|
||||
text/*.txt
|
||||
|
||||
# A specific file
|
||||
a/b/c/d.json
|
||||
|
||||
# Batch files in both upper or lower case can be matched
|
||||
**.[bB][aA][tT]
|
||||
```
|
||||
|
||||
## Variable Expansion
|
||||
|
||||
In any file matched by the above globs, the variables below will be expanded.
|
||||
|
||||
Matching filenames and paths can also be expanded, and are conservatively sanitized to support cross-platform filesystems.
|
||||
|
||||
You can use variables by prefixing them with `$` or surrounding them with `${}`, so both `$VAR` and `${VAR}` insert the value of `VAR` at this location.
|
||||
To escape an expansion, use `$$`, such as `$$VAR` or `$${VAR}`.
|
||||
|
||||
These are the variables Gitea currently recognizes:
|
||||
|
||||
| Variable | Expands To | Transformable |
|
||||
| -------------------- | --------------------------------------------------- | ------------- |
|
||||
| YEAR | The year of generating the repository (i.e. `2024`) | ✘ |
|
||||
| MONTH | The month of generating the repository (i.e. `03`) | ✘ |
|
||||
| MONTH_ENGLISH | The month but in English (i.e. `March`) | ✓ |
|
||||
| DAY | The day of generating the repository (i.e. `02`) | ✘ |
|
||||
| REPO_NAME | The name of the generated repository | ✓ |
|
||||
| TEMPLATE_NAME | The name of the template repository | ✓ |
|
||||
| REPO_DESCRIPTION | The description of the generated repository | ✘ |
|
||||
| TEMPLATE_DESCRIPTION | The description of the template repository | ✘ |
|
||||
| REPO_OWNER | The owner of the generated repository | ✓ |
|
||||
| TEMPLATE_OWNER | The owner of the template repository | ✓ |
|
||||
| REPO_LINK | The URL to the generated repository | ✘ |
|
||||
| TEMPLATE_LINK | The URL to the template repository | ✘ |
|
||||
| REPO_HTTPS_URL | The HTTP(S) clone link for the generated repository | ✘ |
|
||||
| TEMPLATE_HTTPS_URL | The HTTP(S) clone link for the template repository | ✘ |
|
||||
| REPO_SSH_URL | The SSH clone link for the generated repository | ✘ |
|
||||
| TEMPLATE_SSH_URL | The SSH clone link for the template repository | ✘ |
|
||||
|
||||
## Transformers :robot:
|
||||
|
||||
Since Gitea `1.12.0`, variables marked as transformable in the table above also have alternative versions where the given transformer has been applied.
|
||||
|
||||
Transformed variables can be called by appending the transformer name to the variable name.
|
||||
For example, to get `REPO_NAME` in `PASCAL`-case, you should use the variable `${REPO_NAME_PASCAL}`.
|
||||
|
||||
The following transformers are available (assuming `go-sdk` is the input):
|
||||
|
||||
| Transformer | Effect |
|
||||
| ----------- | ------ |
|
||||
| SNAKE | go_sdk |
|
||||
| KEBAB | go-sdk |
|
||||
| CAMEL | goSdk |
|
||||
| PASCAL | GoSdk |
|
||||
| LOWER | go-sdk |
|
||||
| UPPER | GO-SDK |
|
||||
| TITLE | Go-Sdk |
|
||||
189
versioned_docs/version-1.24/usage/webhooks.md
Normal file
189
versioned_docs/version-1.24/usage/webhooks.md
Normal file
@@ -0,0 +1,189 @@
|
||||
---
|
||||
date: "2016-12-01T16:00:00+02:00"
|
||||
slug: "webhooks"
|
||||
sidebar_position: 30
|
||||
aliases:
|
||||
- /en-us/webhooks
|
||||
---
|
||||
|
||||
# Webhooks
|
||||
|
||||
Gitea supports webhooks for repository events. This can be configured in the settings
|
||||
page `/:username/:reponame/settings/hooks` by a repository admin. Webhooks can also be configured on a per-organization and whole system basis.
|
||||
All event pushes are POST requests. The methods currently supported are:
|
||||
|
||||
- Gitea (can also be a GET request)
|
||||
- Gogs
|
||||
- Slack
|
||||
- Discord
|
||||
- Dingtalk
|
||||
- Telegram
|
||||
- Microsoft Teams
|
||||
- Feishu
|
||||
- Wechatwork
|
||||
- Packagist
|
||||
|
||||
### Event information
|
||||
|
||||
:::warning
|
||||
The `secret` field in the payload is deprecated as of Gitea 1.13.0 and will be removed in 1.14.0: https://github.com/go-gitea/gitea/issues/11755
|
||||
:::
|
||||
|
||||
The following is an example of event information that will be sent by Gitea to
|
||||
a Payload URL:
|
||||
|
||||
```http
|
||||
X-GitHub-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473
|
||||
X-GitHub-Event: push
|
||||
X-Gogs-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473
|
||||
X-Gogs-Event: push
|
||||
X-Gitea-Delivery: f6266f16-1bf3-46a5-9ea4-602e06ead473
|
||||
X-Gitea-Event: push
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"secret": "3gEsCfjlV2ugRwgpU#w1*WaW*wa4NXgGmpCfkbG3",
|
||||
"ref": "refs/heads/develop",
|
||||
"before": "28e1879d029cb852e4844d9c718537df08844e03",
|
||||
"after": "bffeb74224043ba2feb48d137756c8a9331c449a",
|
||||
"compare_url": "http://localhost:3000/gitea/webhooks/compare/28e1879d029cb852e4844d9c718537df08844e03...bffeb74224043ba2feb48d137756c8a9331c449a",
|
||||
"commits": [
|
||||
{
|
||||
"id": "bffeb74224043ba2feb48d137756c8a9331c449a",
|
||||
"message": "Webhooks Yay!",
|
||||
"url": "http://localhost:3000/gitea/webhooks/commit/bffeb74224043ba2feb48d137756c8a9331c449a",
|
||||
"author": {
|
||||
"name": "Gitea",
|
||||
"email": "someone@gitea.io",
|
||||
"username": "gitea"
|
||||
},
|
||||
"committer": {
|
||||
"name": "Gitea",
|
||||
"email": "someone@gitea.io",
|
||||
"username": "gitea"
|
||||
},
|
||||
"timestamp": "2017-03-13T13:52:11-04:00"
|
||||
}
|
||||
],
|
||||
"repository": {
|
||||
"id": 140,
|
||||
"owner": {
|
||||
"id": 1,
|
||||
"login": "gitea",
|
||||
"full_name": "Gitea",
|
||||
"email": "someone@gitea.io",
|
||||
"avatar_url": "https://localhost:3000/avatars/1",
|
||||
"username": "gitea"
|
||||
},
|
||||
"name": "webhooks",
|
||||
"full_name": "gitea/webhooks",
|
||||
"description": "",
|
||||
"private": false,
|
||||
"fork": false,
|
||||
"html_url": "http://localhost:3000/gitea/webhooks",
|
||||
"ssh_url": "ssh://gitea@localhost:2222/gitea/webhooks.git",
|
||||
"clone_url": "http://localhost:3000/gitea/webhooks.git",
|
||||
"website": "",
|
||||
"stars_count": 0,
|
||||
"forks_count": 1,
|
||||
"watchers_count": 1,
|
||||
"open_issues_count": 7,
|
||||
"default_branch": "master",
|
||||
"created_at": "2017-02-26T04:29:06-05:00",
|
||||
"updated_at": "2017-03-13T13:51:58-04:00"
|
||||
},
|
||||
"pusher": {
|
||||
"id": 1,
|
||||
"login": "gitea",
|
||||
"full_name": "Gitea",
|
||||
"email": "someone@gitea.io",
|
||||
"avatar_url": "https://localhost:3000/avatars/1",
|
||||
"username": "gitea"
|
||||
},
|
||||
"sender": {
|
||||
"id": 1,
|
||||
"login": "gitea",
|
||||
"full_name": "Gitea",
|
||||
"email": "someone@gitea.io",
|
||||
"avatar_url": "https://localhost:3000/avatars/1",
|
||||
"username": "gitea"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Example
|
||||
|
||||
This is an example of how to use webhooks to run a php script upon push requests to the repository.
|
||||
In your repository Settings, under Webhooks, Setup a Gitea webhook as follows:
|
||||
|
||||
- Target URL: http://mydomain.com/webhook.php
|
||||
- HTTP Method: POST
|
||||
- POST Content Type: application/json
|
||||
- Secret: 123
|
||||
- Trigger On: Push Events
|
||||
- Active: Checked
|
||||
|
||||
Now on your server create the php file webhook.php
|
||||
|
||||
```php
|
||||
<?php
|
||||
|
||||
$secret_key = '123';
|
||||
|
||||
// check for POST request
|
||||
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
|
||||
error_log('FAILED - not POST - '. $_SERVER['REQUEST_METHOD']);
|
||||
exit();
|
||||
}
|
||||
|
||||
// get content type
|
||||
$content_type = isset($_SERVER['CONTENT_TYPE']) ? strtolower(trim($_SERVER['CONTENT_TYPE'])) : '';
|
||||
|
||||
if ($content_type != 'application/json') {
|
||||
error_log('FAILED - not application/json - '. $content_type);
|
||||
exit();
|
||||
}
|
||||
|
||||
// get payload
|
||||
$payload = trim(file_get_contents("php://input"));
|
||||
|
||||
if (empty($payload)) {
|
||||
error_log('FAILED - no payload');
|
||||
exit();
|
||||
}
|
||||
|
||||
// get header signature
|
||||
$header_signature = isset($_SERVER['HTTP_X_GITEA_SIGNATURE']) ? $_SERVER['HTTP_X_GITEA_SIGNATURE'] : '';
|
||||
|
||||
if (empty($header_signature)) {
|
||||
error_log('FAILED - header signature missing');
|
||||
exit();
|
||||
}
|
||||
|
||||
// calculate payload signature
|
||||
$payload_signature = hash_hmac('sha256', $payload, $secret_key, false);
|
||||
|
||||
// check payload signature against header signature
|
||||
if ($header_signature !== $payload_signature) {
|
||||
error_log('FAILED - payload signature');
|
||||
exit();
|
||||
}
|
||||
|
||||
// convert json to array
|
||||
$decoded = json_decode($payload, true);
|
||||
|
||||
// check for json decode errors
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
error_log('FAILED - json decode - '. json_last_error());
|
||||
exit();
|
||||
}
|
||||
|
||||
// success, do something
|
||||
```
|
||||
|
||||
There is a Test Delivery button in the webhook settings that allows to test the configuration as well as a list of the most Recent Deliveries.
|
||||
|
||||
### Authorization header
|
||||
|
||||
**With 1.19**, Gitea hooks can be configured to send an [authorization header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Authorization) to the webhook target.
|
||||
Reference in New Issue
Block a user