skip to Main Content

So I was trying to deploy a simple CD pipeline using docker by ssh’ing into my AWS Linux EC2 instance in the WSL2 terminal. The job is failing every time returning the following error:

Started by user Navdeep Singh Running as SYSTEM Building on the
built-in node in workspace /var/lib/jenkins/workspace/todo-dev
[todo-dev] $ /bin/sh -xe /tmp/jenkins6737039323529850559.sh + cd
/home/ubuntu/project/django-todo /tmp/jenkins6737039323529850559.sh:
2: cd: can’t cd to /home/ubuntu/project/django-todo Build step
‘Execute shell’ marked build as failure Finished: FAILURE

Job Config

DockerFile contents:

FROM python:3 RUN pip install django==3.2

COPY . .

RUN python manage.py migrate

CMD [“python”,“manage.py”,“runserver”,“0.0.0.0:8000”]

3

Answers


  1. Everything goes fine. This error cd: can’t cd to /home/ubuntu/project/django-todo Build step ‘Execute shell’ marked build as failure Finished: FAILURE is not an actual.

    Your agent Node is not online.

    To fix the problem, find commands on your jenkins web page after an agent setup. You need to run those commands from your terminal. See the screenshot for more details.

    Make sure that your jenkins public IP and node agent public IP are the same. If an error occurs, you need to run some commands on the terminal. This is not a real error.

    Login or Signup to reply.
  2. this issue follow this step which i give you

    For Agent—>

    change your ip here(44.203.138.174:8080) to your EC2 ip

    1.curl -sO http://44.203.138.174:8080/jnlpJars/agent.jar
    2.java -jar agent.jar -jnlpUrl http://44.203.138.174:8080/manage/computer/todo%2Dagent/jenkins-agent.jnlp -secret beb62de0f81bfd06e4cd81d1b896d85d38f82b87b21ef8baef3389e651c9f72c -workDir "/home/ubuntu"

    For JOb —>

    1. sudo vi /etc/sudoers

    2. then add this command below root access in sudoers file
      jenkins ALL=(ALL) NOPASSWD: ALL

    3.then goto the ubuntu directory using cd .. then run this codes
    grep ^ubuntu /etc/group
    id jenkins
    sudo adduser jenkins ubuntu
    grep ^ubuntu /etc/group

    4.restart the jenkins relogin
    sudo systemctl stop jenkins

    then you good to go

    Login or Signup to reply.
  3. I got the same error and resolve with the following configuration in the Execute shell.

    #!/bin/bash
    sudo docker build -t todo-img4 -f /root/project/django-todo/Dockerfile /root/project/django-todo
    sudo docker run -d -it -p 8001:8001 todo-img4
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search