Angular CLI & Jenkins continous integration permissions
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
1
down vote
favorite
I'm using jenkins for a continuous integration with angular cli, here are my steps :
- Push to github
- Jenkins pull the code from my github repository, do
npm install
andng build
Everything is fine until here.
My problem is when I try to copy all the files build in /var/lib/jenkins/workspace/mywebsite/dist
to /var/www/html/mywebsite
This directory is managed by Nginx.
I've got this error : cp: cannot create regular file '/var/www/html/mywebsite/./inline.bundle.js': Permission denied
Can someone help me ?
Thanks
permissions jenkins
 |Â
show 3 more comments
up vote
1
down vote
favorite
I'm using jenkins for a continuous integration with angular cli, here are my steps :
- Push to github
- Jenkins pull the code from my github repository, do
npm install
andng build
Everything is fine until here.
My problem is when I try to copy all the files build in /var/lib/jenkins/workspace/mywebsite/dist
to /var/www/html/mywebsite
This directory is managed by Nginx.
I've got this error : cp: cannot create regular file '/var/www/html/mywebsite/./inline.bundle.js': Permission denied
Can someone help me ?
Thanks
permissions jenkins
Did you usesudo
when you copied data over? Or, have you considered just symlinking the directory rather than copying data?
â Thomas Wardâ¦
Mar 7 at 15:57
This also isn't an NGINX question but a system permissions question. It only tangentially has to do with nginx in its current state.
â Thomas Wardâ¦
Mar 7 at 16:07
I think it's not permitted to dosudo
in jenkinsExecute Shell
section. I'll try with the symlink. Thanks
â andy200486
Mar 7 at 16:37
When I try sudo, I have this error :sudo: no tty present and no askpass program specified
â andy200486
Mar 7 at 16:38
I had assumed you have access to the system directly or via SSH, rather than using Jenkins' shell as a go-between. You can't create the symlink either without superuser privileges, so you may be out of luck with what you're trying to do, unless you have direct system access over SSH or such to make system-level revisions
â Thomas Wardâ¦
Mar 7 at 16:39
 |Â
