SOLVED [CPANEL-22800] Wrong path to uapi used in auto-deployment Git hook

Asmit khadka

Registered
Sep 9, 2018
2
2
3
Nepal
cPanel Access Level
Root Administrator
I have created a repo in cpanel and cloned it in my local machine. When I tried to git push after making the changes then the below error comes. But the changes are taking effect in the server.

The user is in cagefs and it work if I disable the cagefs.

Code:
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 285 bytes | 285.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: Recieved update on checked-out branch, queueing deployment.
remote: [2018-09-09 12:24:12 +0200] warn [uapi] Failed to execute /usr/local/cpanel/cpanel: [I]No such file or directory at /usr/local/cpanel/Cpanel/XML.pm line 114.[/I]
remote:    Cpanel::XML::cpanel_exec_fast(HASH(0x8975b0), HASH(0x157a5b8)) called at bin/apitool.pl line 206
remote:    bin::apitool::_run_cpanel_function("yaml", HASH(0x8975b0), HASH(0x1579ef8)) called at bin/apitool.pl line 146
remote:    bin::apitool::_cpanel_api_handler(__CPANEL_HIDDEN__, HASH(0x1579ef8), __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, ARRAY(0x897b20)) called at bin/apitool.pl line 108
remote:    bin::apitool::run("VersionControlDeployment", "create", "repository_root=/home2/user/public_html") called at bin/apitool.pl line 37
remote: Failed to execute /usr/local/cpanel/cpanel: No such file or directory at bin/apitool.pl line 209.
To ssh://user.com/home2/user/public_html
   d5647f9..2ab73d3  master -> master
I have also tried to allow this by using /etc/cagefs/custom.proxy.commands but it is also not working.
 

Mikey12345

Registered
Sep 10, 2018
1
1
1
United Kingdom
cPanel Access Level
Root Administrator
Also having the same issue with a .cpanel.yml deployment setup to cp some files around.

after running 'git push' on my local machine to the cpanel repo i get the following:

Code:
remote: Recieved update on checked-out branch, queueing deployment.
remote: [2018-09-10 20:34:04 +0100] warn [uapi] Failed to execute /usr/local/cpanel/cpanel: No such file or directory at /usr/local/cpanel/Cpanel/XML.pm line 114.
remote:         Cpanel::XML::cpanel_exec_fast(HASH(0x8975b0), HASH(0x14e5a48)) called at bin/apitool.pl line 206
remote:         bin::apitool::_run_cpanel_function("yaml", HASH(0x8975b0), HASH(0x14e53a0)) called at bin/apitool.pl line 146
remote:         bin::apitool::_cpanel_api_handler(__CPANEL_HIDDEN__, HASH(0x14e53a0), __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, ARRAY(0x897b20)) called at bin/apitool.pl line 108
remote:         bin::apitool::run("VersionControlDeployment", "create", "repository_root=/home/supertest/repositories/superrepo"...) called at bin/apitool.pl line 37
remote: Failed to execute /usr/local/cpanel/cpanel: No such file or directory at bin/apitool.pl line 209.
 

Asmit khadka

Registered
Sep 9, 2018
2
2
3
Nepal
cPanel Access Level
Root Administrator
I am following this documentation;

Guide to Git - Host Git Repositories on a cPanel Account - cPanel Knowledge Base - cPanel Documentation

I cloned the repo and after I make the changes and try to push it, I got the error. But the thing is that it gives the error when I make changes for the first time. If I again push it, no error is shown. Additionally, if I make any changes and again try to push it, it gives me error.

Code:
$ git add .
$ git commit -am "Changes comment"
$ git push origin master
As I said before, if I disable cagefs it works fine.
 
Sep 11, 2018
3
0
1
Kathmandu, Nepal
cPanel Access Level
Website Owner
Hello,

I have been trying to automatically deploy the files after pushing my commit but unfortunately my knowledge on .cpanel.yml is not clear.

I have used this code on .cpanel.yml as mentioned in the documentation

---
deployment:
tasks:
- export DEPLOYPATH=/home/monkeyde/public_html/
- /bin/cp index.html $DEPLOYPATH
- /bin/cp style.css $DEPLOYPATH


I get this error while pushing my local changes,

{15:44}[2.2.5]~/workspace/cprepo:master ✓ ➭ git push cpanel
Counting objects: 3, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 303 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Recieved update on checked-out branch, queueing deployment.
remote: [2018-09-11 11:59:14 +0200] warn [uapi] Failed to execute /usr/local/cpanel/cpanel: No such file or directory at /usr/local/cpanel/Cpanel/XML.pm line 114.
remote: Cpanel::XML::cpanel_exec_fast(HASH(0x8975b0), HASH(0x1e90680)) called at bin/apitool.pl line 206
remote: bin::apitool::_run_cpanel_function("yaml", HASH(0x8975b0), HASH(0x1e902f0)) called at bin/apitool.pl line 146
remote: bin::apitool::_cpanel_api_handler(__CPANEL_HIDDEN__, HASH(0x1e902f0), __CPANEL_HIDDEN__, __CPANEL_HIDDEN__, ARRAY(0x897b20)) called at bin/apitool.pl line 108
remote: bin::apitool::run("VersionControlDeployment", "create", "repository_root=/home/monkeyde/cprepo") called at bin/apitool.pl line 37
remote: Failed to execute /usr/local/cpanel/cpanel: No such file or directory at bin/apitool.pl line 209.
To ssh://monkeydenim.com:2222/home/monkeyde/cprepo
e343f9b..5dcad90 master -> master
 
