I am trying to trigger jenkins build with GitHub Action using following workflow file
name: Trigger Jenkins Build [ Backend ]
on:
pull_request:
branches: [ master ]
types: [ closed ]
env:
JENKINS_HOST: "http://jenkins.example.net:8080/"
JENKINS_JOB: "job/Backend/"
JENKINS_SECURITY_GROUP_ID: "sg-#####"
jobs:
trigger:
name: Triggering Jenkins Build
runs-on: ubuntu-latest
steps:
- name: Add public IP to AWS security group
uses: sohelamin/aws-security-group-add-ip-action#master
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: 'us-west-2'
aws-security-group-id: ${{ env.JENKINS_SECURITY_GROUP_ID }}
port: '8080'
to-port: ''
protocol: 'tcp'
description: 'GitHub Action'
- name: Triggering Jenkins Build [ Backend ]
if: github.event.pull_request.merged == true
uses: GoldenspearLLC/build-jenkins-job#master
with:
jenkins-url: ${{ env.JENKINS_HOST }}
user: ${{ secrets.JENKINS_USER }}
jenkins-token: ${{ secrets.JENKINS_USER_TOKEN }}
job-path: ${{ env.JENKINS_JOB }}
job-params: "{'FRESH_BUILD':'True', 'BUILD_BRANCH':'master', 'DEPLOY_DEV':'True', 'DEPLOY_QA':'False, 'DEPLOY_STAGING':'False, 'DEPLOY_PRODUCTION':'False'}"
But Github Action fails for Triggering Jenkins Build [ Backend ] with following error
Run GoldenspearLLC/build-jenkins-job#master
with:
jenkins-url: http://jenkins.example.net:8080/
user: ***
jenkins-token: ***
job-path: job/Backend/
job-params: {'FRESH_BUILD':'True', 'BUILD_BRANCH':'master', 'DEPLOY_DEV':'True', 'DEPLOY_QA':'False, 'DEPLOY_STAGING':'False, 'DEPLOY_PRODUCTION':'False'}
env:
JENKINS_HOST: http://jenkins.example.net:8080/
JENKINS_JOB: job/Backend/
JENKINS_SECURITY_GROUP_ID: sg-####
/usr/bin/docker run --name a33c1e344d347fc1c49778e11b0ded4abedc6_771244 --label 8a33c1 --workdir /***/workspace --rm -e JENKINS_HOST -e JENKINS_JOB -e JENKINS_SECURITY_GROUP_ID -e INPUT_JENKINS-URL -e INPUT_USER -e INPUT_JENKINS-TOKEN -e INPUT_JOB-PATH -e INPUT_JOB-PARAMS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_***_home":"/***/home" -v "/home/runner/work/_temp/_***_workflow":"/***/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/***/file_commands" -v "/home/runner/work/Backend/Backend":"/***/workspace" 8a33c1:e344d347fc1c49778e11b0ded4abedc6 "http://jenkins.example.net:8080/" "***" "***" "job/Backend/" "{'FRESH_BUILD':'True', 'BUILD_BRANCH':'master', 'DEPLOY_DEV':'True', 'DEPLOY_QA':'False, 'DEPLOY_STAGING':'False, 'DEPLOY_PRODUCTION':'False'}"
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 159, in _new_conn
conn = connection.create_connection(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/lib/python3.8/socket.py", line 918, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 670, in urlopen
httplib_response = self._make_request(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 392, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.8/http/client.py", line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.8/http/client.py", line 1007, in _send_output
self.send(msg)
File "/usr/local/lib/python3.8/http/client.py", line 947, in send
self.connect()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 187, in connect
conn = self._new_conn()
File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 171, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f773f7fc5b0>: Failed to establish a new connection: [Errno -2] Name or service not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 726, in urlopen
retries = retries.increment(
File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 446, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='http', port=80): Max retries exceeded with url: /jenkins.example.net:8080/crumbIssuer/api/json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f773f7fc5b0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/entrypoint.py", line 29, in <module>
user = server.get_whoami()
File "/usr/local/lib/python3.8/site-packages/jenkins/__init__.py", line 793, in get_whoami
response = self.jenkins_open(requests.Request(
File "/usr/local/lib/python3.8/site-packages/jenkins/__init__.py", line 557, in jenkins_open
return self.jenkins_request(req, add_crumb, resolve_auth).text
File "/usr/local/lib/python3.8/site-packages/jenkins/__init__.py", line 573, in jenkins_request
self.maybe_add_crumb(req)
File "/usr/local/lib/python3.8/site-packages/jenkins/__init__.py", line 370, in maybe_add_crumb
response = self.jenkins_open(requests.Request(
File "/usr/local/lib/python3.8/site-packages/jenkins/__init__.py", line 557, in jenkins_open
return self.jenkins_request(req, add_crumb, resolve_auth).text
File "/usr/local/lib/python3.8/site-packages/jenkins/__init__.py", line 576, in jenkins_request
self._request(req))
File "/usr/local/lib/python3.8/site-packages/jenkins/__init__.py", line 550, in _request
return self._session.send(r, **_settings)
File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 643, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='http', port=80): Max retries exceeded with url: /jenkins.example.net:8080/crumbIssuer/api/json (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f773f7fc5b0>: Failed to establish a new connection: [Errno -2] Name or service not known'))
During the build running I can see step sohelamin/aws-security-group-add-ip-action#master adds IP to security group and removes at the end.
Why it tries to connect on port=80 instead of port=8080
What I am missing here ?
The error shows that you are wrong in Jenkin domain: http://jenkins.example.net:8080/
Replace it with your correct domain
Error message: "socket.gaierror: [Errno -2] Name or service not known" mean your program cannot make a connection to this domain because it does not exist or DNS can not resolve
checking action source reveals that it constructs URL merely by glueing 'http://' to it [1]
try remove 'http://' of your action parameters, e.g. run with
JENKINS_HOST: jenkins.example.net:8080/
instead of
JENKINS_HOST: http://jenkins.example.net:8080/
[1] - https://github.com/GoldenspearLLC/build-jenkins-job/blob/master/entrypoint.py#L28
UPDATE: error stack is easily reproduced, so I guess, url format is the real cause.
import requests
sess = requests.Session()
r = sess.prepare_request(requests.Request('GET', 'https://https://www.google.com/'))
sess.send(r)
gives :
Traceback (most recent call last):
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/urllib3/connection.py", line 169, in _new_conn
conn = connection.create_connection(
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/urllib3/util/connection.py", line 73, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/local/Cellar/python#3.9/3.9.2_4/Frameworks/Python.framework/Versions/3.9/lib/python3.9/socket.py", line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 699, in urlopen
httplib_response = self._make_request(
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 382, in _make_request
self._validate_conn(conn)
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1010, in _validate_conn
conn.connect()
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/urllib3/connection.py", line 353, in connect
conn = self._new_conn()
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/urllib3/connection.py", line 181, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x10e1ce340>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/requests/adapters.py", line 439, in send
resp = conn.urlopen(
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/urllib3/connectionpool.py", line 755, in urlopen
retries = retries.increment(
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/urllib3/util/retry.py", line 574, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='http', port=443): Max retries exceeded with url: //www.google.com/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x10e1ce340>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/requests/sessions.py", line 655, in send
r = adapter.send(request, **kwargs)
File "/Users/m.shonichev/src/venv/lib/python3.9/site-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='http', port=443): Max retries exceeded with url: //www.google.com/ (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x10e1ce340>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))
Related
I'm learning the Symfony framework. I started the example given in the documentation with the book. However, I have a problem with the command
symfony new --version=5.0-6 --book guestbook
Checking book requirements are good but the step stopping docker containers didn't work.
I got :
[WEB] Stopping Docker Containers: [ KO ]
[14654] Failed to execute script docker-compose
Traceback (most recent call last):
File "urllib3/connectionpool.py", line 677, in urlopen
File "urllib3/connectionpool.py", line 392, in _make_request
File "http/client.py", line 1252, in request
File "http/client.py", line 1298, in _send_request
File "http/client.py", line 1247, in endheaders
File "http/client.py", line 1026, in _send_output
File "http/client.py", line 966, in send
File "docker/transport/unixconn.py", line 43, in connect
PermissionError: [Errno 13] Permission denied
And general exit code status 255
I think these are bad rights for the script and docker composes, could you enlighten me
Thank you very much
Ps : I'm on Ubuntu 20.04
Finally,
It was permission issue
On Linux command line :
sudo groupadd docker
sudo usermod -aG docker $USER
I have a REST endpoint that is deployed in a docker container using
Dockerfile snippet
ENTRYPOINT service nginx start | tensorflow_model_server --rest_api_port=8501 \
--model_name= <modelname> \
--model_base_path=/<Saved model path>
The REST endpoint is for a Tensorflow model.
I am using NGINX to accept the requests and route them to the REST endpoint
nginx.conf snippet
listen 8080 deferred;
client_max_body_size 500M;
location /invocations {
proxy_pass http://localhost:8501/v1/models/<modelname>:predict;
}
location /ping {
return 200 "OK";
}
Docker desktop version: 2.1.0.5
OS: macOS High Sierra 10.13.4
Invoking this service worked fine all this while but now throws the below Broken Pipe error starting yesterday. Can someone please help?
Using TensorFlow backend.
Traceback (most recent call last):
File "/Users/ls_spiderman/.pyenv/versions/3.6.8/lib/python3.6/site-packages/urllib3/connectionpool.py", line 672, in urlopen
chunked=chunked,
File "/Users/ls_spiderman/.pyenv/versions/3.6.8/lib/python3.6/site-packages/urllib3/connectionpool.py", line 387, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/Users/ls_spiderman/.pyenv/versions/3.6.8/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Users/ls_spiderman/.pyenv/versions/3.6.8/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Users/ls_spiderman/.pyenv/versions/3.6.8/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Users/ls_spiderman/.pyenv/versions/3.6.8/lib/python3.6/http/client.py", line 1065, in _send_output
self.send(chunk)
File "/Users/ls_spiderman/.pyenv/versions/3.6.8/lib/python3.6/http/client.py", line 986, in send
self.sock.sendall(data)
BrokenPipeError: [Errno 32] Broken pipe
Description of the situation : I have a Ubuntu VM running on remote computer B. I can access this computer B via SSH executed on my host (computer A).
When I enter an interactive shell via SSH on computer B, I can execute all my docker commands without any trouble, the steps are the following :
ssh user#remote_IP (enters interactively in the remote shell)
docker-compose run -d --name wfirst --user 1000:1000 container (compose a docker container and starts it)
This works perfectly, my container is mounted, up and running.
However, if I try to run that command in a non-interactive way by writing in my host terminal :
ssh user#remoteIP "cd /path_to_docker_file;docker-compose run -d --name wfirst --user 1000:1000 container"
The command does not succeed, my container is not mounted and does not run. I was able to get more information by using the "--verbose" flag on the docker-compose command.
Here the interesting part of the output of the successful method :
compose.config.config.find: Using configuration files: ./docker-compose.yml
WARNING: compose.config.environment.__getitem__: The DISPLAY variable is not set. Defaulting to a blank string.
WARNING: compose.config.environment.__getitem__: The NO_PROXY variable is not set. Defaulting to a blank string.
docker.utils.config.find_config_file: Trying paths: ['/home/user/.docker/config.json', '/home/user/.dockercfg']
docker.utils.config.find_config_file: No config file found
docker.utils.config.find_config_file: Trying paths: ['/home/user/.docker/config.json', '/home/user/.dockercfg']
docker.utils.config.find_config_file: No config file found
urllib3.connectionpool._new_conn: Starting new HTTP connection (1): localhost:2375
urllib3.connectionpool._make_request: http://localhost:2375 "GET /v1.25/version HTTP/1.1" 200 758
compose.cli.command.get_client: docker-compose version 1.21.0, build unknown
docker-py version: 3.4.1
CPython version: 3.7.5
OpenSSL version: OpenSSL 1.1.1c 28 May 2019
compose.cli.command.get_client: Docker base_url: http://localhost:2375
...
We can see that a HTTP connection to docker is successfully established. The command then continues its execution and is able to create the container from the docker image.
Here the output of the failing method :
compose.config.config.find: Using configuration files: ./docker-compose.yml
compose.config.environment.__getitem__: The DISPLAY variable is not set. Defaulting to a blank string.
compose.config.environment.__getitem__: The NO_PROXY variable is not set. Defaulting to a blank string.
docker.utils.config.find_config_file: Trying paths: ['/home/user/.docker/config.json', '/home/user/.dockercfg']
docker.utils.config.find_config_file: No config file found
docker.utils.config.find_config_file: Trying paths: ['/home/user/.docker/config.json', '/home/user/.dockercfg']
docker.utils.config.find_config_file: No config file found
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 384, in _make_request
six.raise_from(e, None)
File "<string>", line 3, in raise_from
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 380, in _make_request
httplib_response = conn.getresponse()
File "/usr/lib/python3.7/http/client.py", line 1344, in getresponse
response.begin()
File "/usr/lib/python3.7/http/client.py", line 306, in begin
version, status, reason = self._read_status()
File "/usr/lib/python3.7/http/client.py", line 267, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 449, in send
timeout=timeout
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/urllib3/util/retry.py", line 367, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
raise value
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 386, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 306, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/bin/docker-compose", line 11, in <module>
load_entry_point('docker-compose==1.21.0', 'console_scripts', 'docker-compose')()
File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 71, in main
command()
File "/usr/lib/python3/dist-packages/compose/cli/main.py", line 124, in perform_command
project = project_from_options('.', options)
File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 41, in project_from_options
compatibility=options.get('--compatibility'),
File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 121, in get_project
host=host, environment=environment
File "/usr/lib/python3/dist-packages/compose/cli/command.py", line 95, in get_client
version_info = six.iteritems(client.version())
File "/usr/lib/python3/dist-packages/docker/api/daemon.py", line 181, in version
return self._result(self._get(url), json=True)
File "/usr/lib/python3/dist-packages/docker/utils/decorators.py", line 46, in inner
return f(self, *args, **kwargs)
File "/usr/lib/python3/dist-packages/docker/api/client.py", line 198, in _get
return self.get(url, **self._set_request_timeout(kwargs))
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 546, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 529, in send
raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out. (read timeout=60)
We can see that the HTTP connection cannot be established.
Why do I need to send my commands in a non-interactive way ? Originally, I want to send those commands using Jenkins (I added a SSH plugin in Jenkins), and I noticed that the docker commands were not working (same output as shown in this post). After a couple of tests, I realised that when Jenkins uses SSH, he sends the commands in a non-interactive way :
- ssh user#remote_IP "commands_to_execute"
This non-interactive way is not an issue for simple commands, but it appears to be an issue for some docker commands which require to be executed in an interactive shell I guess ?
Has someone found a work-around to successfully execute docker commands in a non-interactive shell ? Any help, hint, or alternative solutions will be greatly appreciated, as I tried a lot of things without any success so far..
Did you check if it is docker-engine running on tcp or by unix socket?
Maybe isn't reading right environment vars when you login by ssh u # h "command".
If it's running on unix socket (by default) try...
ssh user # remoteIP "cd /path_to_docker_file;DOCKER_HOST=unix:///var/run/docker.sock docker-compose run -d --name wfirst --user 1000: 1000 container"
or if is running on TCP, you can try ...
ssh user # remoteIP "cd /path_to_docker_file;DOCKER_HOST=tcp://127.0.0.1:2375 docker-compose run -d --name wfirst --user 1000: 1000 container"
I am trying to push docker image to a remote docker registry via Jenkins and ansible playbook.
my ansible is:
---
- hosts: localhost
remote_user: root
vars:
git_branch: "{{ GIT_BRANCH|default('development') }}"
tasks:
- name: Log into Docker registry
docker_login:
registry_url: https://registry.....si
username: user
password: ....
- name: Remove images
docker_image:
state: absent
name: registry.....si/project/restAPI-{{ git_branch }}
- name: Create Rest API django image
docker_image:
path: .
name: registry.....si/project/restAPI-{{ git_branch }}
push: yes
the first 2 tasks execute normally, but the last one give me an error :
TASK [Create Rest API django image] ********************************************
task path: /var/jenkins_home/workspace/BSH-Rest-API/restAPI/build_docker.yml:18
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/core/cloud/docker/docker_image.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: jenkins
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo ~/.ansible/tmp/ansible-tmp-1543405086.47-86277873769632 `" && echo ansible-tmp-1543405086.47-86277873769632="` echo ~/.ansible/tmp/ansible-tmp-1543405086.47-86277873769632 `" ) && sleep 0'
<127.0.0.1> PUT /tmp/tmpuIkFE1 TO /var/jenkins_home/.ansible/tmp/ansible-tmp-1543405086.47-86277873769632/docker_image.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /var/jenkins_home/.ansible/tmp/ansible-tmp-1543405086.47-86277873769632/ /var/jenkins_home/.ansible/tmp/ansible-tmp-1543405086.47-86277873769632/docker_image.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /var/jenkins_home/.ansible/tmp/ansible-tmp-1543405086.47-86277873769632/docker_image.py; rm -rf "/var/jenkins_home/.ansible/tmp/ansible-tmp-1543405086.47-86277873769632/" > /dev/null 2>&1 && sleep 0'
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_OWiZI2/ansible_module_docker_image.py", line 593, in <module>
main()
File "/tmp/ansible_OWiZI2/ansible_module_docker_image.py", line 585, in main
ImageManager(client, results)
File "/tmp/ansible_OWiZI2/ansible_module_docker_image.py", line 291, in __init__
self.present()
File "/tmp/ansible_OWiZI2/ansible_module_docker_image.py", line 319, in present
self.results['image'] = self.build_image()
File "/tmp/ansible_OWiZI2/ansible_module_docker_image.py", line 514, in build_image
for line in self.client.build(**params):
File "/usr/local/lib/python2.7/dist-packages/docker/api/build.py", line 105, in build
timeout=timeout,
File "/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py", line 47, in inner
return f(self, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/docker/client.py", line 135, in _post
return self.post(url, **self._set_request_timeout(kwargs))
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 581, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 498, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))
fatal: [localhost]: FAILED! => {
"changed": false,
"failed": true,
"invocation": {
"module_name": "docker_image"
},
"module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_OWiZI2/ansible_module_docker_image.py\", line 593, in <module>\n main()\n File \"/tmp/ansible_OWiZI2/ansible_module_docker_image.py\", line 585, in main\n ImageManager(client, results)\n File \"/tmp/ansible_OWiZI2/ansible_module_docker_image.py\", line 291, in __init__\n self.present()\n File \"/tmp/ansible_OWiZI2/ansible_module_docker_image.py\", line 319, in present\n self.results['image'] = self.build_image()\n File \"/tmp/ansible_OWiZI2/ansible_module_docker_image.py\", line 514, in build_image\n for line in self.client.build(**params):\n File \"/usr/local/lib/python2.7/dist-packages/docker/api/build.py\", line 105, in build\n timeout=timeout,\n File \"/usr/local/lib/python2.7/dist-packages/docker/utils/decorators.py\", line 47, in inner\n return f(self, *args, **kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/docker/client.py\", line 135, in _post\n return self.post(url, **self._set_request_timeout(kwargs))\n File \"/usr/local/lib/python2.7/dist-packages/requests/sessions.py\", line 581, in post\n return self.request('POST', url, data=data, json=json, **kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/requests/sessions.py\", line 533, in request\n resp = self.send(prep, **send_kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/requests/sessions.py\", line 646, in send\n r = adapter.send(request, **kwargs)\n File \"/usr/local/lib/python2.7/dist-packages/requests/adapters.py\", line 498, in send\n raise ConnectionError(err, request=request)\nrequests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer'))\n",
"module_stdout": "",
"msg": "MODULE FAILURE"
}
What I am doing wrong?
I almost graduate from this one, but is someone has same problem, I found the problem.
the reason is that inside name parameter there are some upper case letters.
I change
name: registry.....si/project/restAPI-{{ git_branch }}
to
name: registry.....si/project/restapi-{{ git_branch }}
and now it works.
I want to create database from command line with docker. I try these lines
$ docker run -d -e POSTGRES_USER=odoo -e POSTGRES_PASSWORD=odoo --name db postgres:9.5
$ docker run -p 8069:8069 --name odoo --link db:db -t odoo -- -d test
But I got these errors
2017-05-17 05:58:37,441 1 INFO ? odoo: Odoo version 10.0-20170207
2017-05-17 05:58:37,442 1 INFO ? odoo: Using configuration file at /etc/odoo/odoo.conf
2017-05-17 05:58:37,442 1 INFO ? odoo: addons paths: ['/var/lib/odoo/addons/10.0', u'/mnt/extra-addons', u'/usr/lib/python2.7/dist-packages/odoo/addons']
2017-05-17 05:58:37,442 1 INFO ? odoo: database: odoo#172.17.0.2:5432
2017-05-17 05:58:37,443 1 INFO ? odoo.sql_db: Connection to the database failed
Traceback (most recent call last):
File "/usr/bin/odoo", line 9, in <module>
odoo.cli.main()
File "/usr/lib/python2.7/dist-packages/odoo/cli/command.py", line 64, in main
o.run(args)
File "/usr/lib/python2.7/dist-packages/odoo/cli/server.py", line 164, in run
main(args)
File "/usr/lib/python2.7/dist-packages/odoo/cli/server.py", line 138, in main
odoo.service.db._create_empty_database(db_name)
File "/usr/lib/python2.7/dist-packages/odoo/service/db.py", line 79, in _create_empty_database
with closing(db.cursor()) as cr:
File "/usr/lib/python2.7/dist-packages/odoo/sql_db.py", line 622, in cursor
return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized)
File "/usr/lib/python2.7/dist-packages/odoo/sql_db.py", line 164, in __init__
self._cnx = pool.borrow(dsn)
File "/usr/lib/python2.7/dist-packages/odoo/sql_db.py", line 505, in _locked
return fun(self, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/odoo/sql_db.py", line 573, in borrow
**connection_info)
File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 164, in connect
conn = _connect(dsn, connection_factory=connection_factory, async=async)
psycopg2.OperationalError: could not connect to server: Connection refused
Is the server running on host "172.17.0.2" and accepting
TCP/IP connections on port 5432?
What is the problem, are there other solution to do this?