Starting Magento Connect extension packaging process from JIRA
When I wrote the first part of Continuous Integration server to package Magento Extension I didn’t know how to make it work with a click from JIRA. As you may know in JIRA there’s a way to release versions and trigger Bamboo builds during this release process. That’s what I was aiming – to make it work from JIRA so that it would NOT require any technical knowledge from let’s say Project Manager or Release Manager. I didn’t know it yesterday but here at MageFlow we have a learning mindset. I know it today:)
First – there are now 2 build plans configured in our Bamboo for our MageFlowConnect extension:
- “continuous builds” or “CI builds” that are triggered by commits that are made to the git repository that contains MFX code.
- “release builds” or “manual builds” that are triggered by clicking “Release” in JIRA
There are 2 main problems with creating Magento extension packages automatically:
- when and how to update extension’s version number (in module’s etc/config.xml and in package.xml mentioned in previous post)
- how to update release notes inside package.xml. However this one is not mandatory and it’s not resolved yet by us either.
Prerequisites
Install xsltproc to your build server and configure an executable “XSLTProc” in Bamboo.
Updating version numbers
In Part 1 I’ve created a XSL stylesheet that does the job of replacing extension version number in package.xml. Exactly the same XSL can be used to replace version number in extension’s etc/config.xml, too.
In your “CI build” process you may want to have extension version number increased with every build automatically. So that’s what we do – we set the extension version number to that already defined in package.xml with added Bamboo build number. For example if package.xml contains version number 1.1.3 and Bamboo build # is 43 then the final version number of that extension build would be 1.1.3.43.
In order to replace version numbers in the “CI build” process add following 2 XSLTProc tasks to the build job in Bamboo:
- –output public/var/connect/package.xml –stringparam package_version ${bamboo.buildNumber} utils/update_version.xsl public/var/connect/package.xml
- –output public/app/code/community/Mageflow/Connect/etc/config.xml –stringparam package_version ${bamboo.buildNumber} utils/update_version.xsl public/app/code/community/Mageflow/Connect/etc/config.xml
First one appends ${bamboo.buildNumber} to existing version number (e.g 1.1.3) in package.xml while second does the same in etc/config.xml
In order to replace version numbers in the “Release build” (build triggered from JIRA) process add following 2 XSLTProc tasks to the build job in Bamboo:
- –output public/var/connect/package.xml –stringparam package_version ${bamboo.jira.version} utils/update_version.xsl public/var/connect/package.xml
- –output public/app/code/community/Mageflow/Connect/etc/config.xml –stringparam package_version ${bamboo.jira.version} utils/update_version.xsl public/app/code/community/Mageflow/Connect/etc/config.xml
First replaces version in package.xml with the version number specified in JIRA (let’s say 1.1.4) while second does the same in extension’s etc/config.xml
That’s it!:)
Please feel free to comment or send me questions directly.
Follow me: by
Share me: by