How to edit xml files through Jenkins pipeline?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to edit xml files through Jenkins pipeline?

Gajanan Mahajan
I've to update xml file as a part of pipeline. From following, I've to replace `value` from `true` to false

    <bean id="SecurityFilter" class="xxx">
    <property name="cookieSecurity" value="true"/>

Also, following commented code, I've to uncomment -

    <!--
    <session-config>
    <cookie-config>
    <http-only>true</http-only>
    <secure>false</secure>
    </cookie-config>
    <tracking-mode>COOKIE</tracking-mode>
    </session-config>
    -->

Both of above snippets can be anywhere in xml file. `sed` utility won't help much here. 

Could you please suggest best possible approaches, solutions for this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9987c908-92d7-4499-969f-b93c972ffceao%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to edit xml files through Jenkins pipeline?

Jan Monterrubio
Since a pipeline can support groovy, you can try some of the groovy classes: 

On Mon, Jun 22, 2020 at 23:10 Gajanan Mahajan <[hidden email]> wrote:
I've to update xml file as a part of pipeline. From following, I've to replace `value` from `true` to false

    <bean id="SecurityFilter" class="xxx">
    <property name="cookieSecurity" value="true"/>

Also, following commented code, I've to uncomment -

    <!--
    <session-config>
    <cookie-config>
    <http-only>true</http-only>
    <secure>false</secure>
    </cookie-config>
    <tracking-mode>COOKIE</tracking-mode>
    </session-config>
    -->

Both of above snippets can be anywhere in xml file. `sed` utility won't help much here. 

Could you please suggest best possible approaches, solutions for this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9987c908-92d7-4499-969f-b93c972ffceao%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CADgiF9%2BAowH%2BXOLHS1yELDW%3DpzUC8HO_Ueq4o7oudOPEt1Xe4w%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: How to edit xml files through Jenkins pipeline?

Ivan Fernandez Calvo
In reply to this post by Gajanan Mahajan
Hi, 

I'd not recommend processing the XML file inside the Jenkinsfile, all the Groovy code you put in a Jenkins file consumes resources in the Jenkins instance (not in the Agent) and process an XML file can be a heavy process. 
I recommend you call a command-line tool or a Python script to process the file, in that way you will use only resources in the Agent. You have an interesting Jesse Glick presentation about this kind of thing 

How To Use Jenkins Less
https://www.youtube.com/watch?reload=9&v=Zeqc6--0eQw



El martes, 23 de junio de 2020, 6:09:50 (UTC+2), Gajanan Mahajan escribió:
I've to update xml file as a part of pipeline. From following, I've to replace `value` from `true` to false

    <bean id="SecurityFilter" class="xxx">
    <property name="cookieSecurity" value="true"/>

Also, following commented code, I've to uncomment -

    <!--
    <session-config>
    <cookie-config>
    <http-only>true</http-only>
    <secure>false</secure>
    </cookie-config>
    <tracking-mode>COOKIE</tracking-mode>
    </session-config>
    -->

Both of above snippets can be anywhere in xml file. `sed` utility won't help much here. 

Could you please suggest best possible approaches, solutions for this?

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/9662ec31-53a0-4f38-924e-6359215a200fo%40googlegroups.com.