rht-labs / labs-ci-cd

👻UNMAINTAINED - A collection of Red Hat Open Innovation Labs CI/CD components
Apache License 2.0
101 stars 70 forks source link

Issue Applying Templates Accessed Over HTTP #251

Closed sherl0cks closed 5 years ago

sherl0cks commented 5 years ago

When I run:

ansible-galaxy install -r requirements.yml --roles-path=roles
ansible-playbook site.yml

I get the following failure:

TASK [openshift-applier/roles/openshift-applier : Create OpenShift objects based on template with params for 'projectrequest : labs-ci-cd-2'] ********************************************************************************************************************************************
failed: [projects-and-policies] (item={'oc_path': ''}) => {"changed": true, "cmd": "oc process   https://raw.githubusercontent.com/redhat-cop/cluster-lifecycle/v3.9.0/files/projectrequest/template.yml   --param='NAMESPACE=labs-ci-cd-2' --param='NAMESPACE_DISPLAY_NAME=labs-ci-cd-2'--param='SECRET_NAME=ci-cd-secret'  --ignore-unknown-parameters | oc create  -f - ", "delta": "0:00:00.216668", "end": "2019-01-29 09:55:58.853071", "failed_when_result": true, "msg": "non-zero return code", "oc_param_file_item": {"oc_path": ""}, "rc": 1, "start": "2019-01-29 09:55:58.636403", "stderr": "error: invalid argument \"https://raw.githubusercontent.com/redhat-cop/cluster-lifecycle/v3.9.0/files/projectrequest/template.yml\"\nerror: no objects passed to create", "stderr_lines": ["error: invalid argument \"https://raw.githubusercontent.com/redhat-cop/cluster-lifecycle/v3.9.0/files/projectrequest/template.yml\"", "error: no objects passed to create"], "stdout": "", "stdout_lines": []}

Root cause appears to be that the oc process command is missing -f. Unclear if that is labs-ci-cd or a bug in the applier.

mcanoy commented 5 years ago

I'm not experience this I ran the above commands with modified project names and did not see this (fails because I wasn't logged in but succeed without messaging after login)

TASK [openshift-applier/roles/openshift-applier : Create OpenShift objects based on template with params for 'projectrequest : k-ci-cd'] ****
failed: [projects-and-policies] (item={'oc_path': u''}) => {"changed": true, "cmd": "oc process  --local  -f https://raw.githubusercontent.com/redhat-cop/cluster-lifecycle/v3.9.0/files/projectrequest/template.yml   --param='NAMESPACE=k-ci-cd' --param='SECRET_NAME=ci-cd-secret' --param='NAMESPACE_DISPLAY_NAME=k-ci-cd'  --ignore-unknown-parameters | oc create  -f - ", "delta": "0:00:02.172337", "end": "2019-01-29 09:04:55.936402", "failed_when_result": true, "msg": "non-zero return code", "oc_param_file_item": {"oc_path": ""}, "rc": 1, "start": "2019-01-29 09:04:53.764065", "stderr": "error: You must be logged in to the server (Unauthorized)", "stderr_lines": ["error: You must be logged in to the server (Unauthorized)"], "stdout": "", "stdout_lines": []}

Using

ansible 2.5.4 
oc v3.10.14
master branch
Mac OSX
sherl0cks commented 5 years ago

Looks like we are hitting https://github.com/redhat-cop/openshift-applier/issues/91, which seems tied to ansible 2.7.5. Downgrading ansible does not solve this.

oybed commented 5 years ago

You can downgrade if required to run "locally", or you can use the openshift-applier container.

sherl0cks commented 5 years ago

For context, https://github.com/redhat-cop/openshift-applier/pull/106 resolved the issue in the applier