Skip to content

Commit 616a4fa

Browse files
committed
Gitlab pipeline: Ensure correct permissions on files. Specifically check for the executable bit
1 parent 7fe833c commit 616a4fa

File tree

6 files changed

+27
-0
lines changed

6 files changed

+27
-0
lines changed

.gitlab-ci.yml

+18
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
11
# Chronologically specify the pipeline stages to run
22
stages:
3+
- permissions
34
- lint
45

6+
# Relevant for scripts that are cloned here to be run e.g. when building an image
7+
Ensure execute permissions:
8+
stage: permissions
9+
image: alpine
10+
before_script:
11+
- apk add fd
12+
- printf 'Ensuring executable permissions on all files:'
13+
script:
14+
- |+
15+
for fperm in $(fd . ${CI_PROJECT_DIR} --type f --exec stat -c %a); do
16+
if [ "$fperm" != "755" ] && [ "$fperm" != "777" ]; then
17+
printf "%s\n" "At least one file does not have execute permissions. Specifically it had the permission: $fperm" \
18+
"All files in this repo should have 755/777 permissions, because they're being cloned and executed."
19+
exit 1
20+
fi
21+
done
22+
523
# Common settings for linters to avoid code repetition
624
# Needs can be used to specify dependencies
725
# Allow failure is whether the pipeline succeeds on failure or not

LICENSE

100644100755
File mode changed.

README.md

100644100755
File mode changed.

common/security/README

100644100755
File mode changed.

justfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
alias fp := fix-permissions
3+
4+
@default:
5+
if ! which fzf > /dev/null 2>&1; then echo "fzf not installed. If on Ubuntu: Install the fzf package." && exit 1; fi
6+
@just --choose
7+
8+
fix-permissions:
9+
fd --type f --exclude .git --exec chmod 755

os2borgerpc/os2borgerpc/inactivity_suspend_after_time.sh

100644100755
File mode changed.

0 commit comments

Comments
 (0)