ansibleplaybookbundle / ansible-playbook-bundle

THIS REPO IS MIGRATING: https://github.com/automationbroker/apb
GNU General Public License v2.0
140 stars 70 forks source link

apb prepare can't handle oneline encoded spec #195

Open djzager opened 6 years ago

djzager commented 6 years ago

In the downstream environment, APB Dockerfiles are structured differently than "normal" (after APB init). Where normal looks something like:

LABEL "com.redhat.apb.spec"=\
"ENCODED_SPEC_LINE1\
...\
LAST_ENCODED_SPEC_LINE"

The downstream environment has multiple labels declared using a single LABEL directive like:

LABEL \
        com.redhat.component="openshift-enterprise-mysql-apb" \
        com.redhat.apb.spec="ALL_ENCODED_SPEC_ONE_LINE" \
        version="v3.9.0" \
        vendor="Red Hat" \
        name="openshift3/mysql-apb" \
        License="GPLv2+" \
        release="0.16.0.0"

This causes some trouble when using apb prepare. See the example below.

Before

$ cat openshift-enterprise-mysql/Dockerfile
FROM openshift3/apb-base:v3.9.0.20180103.170133
MAINTAINER Ansible Playbook Bundle Community

RUN yum-config-manager --enable rhel-7-server-ose-3.7-rpms || : && \
    yum -y install mysql-apb-role

USER apb

LABEL \
        com.redhat.component="openshift-enterprise-mysql-apb" \
        com.redhat.apb.spec="LS0tCiMjIFNoYXJlZCBwYXJhbWV0ZXJzCl9wYXJhbXM6ICZfcGFyYW1zCiAgLSBuYW1lOiBzZXJ2aWNlX25hbWUKICAgIGRlc2NyaXB0aW9uOiBUaGUgbmFtZSBvZiB0aGUgc2VydmljZS4gVXNlZCB0byBuYW1lIGFuZCBsYWJlbCByZXNvdXJjZXMKICAgIHR5cGU6IHN0cmluZwogICAgZGVmYXVsdDogbXlzcWwKICAgIHJlcXVpcmVkOiB0cnVlCiAgLSBuYW1lOiBteXNxbF92ZXJzaW9uCiAgICBkZXNjcmlwdGlvbjogVmVyc2lvbiBvZiBNeVNRTCB0byBkZXBsb3kKICAgIHR5cGU6IGVudW0KICAgIGVudW06IFsiNS42IiwgIjUuNyJdCiAgICBkZWZhdWx0OiAiNS43IgogICAgcmVxdWlyZWQ6IHRydWUKICA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AtICdyZWdpc3RyeS5hY2Nlc3MucmVkaGF0LmNvbS9yaHNjbC9teXNxbC01Ni1yaGVsNycKICAgIC0gJ3JlZ2lzdHJ5LmFjY2Vzcy5yZWRoYXQuY29tL3Joc2NsL215c3FsLTU3LXJoZWw3JwogIHByb3ZpZGVyRGlzcGxheU5hbWU6ICJSZWQgSGF0LCBJbmMuIgpwbGFuczoKICAtIG5hbWU6IGRldgogICAgZGVzY3JpcHRpb246IEEgTXlTUUwgc2VydmVyIHdpdGggZXBoZW1lcmFsIHN0b3JhZ2UKICAgIGZyZWU6IHRydWUKICAgIGRlZmF1bHQ6IHRydWUKICAgIG1ldGFkYXRhOgogICAgICBkaXNwbGF5TmFtZTogRGV2ZWxvcG1lbnQKICAgICAgbG9uZ0Rlc2NyaXB0aW9uOiBUaGlzIHBsYW4gcHJvdmlkZXMgYSBzaW5nbGUgbm9uLUhBIE15U1FMIHNlcnZlciB3aXRob3V0IHBlcnNpc3RlbnQgc3RvcmFnZQogICAgICBjb3N0OiAkMC4wMAogICAgcGFyYW1ldGVyczogKl9wYXJhbXMKICAtIG5hbWU6IHByb2QKICAgIGRlc2NyaXB0aW9uOiBBIE15U1FMIHNlcnZlciB3aXRoIHBlcnNpc3RlbnQgc3RvcmFnZQogICAgZnJlZTogZmFsc2UKICAgIG1ldGFkYXRhOgogICAgICBkaXNwbGF5TmFtZTogUHJvZHVjdGlvbgogICAgICBsb25nRGVzY3JpcHRpb246IFRoaXMgcGxhbiBwcm92aWRlcyBhIHNpbmdsZSBub24tSEEgTXlTUUwgc2VydmVyIHdpdGggMTAgR2lCIG9mIHBlcnNpc3RlbnQgc3RvcmFnZQogICAgICBjb3N0OiAkNS45OSBtb250aGx5CiAgICBwYXJhbWV0ZXJzOiAqX3BhcmFtcwo=" \
        version="v3.9.0" \
        vendor="Red Hat" \
        name="openshift3/mysql-apb" \
        License="GPLv2+" \
        release="0.16.0.0"

