ansibleplaybookbundle / apb-base

Base image for APB development
Apache License 2.0
8 stars 14 forks source link

Passing extra-vars via key=value is broken #46

Open ibuziuk opened 6 years ago

ibuziuk commented 6 years ago

Originally the issue [1] was found in eclipse-che where tests are executed via the following command using the canary version of apb-base :

oc run "${APB_NAME}-test" -it --restart='Never' --image "${REGISTRY}/${APB_NAME}/${APB_NAME}" --env "OPENSHIFT_TOKEN=${OC_PASS}" --env "OPENSHIFT_TARGET=https://kubernetes.default.svc" --env "POD_NAME=${APB_NAME}-test" --env "POD_NAMESPACE=${APB_NAME}" --overrides='{"apiVersion":"v1","spec":{"serviceAccountName":"apb"}}' -- test -e namespace=${APB_NAME}

The following command works correctly against sprint150.1 version of apb-base, but fails with the following error against the most recent version:

ERROR! Invalid extra vars data supplied. '@/opt/apb/env/extravars' could not be made into a dictionary

Basically, it appeared to be that on the recent version of apb-base extra vars must be passed the following way: -e "{"namespace": "${APB_NAME}"}" and -e namespace=${APB_NAME} way of passing extra vars is not supported currently even though the docs are saying the opposite:

-e EXTRA_VARS, --extra-vars=EXTRA_VARS set additional variables as key=value or YAML/JSON, if filename prepend with @

[1] https://github.com/ansibleplaybookbundle/eclipse-che-apb/issues/23

ibuziuk commented 6 years ago

@djzager could you please clarify if this is a regression or now it would be possible to add extra-vars only via json / yaml ?

rgolangh commented 6 years ago

@ibuziuk maybe related to what you saw https://github.com/ansibleplaybookbundle/apb-base/pull/49

djzager commented 6 years ago

Apologies are two-fold @ibuziuk

  1. Delayed response, was out on paternity leave
  2. For the change in behavior. When I was working on updating our APB base to use ansible-runner, my goal was to make it so there was no change in behavior. In the end, from a practicality and maintainability perspective it made the most sense to ensure that it absolutely works for the way the Automation Broker invokes the APB. That is the reason that it is only possible to use JSON string after --extra-vars.

Hope that helps.

jorgemoralespou commented 5 years ago

This seems to have broken many APBs that used FROM ansibleplaybookbundle/apb-base I've pinned the APBs I own to FROM ansibleplaybookbundle/apb-base:release-1.2 to make them work until I change how I pass extra-vars.

e.g. https://github.com/openshift-labs/starter-guides/tree/ocp-3.11/apb

tatemz commented 4 years ago

Getting this error too, but fixing the version to release-1.2 did not work

Is this repo still alive? If not, is there an alternative solution to replace APBs?