I'm trying to pull code with gitlab-runner with a shell executor.
$ git pull origin master
error: cannot open .git/FETCH_HEAD: Permission denied
ERROR: Job failed: exit status 1
git status seems to work fine but when I try git fetch
$ git fetch
error: cannot open .git/FETCH_HEAD: Permission denied
ERROR: Job failed: exit status 1
This could be because you did not add a deploy key for your gitlab-runner user in your gitlab project, so the runner user does not have access to your gitlab repository.
You should follow theses steps to create the keypair for gitlab-runner user (the shell executor user) https://docs.gitlab.com/ee/ci/ssh_keys/#ssh-keys-when-using-the-shell-executor
Then copy the created public key in /home/gitlab-runner/.ssh/id_rsa.pub
And add it to your gitlab project's deploy key :
Go to you gitlab project
Settings => Repository
Deploy keys
Add a title, past the public key and click "Add key"
Trigger you CI again and the shell executor runner should be able to pull the repository.
I just solved this problem by running this command
sudo chown -R $(whoami) .git/ in my project directory.
You can change $(whoami) to the username of your server. For example sudo chown -R gitlab-runner .git/
Changing the permissions helped!
sudo chown -R .git/
Related
I've been trying to make scheduled reports with zabbix 5.4 but i keen getting the following error when i try to test:
Cannot fetch data: chrome failed to start:
Sorry, home directories outside of /home are not currently supported.
See https://forum.snapcraft.io/t/11209 for details.
.
I don't know where my errors lay. i installed google chrome and i followed all the instruction and created /var/lib/zabbix/ also chown zabbix:zabbix /var/lib/zabbix/ chmod 755 /var/lib/zabbix
but nothing .please help me i you know my error
I forgot to create a Zabbix user with a directory, that's why I got this kind of error.
addgroup --system --quiet zabbix
adduser --quiet --system --disabled-login --ingroup zabbix --home /var/lib/zabbix --no-create-home zabbix
I use a shutdown-script to backup the files on an instance before it is shutdown.
In this shutdown-script, the gsutil tool is used to send files to a bucket at google cloud storage.
/snap/bin/gsutil -m rsync -d -r /home/ganjin/notebook gs://ganjin-computing/XXXXXXXXXXX/TEST-202104/notebook
It worked well for long days. But recently, there occurs some error as below.
If I run the code manually, it works well. It seems that there is something wrong with jobs management of systemd.
Could anyone give me some hint?
INFO shutdown-script: /snap/bin/gsutil -m rsync -d -r /home/ganjin/notebook gs://ganjin-computing/XXXXXXXXXXX/TEST-202104/notebook
Apr 25 03:00:41 instance-XXXXXXXXXXX systemd[1]: Requested transaction contradicts existing jobs: Transaction for snap.google-cloud-sdk.gsutil.d027e14e-3905-4c96-9e42-c1f5ee9c6b1d.scope/start is destructive (poweroff.target has 'start' job queued, but 'stop' is included in transaction).
Apr 25 03:00:41 instance-XXXXXXXXXXX shutdown-script: INFO shutdown-script: internal error, please report: running "google-cloud-sdk.gsutil" failed: cannot create transient scope: DBus error "org.freedesktop.systemd1.TransactionIsDestructive": [Transaction for snap.google-cloud-sdk.gsutil.d027e14e-3905-4c96-9e42-c1f5ee9c6b1d.scope/start is destructive (poweroff.target has 'start' job queued, but 'stop' is included in transaction).]
Update gsutil with -f option.
update gsutil -f
If the above command doesn’t work then try the command below:
sudo apt-get update && sudo apt-get --only-upgrade install google-cloud-sdk
Update guest environment and try to shutdown the instance. Use the link below as a reference to update the guest environment.
https://cloud.google.com/compute/docs/images/install-guest-environment#update-guest
If still facing issues do forceful shutdown:
sudo poweroff -f
Context
I am using Elastic Beanstalk to deploy a very simple test application. I have several packages I want to install using apt. I have included a 01_installations.sh script with the installations in the .platform/hooks/prebuild directory. When I zip my application and deploy to Elastic Beanstalk, the logs confirm that the prebuild script runs, but it does not have permissions.
2020/08/12 21:03:46.674234 [INFO] Executing instruction: RunAppDeployPreBuildHooks
2020/08/12 21:03:46.674256 [INFO] Executing platform hooks in .platform/hooks/prebuild/
2020/08/12 21:03:46.674296 [INFO] Following platform hooks will be executed in order: [01_installations.sh]
2020/08/12 21:03:46.674302 [INFO] Running platform hook: .platform/hooks/prebuild/01_installations.sh
2020/08/12 21:03:46.674482 [ERROR] An error occurred during execution of command [app-deploy] - [RunAppDeployPreBuildHooks]. Stop running the command. Error: Command .platform/hooks/prebuild/01_installations.sh failed with error fork/exec .platform/hooks/prebuild/01_installations.sh: permission denied
Question
My understanding is that permissions were denied because I did not add chmod +x to make the .sh file executable. As the AWS documentation on platform hooks states: "Use chmod +x to set execute permission on your hook files." (https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/platforms-linux-extend.html). My question is: how do I do this?
I simply have the .sh file in a directory. I do not call it from anywhere else. Is there a simple step I'm missing? The AWS documentation makes it seem like it should be straightforward.
Previous Attempts
Things I have tried:
Adding .ebextensions
Attempt: Create a .config file in the .ebextensions directory with the below command which should execute the .sh file with chmod +x permissions.
Result: The same error occurs. The Elastic Beanstalk logs do not indicate that the .config was processed at all.
container_commands:
01_chmod1:
command: "chmod +x .platform/hooks/prebuild/01_installations.sh"
Changing the name of the .sh file
Attempt: Change the .sh file to be named "chmod +x 01_installations.sh" as suggested by an AWS user (forums link below). Remove the .ebextensions
Result: The same error occurs.
[RunAppDeployPreBuildHooks]. Stop running the command. Error: Command .platform/hooks/prebuild/chmod +x 01_installations.sh failed with error fork/exec .platform/hooks/prebuild/chmod +x 01_installations.sh: permission denied
I have reviewed the ideas here, but none of them actually include complete enough examples to follow:
https://forums.aws.amazon.com/thread.jspa?messageID=942515
https://github.com/aws/elastic-beanstalk-roadmap/issues/15
Make sure to make your file executable in git
chmod +x path/to/file
git update-index --chmod=+x path/to/file
reference from
How to add chmod permissions to file in GIT?
Normally you set the permissions on your local workstation, when before you zip your deployment package.
However, if you want to do this on EB instance, then you can't use container_commands for that. The reason is that container_commands execute after prebuild. Instead you should try using commands:
The prebuild files run after running commands found in the commands section of any configuration file and before running Buildfile commands.
This worked for me after updating the permission commit the changes.
Also the commands in .config file will not work as those commands will run pre-deployment and hence will not be able to find the path to .sh file.
As per the documentation, monitoring is shipped with OKD.
OKD ships with a pre-configured and self-updating monitoring stack that is based on the Prometheus open source project and its wider eco-system. It provides monitoring of cluster components and ships with a set of alerts to immediately notify the cluster administrator about any occurring problems and a set of Grafana dashboards.
Further, as per the documentation, this command should show links for various monitoring tools. oc -n openshift-monitoring get routes
When I run the oc command with system user, I get a message as: No resources found.
The installation does not go through.
git clone https://github.com/openshift/cluster-monitoring-operator
cd cluster-monitoring-operator
oc apply -f manifests/
Error messages:
namespace "openshift-monitoring" created
serviceaccount "cluster-monitoring-operator" created
unable to decode "manifests/0000_50_cluster_monitoring_operator_02-role.yaml": no kind "ClusterRole" is registered for version "rbac.authorization.k8s.io/v1beta1"
unable to decode "manifests/0000_50_cluster_monitoring_operator_03-role-binding.yaml": no kind "ClusterRoleBinding" is registered for version "rbac.authorization.k8s.io/v1beta1"
unable to decode "manifests/0000_50_cluster_monitoring_operator_04-deployment.yaml": no kind "Deployment" is registered for version "apps/v1"
unable to decode "manifests/0000_50_cluster_monitoring_operator_05-clusteroperator.yaml": no kind "ClusterOperator" is registered for version "config.openshift.io/v1"
unable to decode "manifests/0000_90_cluster_monitoring_operator_00-operatorgroup.yaml": no kind "OperatorGroup" is registered for version "operators.coreos.com/v1"
So, how do we enable monitoring with minishift?
You can follow this to install prometheus in minishift:
https://github.com/minishift/minishift-addons/tree/master/add-ons/prometheus
Be sure that you login as admin. If you encounter problem to login as admin, you can follow these steps:
minishift ssh
[docker#example ~]$ sudo su
[root#example ~]# export KUBECONFIG=/var/lib/minishift/base/openshift-apiserver/admin.kubeconfig PATH="$PATH:/var/lib/minishift/bin"
[root#example ~]# oc adm policy add-cluster-role-to-user cluster-admin admin
[root#example ~]# exit
[docker#example ~]$ exit
oc login -u admin -p admin
oc whoami
You will see you login as admin.
When I enter the command to apply the prometheus, I encountered this problem:
minishift addons apply prometheus --addon-env namespace=kube-system
-- Applying addon 'prometheus':.Error applying the add-on: Error executing command 'oc new-app -f prometheus.yaml -p NAMESPACE=#{namespace} -n #{namespace}'.
Solution:
login Minishift as admin using "oc login -u admin -p admin".
go to the namespace "kube-system" by "oc project kube-system".
click on "Add to project" -> "import YAML/JSON".
clone the prometheus addon in your local machine from https://github.com/minishift/minishift-addons.git
import the ../minishift-addons/add-ons/prometheus/prometheus.yml into the "kube-system" namespace.
Afterwards, the prometheus will be deployed.
You can access the prometheus graph UI: https://prometheus-kube-system.$minishift-host-ip-address.nip.io.
I want to install dbweb to manage a MySQL database server but I get this error in cmd.
I tried to to install that on my go project and get same error.
C:\Users\NakhodaSokoot>go get github.com/go-xorm/dbweb
# cd C:\Users\NakhodaSokoot\go\src\github.com\lunny\nodb; git pull --ff-only
fatal: No remote repository specified. Please, specify either a URL or a
remote name from which new revisions should be fetched.
package github.com/lunny/nodb/config: exit status 1
# cd C:\Users\NakhodaSokoot\go\src\golang.org\x\crypto; git pull --ff-only
fatal: No remote repository specified. Please, specify either a URL or a
remote name from which new revisions should be fetched.
package golang.org/x/crypto/scrypt: exit status 1
It gives those errors because github.com/go-xorm/dbweb has dependencies on those other two packages which it cannot update because you have them locally but they have no remote so go get does not know from where to pull the code.
Try removing them:
$ rm -rf $GOPATH\src\github.com\lunny\nodb
$ rm -rf $GOPATH\src\golang.org\x\crypto
Then try to go get your package again:
$ go get -u github.com/go-xorm/dbweb
Or go get them separately and then go get dbweb:
$ go get -u golang.org\x\crypto
$ go get -u github.com\lunny\nodb
$ go get -u github.com/go-xorm/dbweb