Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Define environment specific assets in ml-config.xml #692

Closed
RobertSzkutak opened this issue Nov 16, 2016 · 8 comments
Closed

Define environment specific assets in ml-config.xml #692

RobertSzkutak opened this issue Nov 16, 2016 · 8 comments

Comments

@RobertSzkutak
Copy link
Contributor

RobertSzkutak commented Nov 16, 2016

Request from a customer :

Have an optional attribute in Roxy assets which defines environments that are allowed to use that asset.

ex:

This asset would only be deployed/wiped on dev environment:

<role @environment='dev'/>

This asset would only be deployed/wiped on local and dev environment:

<user @environment='local,dev'>

While you can do this with using a different ml-config,xml for each environment, it would be much more condensed to manage assets like this within a single ml-config.xml file.

@dmcassel
Copy link
Collaborator

dmcassel commented Nov 16, 2016

I'm curious about the use case here, as a major purpose to having the
Deployer is to ensure consistency across environments. That said, I don't
see any problem supporting the feature, while keeping the default behavior.

@RobertSzkutak
Copy link
Contributor Author

RobertSzkutak commented Nov 16, 2016

The use case described to me by the customer is that they run their testing in lower environments and that testing needs additional users defined for automating their testing scenarios. Another use case was that they want to go through a process of promoting indexes up into higher environments and that this would be a good way to manage that for them.

@dmcassel
Copy link
Collaborator

Sounds good to me.

@grtjn
Copy link
Contributor

grtjn commented Jun 14, 2017

I'm playing around with #808, and starting to think I need something similar. I'd like to get rid of the xml placeholders like @ml.ssl-certificate-xml. Instead I'd prefer doing something like:

      <certificate xmlns="http://marklogic.com/xdmp/pki" if-exists="@ml.ssl-certificate-template">
        <name>@ml.ssl-certificate-template</name>
        <countryName>@ml.ssl-certificate-countryName</countryName>
        <stateOrProvinceName>@ml.ssl-certificate-stateOrProvinceName</stateOrProvinceName>
        <localityName>@ml.ssl-certificate-localityName</localityName>
        <organizationName>@ml.ssl-certificate-organizationName</organizationName>
        <organizationalUnitName>@ml.ssl-certificate-organizationalUnitName</organizationalUnitName>
        <emailAddress>@ml.ssl-certificate-emailAddress</emailAddress>
      </certificate>

Note: the property placeholder gets replaced as anywhere else, and results in either an empty if-exists attribute, or one with a value.

Similarly we could do something like:

      <role if-equal="${environment}=dev"/>

Or maybe just if, and then allow = as well as !=. No eval, just tokenize, and string-compare left and right operand according to operator..

@grtjn
Copy link
Contributor

grtjn commented Jun 15, 2017

I was hoping to be able to use more complex if expressions, like property EQ "my val" AND other_property NE "other val", but you'd need a good parser to process that. cts:parse would be a great tool to use, but unfortunately not supported by MarkLogic 7. Will be difficult to 'poly-fill' that. Could try though..

@RobertSzkutak
Copy link
Contributor Author

RobertSzkutak commented Jun 15, 2017

I'm ok with saying this feature is not ML7 supported

@grtjn
Copy link
Contributor

grtjn commented Jun 15, 2017

Well, I had something in mind for #808, but that would affect ML7 support too. I might have found a way though. search:parse works too. Less strong, but it works. And there are some quirks with cts:parse, making search:parse do a little better actually..

Let me see if I can put a PR together for this..

@grtjn grtjn self-assigned this Jun 15, 2017
@grtjn grtjn added this to the July 2017 milestone Jun 15, 2017
grtjn added a commit to grtjn/roxy that referenced this issue Jun 15, 2017
grtjn added a commit to grtjn/roxy that referenced this issue Jun 15, 2017
grtjn added a commit to grtjn/roxy that referenced this issue Jun 16, 2017
…able to expose decision logic within ml-config
RobertSzkutak added a commit that referenced this issue Aug 4, 2017
Fixed #692: leveraging search:parse to evaluate if's against properties
@RobertSzkutak
Copy link
Contributor Author

Implemented in DEV

grtjn added a commit to grtjn/roxy that referenced this issue Jan 11, 2018
…able to expose decision logic within ml-config
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants