I am trying to chmod into a file. Sometimes it doesn't exist. In a case like this, I want it not to give any error. That means the chmod
should only be executed if the file is exist.
I am doing this with gitlab-runner
, but still it executes the shell
scripts so this is something to be fixed from linux
side, not from gitlab
Here is what I try to do
ssh-publickey:
stage: ssh-publickey
script:
- pwd
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh # i want to check before executing this command
- sudo chmod 700 ~/.ssh/gitlab.pem
- echo $PRIVATEKEY > ~/.ssh/gitlab.pem