Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Public Git Mirror Cronjobs
## How it's works
Each organization Andrei Jiroh set up to mirror in mau.dev has some configuration in the manifests directory, depending on what code host the canonical source they fall:
* `gitlab-saas` - GitLab.com
* `github` - GitHub
* `salsa.deb` - Debian Salsa
* `alpinelinux` - gitlab.alpinelinux.org
In each manifest has its own `scripts/codehost/namespace.sh` where the script will look like to the following below...
```bash
#!/usr/bin/env bash
# In case of GitLab instances where we can use subgroups, an optional SUBGROUP_SLUG is there to rescue.
NAMESPACE="namespace${SUBGROUP_SLUG}"
REPO_SLUG_SRC=${REPO_SLUG_SRC}
# Instead of cloning everything, we only clone one whole branch.
BRANCH=${BRANCH}
TARGET_REPO_HOST=${TARGET_REPO_HOST}
git clone "https://gitlab.com/$NAMESPACE/$REPO_SLUG_SRC" ./srcRepo --branch "$BRANCH"
git -C ./srcRepo push "$TARGET_REPO_HOST/$NAMESPACE/$REPO_SLUG_SRC" "$BRANCH" -o ci.skip
```
...which then configured to the manifest file with:
```yml
example-repo:develop:
stage: synchorize-mirrors
scripts:
# Feel free to fork this repo if you want and change TARGET_REPO_HOST to point to your
# GitLab/Gitea instance. :)
- REPO_SLUG_SRC="repo" BRANCH=main TARGET_REPO_HOST="https://mau.dev" ./scripts/codehost/namespace.sh
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_COMMIT_BRANCH == "main"'
- if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"'
when: manual
```
## Opening in Gitpod
Use the link below to open this repo in Gitpod, which also clone our Kubernetes configs for GitLab Runners:
<https://gitpod.io/#https://mau.dev/mirrors/cronjobs.git>
### Setup
To open `mau.dev` repositories in Gitpod.io, go to <https://gitpod.io/integrations>, scroll down to Git Integrations for self-hosted instances, hit **New integration** and fill up the form with the following details:
* Provider Host Name: `mau.dev`
* App ID: `548a5e43171ae3daaab49306486e9119c187ec1fa7f3ef14ccaa41622ce6781f`
* App Secret: `4f631f90cb59c64a8d5b16272d03885617549c3f7b5eecb8ede8fa842f78cc98`
After filling up, hit **Activate Integration** and then press **Authorize** on the GitLab OAuth prompt to activate.
### Required Variables
* `OKTETO_CLOUD_NAMESPACE` and `OKTETO_CLOUD_TOKEN` - Okteto Cloud API token for authenicating with the CLI and namespace to generate kubeconfig.
## Notes
* To avoid disprution on shared runners, we ad an push option to skip pipeline triggers through `ci.skip` but currently this only work on GitLab instances.