Hi everyone!
A few days ago, my pipeline (which was working right until then) stopped working. My files are the following:
bitbucket-pipelines.yml
image: atlassian/default-image:2
pipelines:
branches:
develop:
- step:
name: Deploy develop to DigitalOcean.
caches:
- node
deployment: test
script:
- cat deploy-develop.sh | ssh (Droplet URI)
devploy-develop.sh
#!/usr/bin/env bash
cd projectFolder
git pull
docker stop projectContainer
docker rm projectContainer
docker tag
docker build --build-arg enviroment=develop -t project .
docker run -d -p 4200:4200 --restart on-failure --name projectContainer project .
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
As I said, it was working perfect for months, but in the last days, every time I run the pipeline, I get the following console output:
+ cat deploy-develop.sh | ssh (DROPLET URI)
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added the RSA host key for IP address ('IPADDRESS') to the list of known hosts.
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-142-generic x86_64)* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
121 packages can be updated.
0 updates are security updates.
New release '18.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
.
-bash: line 3: cd: projectFolder
: No such file or directory
git: 'pull
' is not a git command. See 'git --help'.
Did you mean this?
pull
Error response from daemon: No such container: projectContainer
(goes on)
Apparently, simple command as "cd" or "git pull" are not working well now.
If I ssh into my droplet and run the script, it works right. The problem appears when the pipelines tries to run it.
Any ideas?
Thank you!
that `cd` command failed not because cd is not present on the image, but because `projectFolder` is not a subdirectory of current working directory.
git should be installed on atlassian/default-image:2 as per https://hub.docker.com/r/atlassian/default-image/
not sure how `docker stop projectContainer` ever worked given that the container is likely not running or present at the start of the step. Unless you have some additional script entries before the listed shell script.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.