show 3 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I'm using jenkins for a continuous integration with angular cli, here are my steps :
- Push to github
- Jenkins pull the code from my github repository, do
npm install
andng build
Everything is fine until here.
My problem is when I try to copy all the files build in /var/lib/jenkins/workspace/mywebsite/dist
to /var/www/html/mywebsite
This directory is managed by Nginx.
I've got this error : cp: cannot create regular file '/var/www/html/mywebsite/./inline.bundle.js': Permission denied
Can someone help me ?
Thanks
permissions jenkins
I'm using jenkins for a continuous integration with angular cli, here are my steps :
- Push to github
- Jenkins pull the code from my github repository, do
npm install
andng build
Everything is fine until here.
My problem is when I try to copy all the files build in /var/lib/jenkins/workspace/mywebsite/dist
to /var/www/html/mywebsite
This directory is managed by Nginx.
I've got this error : cp: cannot create regular file '/var/www/html/mywebsite/./inline.bundle.js': Permission denied
Can someone help me ?
Thanks
permissions jenkins
permissions jenkins
edited Mar 7 at 16:07
![](https://i.stack.imgur.com/jLgkr.jpg?s=32&g=1)
![](https://i.stack.imgur.com/jLgkr.jpg?s=32&g=1)
Thomas Wardâ¦
41.5k23112166
41.5k23112166
asked Mar 7 at 15:50
andy200486
82
82
Did you usesudo
when you copied data over? Or, have you considered just symlinking the directory rather than copying data?
â Thomas Wardâ¦
Mar 7 at 15:57
This also isn't an NGINX question but a system permissions question. It only tangentially has to do with nginx in its current state.
â Thomas Wardâ¦
Mar 7 at 16:07
I think it's not permitted to dosudo
in jenkinsExecute Shell
section. I'll try with the symlink. Thanks
â andy200486
Mar 7 at 16:37
When I try sudo, I have this error :sudo: no tty present and no askpass program specified
â andy200486
Mar 7 at 16:38
I had assumed you have access to the system directly or via SSH, rather than using Jenkins' shell as a go-between. You can't create the symlink either without superuser privileges, so you may be out of luck with what you're trying to do, unless you have direct system access over SSH or such to make system-level revisions
â Thomas Wardâ¦
Mar 7 at 16:39
 |Â
show 3 more comments
Did you usesudo
when you copied data over? Or, have you considered just symlinking the directory rather than copying data?
â Thomas Wardâ¦
Mar 7 at 15:57
This also isn't an NGINX question but a system permissions question. It only tangentially has to do with nginx in its current state.
â Thomas Wardâ¦
Mar 7 at 16:07
I think it's not permitted to dosudo
in jenkinsExecute Shell
section. I'll try with the symlink. Thanks
â andy200486
Mar 7 at 16:37
When I try sudo, I have this error :sudo: no tty present and no askpass program specified
â andy200486
Mar 7 at 16:38
I had assumed you have access to the system directly or via SSH, rather than using Jenkins' shell as a go-between. You can't create the symlink either without superuser privileges, so you may be out of luck with what you're trying to do, unless you have direct system access over SSH or such to make system-level revisions
â Thomas Wardâ¦
Mar 7 at 16:39
Did you use
sudo
when you copied data over? Or, have you considered just symlinking the directory rather than copying data?â Thomas Wardâ¦
Mar 7 at 15:57
Did you use
sudo
when you copied data over? Or, have you considered just symlinking the directory rather than copying data?â Thomas Wardâ¦
Mar 7 at 15:57
This also isn't an NGINX question but a system permissions question. It only tangentially has to do with nginx in its current state.
â Thomas Wardâ¦
Mar 7 at 16:07
This also isn't an NGINX question but a system permissions question. It only tangentially has to do with nginx in its current state.
â Thomas Wardâ¦
Mar 7 at 16:07
I think it's not permitted to do
sudo
in jenkins Execute Shell
section. I'll try with the symlink. Thanksâ andy200486
Mar 7 at 16:37
I think it's not permitted to do
sudo
in jenkins Execute Shell
section. I'll try with the symlink. Thanksâ andy200486
Mar 7 at 16:37
When I try sudo, I have this error :
sudo: no tty present and no askpass program specified
â andy200486
Mar 7 at 16:38
When I try sudo, I have this error :
sudo: no tty present and no askpass program specified
â andy200486
Mar 7 at 16:38
I had assumed you have access to the system directly or via SSH, rather than using Jenkins' shell as a go-between. You can't create the symlink either without superuser privileges, so you may be out of luck with what you're trying to do, unless you have direct system access over SSH or such to make system-level revisions
â Thomas Wardâ¦
Mar 7 at 16:39
I had assumed you have access to the system directly or via SSH, rather than using Jenkins' shell as a go-between. You can't create the symlink either without superuser privileges, so you may be out of luck with what you're trying to do, unless you have direct system access over SSH or such to make system-level revisions
â Thomas Wardâ¦
Mar 7 at 16:39
 |Â
show 3 more comments
1 Answer
1
active
oldest
votes
up vote
0
down vote
accepted
Unfortunately, you can't just easily copy the data over. Rather, why not let NGINX go fetch the data via a symlink?
Create a symlink of the build destination directory in /var/www
instead:
sudo mv /var/www/html /var/www/html.old
sudo ln -s /var/lib/jenkins/workspace/mywebsite/dist /var/www/html
This should, assuming that NGINX can also read the data in the /var/lib/jenkins/workspace/mywebsite/dist
folder, bypass the need to let Jenkins directly copy things into a folder outside its control.
Note that I strongly suggest you use /var/www/domain.tld
, replacing domain.tld
with your actual site, and then use that for the document root in the nginx
site configuration instead of /var/www/html
. There is an NGINX Configuration Pitfalls entry about the potential issues of using the default document root which is relevant here. It specifically states:
Using the Default Document Root
NGINX packages that exist in Ubuntu, Debian, or other operating
systems, as an easy-to-install package will often provide a âÂÂdefaultâÂÂ
configuration file as an example of configuration methods, and will
often include a document root to hold a basic HTML file.
Most of these packaging systems do not check to see if files are
modified or exist within the default document root, which can result
in code loss when the packages are upgraded. Experienced system
administrators know that there is no expectation of the data inside
the default document root to remain untouched during upgrades.
You should not use the default document root for any site-critical
files. There is no expectation that the default document root will be
left untouched by the system and there is an extremely high
possibility that your site-critical data may be lost upon updates and
upgrades to the NGINX packages for your operating system.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
accepted
Unfortunately, you can't just easily copy the data over. Rather, why not let NGINX go fetch the data via a symlink?
Create a symlink of the build destination directory in /var/www
instead:
sudo mv /var/www/html /var/www/html.old
sudo ln -s /var/lib/jenkins/workspace/mywebsite/dist /var/www/html
This should, assuming that NGINX can also read the data in the /var/lib/jenkins/workspace/mywebsite/dist
folder, bypass the need to let Jenkins directly copy things into a folder outside its control.
Note that I strongly suggest you use /var/www/domain.tld
, replacing domain.tld
with your actual site, and then use that for the document root in the nginx
site configuration instead of /var/www/html
. There is an NGINX Configuration Pitfalls entry about the potential issues of using the default document root which is relevant here. It specifically states:
Using the Default Document Root
NGINX packages that exist in Ubuntu, Debian, or other operating
systems, as an easy-to-install package will often provide a âÂÂdefaultâÂÂ
configuration file as an example of configuration methods, and will
often include a document root to hold a basic HTML file.
Most of these packaging systems do not check to see if files are
modified or exist within the default document root, which can result
in code loss when the packages are upgraded. Experienced system
administrators know that there is no expectation of the data inside
the default document root to remain untouched during upgrades.
You should not use the default document root for any site-critical
files. There is no expectation that the default document root will be
left untouched by the system and there is an extremely high
possibility that your site-critical data may be lost upon updates and
upgrades to the NGINX packages for your operating system.
add a comment |Â
up vote
0
down vote
accepted
Unfortunately, you can't just easily copy the data over. Rather, why not let NGINX go fetch the data via a symlink?
Create a symlink of the build destination directory in /var/www
instead:
sudo mv /var/www/html /var/www/html.old
sudo ln -s /var/lib/jenkins/workspace/mywebsite/dist /var/www/html
This should, assuming that NGINX can also read the data in the /var/lib/jenkins/workspace/mywebsite/dist
folder, bypass the need to let Jenkins directly copy things into a folder outside its control.
Note that I strongly suggest you use /var/www/domain.tld
, replacing domain.tld
with your actual site, and then use that for the document root in the nginx
site configuration instead of /var/www/html
. There is an NGINX Configuration Pitfalls entry about the potential issues of using the default document root which is relevant here. It specifically states:
Using the Default Document Root
NGINX packages that exist in Ubuntu, Debian, or other operating
systems, as an easy-to-install package will often provide a âÂÂdefaultâÂÂ
configuration file as an example of configuration methods, and will
often include a document root to hold a basic HTML file.
Most of these packaging systems do not check to see if files are
modified or exist within the default document root, which can result
in code loss when the packages are upgraded. Experienced system
administrators know that there is no expectation of the data inside
the default document root to remain untouched during upgrades.
You should not use the default document root for any site-critical
files. There is no expectation that the default document root will be
left untouched by the system and there is an extremely high
possibility that your site-critical data may be lost upon updates and
upgrades to the NGINX packages for your operating system.
add a comment |Â
up vote
0
down vote
accepted
up vote
0
down vote
accepted
Unfortunately, you can't just easily copy the data over. Rather, why not let NGINX go fetch the data via a symlink?
Create a symlink of the build destination directory in /var/www
instead:
sudo mv /var/www/html /var/www/html.old
sudo ln -s /var/lib/jenkins/workspace/mywebsite/dist /var/www/html
This should, assuming that NGINX can also read the data in the /var/lib/jenkins/workspace/mywebsite/dist
folder, bypass the need to let Jenkins directly copy things into a folder outside its control.
Note that I strongly suggest you use /var/www/domain.tld
, replacing domain.tld
with your actual site, and then use that for the document root in the nginx
site configuration instead of /var/www/html
. There is an NGINX Configuration Pitfalls entry about the potential issues of using the default document root which is relevant here. It specifically states:
Using the Default Document Root
NGINX packages that exist in Ubuntu, Debian, or other operating
systems, as an easy-to-install package will often provide a âÂÂdefaultâÂÂ
configuration file as an example of configuration methods, and will
often include a document root to hold a basic HTML file.
Most of these packaging systems do not check to see if files are
modified or exist within the default document root, which can result
in code loss when the packages are upgraded. Experienced system
administrators know that there is no expectation of the data inside
the default document root to remain untouched during upgrades.
You should not use the default document root for any site-critical
files. There is no expectation that the default document root will be
left untouched by the system and there is an extremely high
possibility that your site-critical data may be lost upon updates and
upgrades to the NGINX packages for your operating system.
Unfortunately, you can't just easily copy the data over. Rather, why not let NGINX go fetch the data via a symlink?
Create a symlink of the build destination directory in /var/www
instead:
sudo mv /var/www/html /var/www/html.old
sudo ln -s /var/lib/jenkins/workspace/mywebsite/dist /var/www/html
This should, assuming that NGINX can also read the data in the /var/lib/jenkins/workspace/mywebsite/dist
folder, bypass the need to let Jenkins directly copy things into a folder outside its control.
Note that I strongly suggest you use /var/www/domain.tld
, replacing domain.tld
with your actual site, and then use that for the document root in the nginx
site configuration instead of /var/www/html
. There is an NGINX Configuration Pitfalls entry about the potential issues of using the default document root which is relevant here. It specifically states:
Using the Default Document Root
NGINX packages that exist in Ubuntu, Debian, or other operating
systems, as an easy-to-install package will often provide a âÂÂdefaultâÂÂ
configuration file as an example of configuration methods, and will
often include a document root to hold a basic HTML file.
Most of these packaging systems do not check to see if files are
modified or exist within the default document root, which can result
in code loss when the packages are upgraded. Experienced system
administrators know that there is no expectation of the data inside
the default document root to remain untouched during upgrades.
You should not use the default document root for any site-critical
files. There is no expectation that the default document root will be
left untouched by the system and there is an extremely high
possibility that your site-critical data may be lost upon updates and
upgrades to the NGINX packages for your operating system.
answered Mar 7 at 21:37
![](https://i.stack.imgur.com/jLgkr.jpg?s=32&g=1)
![](https://i.stack.imgur.com/jLgkr.jpg?s=32&g=1)
Thomas Wardâ¦
41.5k23112166
41.5k23112166
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1012767%2fangular-cli-jenkins-continous-integration-permissions%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Did you use
sudo
when you copied data over? Or, have you considered just symlinking the directory rather than copying data?â Thomas Wardâ¦
Mar 7 at 15:57
This also isn't an NGINX question but a system permissions question. It only tangentially has to do with nginx in its current state.
â Thomas Wardâ¦
Mar 7 at 16:07
I think it's not permitted to do
sudo
in jenkinsExecute Shell
section. I'll try with the symlink. Thanksâ andy200486
Mar 7 at 16:37
When I try sudo, I have this error :
sudo: no tty present and no askpass program specified
â andy200486
Mar 7 at 16:38
I had assumed you have access to the system directly or via SSH, rather than using Jenkins' shell as a go-between. You can't create the symlink either without superuser privileges, so you may be out of luck with what you're trying to do, unless you have direct system access over SSH or such to make system-level revisions
â Thomas Wardâ¦
Mar 7 at 16:39