kamranonline

Member
Sep 16, 2012
21
0
51
Newtowncenter
cPanel Access Level
Root Administrator
Hi,

I tried to deploy HEAD commit by creating .cpanel.yml file.

I have a problem related to USERNAME.

Code:
---
deployment:
  tasks:
    - export DEPLOYPATH=/home/example/public_html/
    - /bin/cp -R images $DEPLOYPATH
how can I get "example" as a variable like $USERNAME. Do cpanel pass any value to .cpanel.yml file or is it sensitive to pass variable.

Regards,
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,859
600
273
cPanel Access Level
Root Administrator
Hey there! Are you looking to just set an additional variable? The 4th line in the example you provided would show the script setting a variable:

Code:
export DEPLOYPATH=/home/example/public_html/
so you could create a similar line with your $USERNAME variable to do that work.
 

kamranonline

Member
Sep 16, 2012
21
0
51
Newtowncenter
cPanel Access Level
Root Administrator
Hey there! Are you looking to just set an additional variable? The 4th line in the example you provided would show the script setting a variable:

Code:
export DEPLOYPATH=/home/example/public_html/
so you could create a similar line with your $USERNAME variable to do that work.
$USERNAME is not a defined value, I know I cant create value by using export command but I want to defined value which is related to cpanel username or another value that related to cPanel User Home Directory like $USER_HOME.
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
4,859
600
273
cPanel Access Level
Root Administrator
Thanks for the clarification on this. You'd need some additional code outside of git that would manually pull the username you are working with. I'm not sure what the best way would be to do that as it would depend on your application and what you're doing, but the API system has many different username functions, so looking through the WHM and cPanel APIs may be useful.
 
  • Like
Reactions: kamranonline

kamranonline

Member
Sep 16, 2012
21
0
51
Newtowncenter
cPanel Access Level
Root Administrator
Thanks for the clarification on this. You'd need some additional code outside of git that would manually pull the username you are working with. I'm not sure what the best way would be to do that as it would depend on your application and what you're doing, but the API system has many different username functions, so looking through the WHM and cPanel APIs may be useful.
Also cPanel needs a hook feature to call while something committed on a git to call the hook and Cpanel git pull automatically the updates.
Plesk has this feature:
https://docs.plesk.com/en-US/onyx/a...osting.75848/#use-webhooks-for-automatic-pull