-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
169 lines (159 loc) · 5.32 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
169 lines (159 loc) · 5.32 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
spec:
inputs:
operation:
description: "Operation to perform"
type: string
options:
[
"None",
"Bump Packages",
"Schedule Packages",
"Run Schedule",
"Drop Packages",
"Add Packages",
]
default: "None"
packages:
description: "A colon-separated list of packages. Optional builder classes can be passed per-package using a slash: pkgbase/custom_builder"
type: string
regex: '^(?:[\w@.+\-/]+(?::[\w@.+\-/]+)*)?$'
rules:
- if: $[[ inputs.operation ]] == 'Bump Packages' || $[[ inputs.operation ]] == 'Schedule Packages' || $[[ inputs.operation ]] == 'Drop Packages'
default: null
trigger:
description: "Which schedule to trigger"
rules:
- if: $[[ inputs.operation ]] == 'Run Schedule'
default: null
add_packages:
description: "A space-separated list of packages+package sources in pkgbase/source format. Example: paru/aur"
type: string
regex: '^([\w@.+\-]+/(aur|(https?|git)://\S+)(\s[\w@.+\-]+/(aur|(https?|git)://\S+))*)?$'
rules:
- if: $[[ inputs.operation ]] == 'Add Packages'
default: null
request_origin:
description: "Where and who requested this package? Example: github/5678,chaotic/xiota,forum/tne"
type: string
rules:
- if: $[[ inputs.operation ]] == 'Add Packages'
default: null
request_reason:
description: "Why is this package being added?"
type: string
rules:
- if: $[[ inputs.operation ]] == 'Add Packages'
options:
[
"unset",
"request",
"depends",
"depends:optional",
"depends:make",
"depends:check",
]
default: "unset"
custom_request_reason:
description: "Overwrites request_reason"
type: string
rules:
- if: $[[ inputs.operation ]] == 'Add Packages'
default: null
---
stages: [process, schedule]
variables:
REPO_URL: https://oauth2:$ACCESS_TOKEN@$CI_SERVER_HOST/$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME
PACKAGES: $[[ inputs.packages ]]
TRIGGER: $[[ inputs.trigger ]]
default:
before_script:
- apk add --no-cache --upgrade git bash findutils grep curl jq shfmt rsync diffutils gawk openssh tar zstd pacman nvchecker sudo coreutils
- git remote set-url origin $REPO_URL
- git fetch --tags --all --depth 20
include:
- local: ".gitlab-ci-*.yml"
on-commit:
stage: process
image: alpine:latest
script:
- .ci/on-commit.sh
artifacts:
paths:
- .ci/deptree.txt
- .ci/schedule-params.txt
expire_in: 1 hour
resource_group: chaotic
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "push"
on-schedule:
stage: process
image: alpine:latest
script:
- .ci/on-schedule.sh
artifacts:
paths:
- .ci/deptree.txt
- .ci/schedule-params.txt
expire_in: 1 hour
resource_group: chaotic
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.operation ]]" == 'Run Schedule'
manual-schedule:
stage: process
image: alpine:latest
script:
- .ci/manual-schedule.sh
artifacts:
paths:
- .ci/deptree.txt
- .ci/schedule-params.txt
expire_in: 1 hour
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.operation ]]" == 'Schedule Packages' && "$[[ inputs.packages ]]" != ""
manual-bump:
stage: process
image: alpine:latest
script:
- .ci/manual-bump.sh
resource_group: chaotic
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.operation ]]" == 'Bump Packages' && "$[[ inputs.packages ]]" != ""
manual-drop:
stage: process
image: alpine:latest
script:
- .ci/manual-drop.sh
resource_group: chaotic
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.operation ]]" == 'Drop Packages' && "$[[ inputs.packages ]]" != ""
manual-add:
stage: process
image: alpine:latest
script:
- REQUEST_REASON=${CUSTOM_REQUEST_REASON:-$REQUEST_REASON}
- .ci/manual-add.sh
resource_group: chaotic
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && "$[[ inputs.operation ]]" == 'Add Packages' && "$[[ inputs.add_packages ]]" != ""
variables:
ADD_PACKAGES: $[[ inputs.add_packages ]]
REQUEST_ORIGIN: $[[ inputs.request_origin ]]
REQUEST_REASON: $[[ inputs.request_reason ]]
CUSTOM_REQUEST_REASON: $[[ inputs.custom_request_reason ]]
do-schedule:
stage: schedule
image:
name: registry.gitlab.com/garuda-linux/tools/chaotic-manager/manager
entrypoint: [""] # override entrypoint as we don't have the needed key during first execution yet
before_script:
- '[[ -z ${DEPLOY_KEY+x} ]] && echo "No deploy key available, backing off!" && exit 1'
- echo "$DEPLOY_KEY" >/app/sshkey
- chmod 400 /app/sshkey
script:
- |
if [ -f .ci/schedule-params.txt ]; then set -x; source ".ci/schedule-params.txt";
if [[ -v PARAMS_SCHEDULE ]]; then /entry_point.sh "${PARAMS_SCHEDULE[@]}"; fi;
if [[ -v PARAMS_AUTOREPOREMOVE ]]; then /entry_point.sh "${PARAMS_AUTOREPOREMOVE[@]}"; fi;
fi
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && ($CI_PIPELINE_SOURCE == "push" || "$[[ inputs.operation ]]" == 'Schedule Packages' || "$[[ inputs.operation ]]" == 'Run Schedule')