After

$ cat openshift-enterprise-mysql/Dockerfile
FROM openshift3/apb-base:v3.9.0.20180103.170133
MAINTAINER Ansible Playbook Bundle Community

RUN yum-config-manager --enable rhel-7-server-ose-3.7-rpms || : && \
    yum -y install mysql-apb-role

USER apb

LABEL \
        com.redhat.component="openshift-enterprise-mysql-apb" \
        com.redhat.apb.spec="LS0tCiMjIFNoYXJlZCBwYXJhbWV0ZXJzCl9wYXJhbXM6ICZfcGFyYW1zCiAgLSBuYW1lOiBzZXJ2aWNlX25hbWUKICAgIGRlc2NyaXB0aW9uOiBUaGUgbmFtZSBvZiB0aGUgc2VydmljZS4gVXNlZCB0byBuYW1lIGFuZCBsYWJlbCByZXNvdXJjZXMKICAgIHR5cGU6IHN0cmluZwogICAgZGVmYXVsdDogbXlzcWwKICAgIHJlcXVpcmVkOiB0cnVlCiAgLSBuYW1lOiBteXNxbF92ZXJzaW9uCiAgICBkZXNjcmlwdGlvbjogVmVyc2lvbiBvZiBNeVNRTCB0byBkZXBsb3kKICAgIHR5cGU6IGVudW0KICAgIGVudW06IFsiNS42IiwgIjUuNyJdCiAgICBkZWZhdWx0OiAiNS43IgogICAgcmVxdWlyZWQ6IHRydWUKICAtIG5hbWU6IG15c3FsX2RhdGFiYXNlCiAgICBkZXNjcmlwdGlvbjogVGhlIG5hbWUgb2YgdGhlIE15U1FMIGRhdGFiYXNlCiAgICB0eXBlOiBzdHJpbmcKICAgIGRlZmF1bHQ6IGRldmVsCiAgICByZXF1aXJlZDogdHJ1ZQogIC0gbmFtZTogbXlzcWxfdXNlcgogICAgZGVzY3JpcHRpb246IFVzZXJuYW1lIHRoYXQgd2lsbCBiZSB1c2VkIHRvIGNvbm5lY3QgdG8gTXlTUUwKICAgIHR5cGU6IHN0cmluZwogICAgZGVmYXVsdDogZGV2ZWwKICAgIHJlcXVpcmVkOiB0cnVlCiAgLSBuYW1lOiBteXNxbF9wYXNzd29yZAogICAgZGVzY3JpcHRpb246IFBhc3N3b3JkIHRvIGNvbm5lY3QgdG8gTXlTUUwgKGdlbmVyYXRlZCBpZiBibGFuaykKICAg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