Sep 11, 2018
3
0
1
Kathmandu, Nepal
cPanel Access Level
Website Owner
I am facing the same issue here.
I noticed a case sensitive here in this line as posted by both @Asmit khadka and @Mikey12345
Code:
remote: [2018-09-10 20:34:04 +0100] warn [uapi] Failed to execute /usr/local/cpanel/cpanel: No such file or directory at /usr/local/cpanel/Cpanel/XML.pm line 114.
/usr/local/cpanel/cpanel
/usr/local/cpanel/Cpanel/XML.pm

The second line cpanel has a uppercase Cpanel.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,211
363
Hello,

Internal case CPANEL-22800 is open to address an issue where the post-receive Git hook used for auto-deployment makes use of the wrong path to the UAPI binary. This causes auto-deployments to fail when using CageFS. I'll monitor this case and update this thread with more information as it becomes available. In the meantime, the temporary workaround is to modify the /usr/local/cpanel/3rdparty/share/git-cpanel/deployment/hooks/post-receive file so that it looks like this:

Code:
#!/bin/sh

# post-receive                                       Copyright 2018 cPanel, Inc.
#                                                           All rights reserved.
# [email protected]                                         http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited

branch=$(/usr/local/cpanel/3rdparty/bin/git branch | awk '$1 == "*"{print $2}')
while read oldrev newrev ref
do
  if [ "x$ref" == "xrefs/heads/$branch" ]
  then
    echo "Recieved update on checked-out branch, queueing deployment."
    (cd .. ; /usr/bin/uapi VersionControlDeployment create repository_root=$PWD)
  fi
done < /dev/stdin
Then, run the following command:

Code:
cagefsctl --remount-all
Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,211
363
hey guys, is there any news in issue solving?
Hi @Artemu78,

The solution is published as part of cPanel & WHM version 76, but keep in mind that version isn't yet ready for production servers (it's only released to the EDGE release tier at this time).

We do have a backport request open to get the case published to version 74, but I don't have a specific time frame to offer on it's publication at this time. I'll update this thread as soon as new information is available.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,211
363
When are you planning to fix this issue in version 74?
Hello Robin,

I don't have a specific time frame to offer on the next version 74 publication, but note that cPanel & WHM version 76 is available in the CURRENT release tier at this time. 76 is tentatively planned for publication the the RELEASE tier in early November.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,910
2,211
363
Hello,

To update, it doesn't look like this will make it out to cPanel & WHM version 74, however version 76 is nearing publication to the RELEASE tier (tentatively planned for publication within the next two weeks).

Thank you.
 

Berenger Z

Member
Dec 8, 2017
7
1
3
Montreal
cPanel Access Level
Root Administrator
Hum.

Code:
λ git push alternatif
Total 0 (delta 0), reused 0 (delta 0)
remote: Recieved update on checked-out branch, queueing deployment.
remote: [2019-08-05 12:44:27 -0400] warn [uapi] Failed to execute /usr/local/cpanel/cpanel: No such file or directory at /usr/local/cpanel/Cpanel/XML.pm line 111.
remote:         Cpanel::XML::cpanel_exec_fast(HASH(0x866e88), HASH(0xca3bd8)) called at bin/apitool.pl line 256
remote:         bin::apitool::_run_cpanel_function("yaml", HASH(0x866e88), HASH(0xca3bf0)) called at bin/apitool.pl line 170
remote:         bin::apitool::_cpanel_api_handler(HASH(0xcc36b8)) called at bin/apitool.pl line 123
remote:         bin::apitool::run("VersionControlDeployment", "create", "repository_root=/home/***/repositories/wpkms") called at bin/apitool.pl line 38
remote: Failed to execute /usr/local/cpanel/cpanel: No such file or directory at bin/apitool.pl line 259.
To ssh://***/home/***/repositories/wpkms
   9f34a15..138e806  master -> master
CLOUDLINUX 7.6 hyper-v [alternatif] v80.0.23

This seems to be the exact same error, though my post-receive hook is exactly as the one you sent, cPanelMichael
Any thoughts?
 

MuNLoK

Active Member
Jul 14, 2004
25
0
151
Seville / Madrid - Spain
cPanel Access Level
DataCenter Provider
Hello,

We had this problem today with cPanel & WHM version 86.0.20, CloudLinux + CageFS:

Code:
remote: Recieved update on checked-out branch, queueing deployment.      
remote: [2020-05-15 13:01:28 +0200] warn [uapi] Failed to execute /usr/local/cpanel/cpanel: No such file or directory at /usr/local/cpanel/Cpanel/XML.pm line 110.      
remote:     Cpanel::XML::cpanel_exec_fast(HASH(0x81b5b8), HASH(0x1dc6720)) called at bin/apitool.pl line 257      
remote:     bin::apitool::_run_cpanel_function("yaml", HASH(0x81b5b8), HASH(0x1db4680)) called at bin/apitool.pl line 171      
remote:     bin::apitool::_cpanel_api_handler(HASH(0x1dc69c0)) called at bin/apitool.pl line 124      
remote:     bin::apitool::run("VersionControlDeployment", "create", "repository_root=/home/***/framework") called at bin/apitool.pl line 39      
remote: Failed to execute /usr/local/cpanel/cpanel: No such file or directory at bin/apitool.pl line 260.
Any solution?

Thanks.