Initial commit actrunner with user creation

This commit is contained in:
Magnus Andersson 2024-01-18 07:52:38 +01:00
commit bbc9c5beb8
Signed by: mandersson
GPG key ID: 19CB2C58E1F19B16
3 changed files with 33 additions and 0 deletions

2
Makefile Normal file
View file

@ -0,0 +1,2 @@
hooks:
cp git-hooks/* .git/hooks/

19
git-hooks/pre-push Normal file
View file

@ -0,0 +1,19 @@
#!/bin/bash
cur_branch=$(git branch --show-current)
new_tagname=$(git tag --contains="$(git rev-parse HEAD)")
# It is ok if the new tagname is empty, it means that this is an untagged commit and we just move on
if [[ -z ${new_tagname} ]]; then
exit 0
fi
# It is also ok if the new tagname matches the name of the branch
if [[ ${new_tagname} =~ ${cur_branch} ]]; then
exit 0
fi
# All other cases means that the new tagname is set, but does not match the name of the branch so we reject it
echo "Your tag: ${new_tagname} does not match the name of the branch: ${cur_branch}."
echo "To push anyway run again with the --no-verify option"
exit 1

12
manifests/podmanrunner.pp Normal file
View file

@ -0,0 +1,12 @@
# Class for forgeo action runner.
class podmanrunner::runner ()
{
user {
'podmanuser':
ensure => present,
home => /opt/podmanuser,
shell => /usr/sbin/nologin,
uid => 1001,
managehome => true,
}
}