commit bbc9c5beb895051499ba2993c1aaf9cd7015f9f8 Author: Magnus Andersson Date: Thu Jan 18 07:52:38 2024 +0100 Initial commit actrunner with user creation diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..26bf109 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +hooks: + cp git-hooks/* .git/hooks/ diff --git a/git-hooks/pre-push b/git-hooks/pre-push new file mode 100644 index 0000000..060c38a --- /dev/null +++ b/git-hooks/pre-push @@ -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 diff --git a/manifests/podmanrunner.pp b/manifests/podmanrunner.pp new file mode 100644 index 0000000..79a2c14 --- /dev/null +++ b/manifests/podmanrunner.pp @@ -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, + } +}