📅  最后修改于: 2022-03-11 15:00:24.890000             🧑  作者: Mango
.approval_template:
image: node:buster
before_script:
- |
cat <<'EOF' >> approval.js
var users = process.env.USERS.split(',');
if (users.includes(process.env.GITLAB_USER_LOGIN)) {
console.log(process.env.GITLAB_USER_LOGIN + " allowed to run this job")
process.exit(0)
} else {
console.log(process.env.GITLAB_USER_LOGIN + " cannot trigger this job")
console.log("List of users allowed to run this job")
for (user in users)
{
console.log(users[user])
}
process.exit(1)
}
EOF
- node approval.js
- rm approval.js
when: manual