You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ivy-user@ant.apache.org by "Vonnahme, Paul" <Vo...@principal.com> on 2009/05/19 19:26:36 UTC
Published jars for test, pilot, and production environments?
I'm hoping someone else is in a similar situation. We have some utility jars used by multiple projects. These jars have three different versions: one each for our test, pilot, and production environments. Therefore I believe each of the versions needs to be published so it will be available for multiple apps to use.
When an app builds, it should get the latest version of the jar depending on the environment. The ivy.xml would contain:
<dependency org="principal" name="utility_jar" rev="latest.integration"/> .
I'd like to do something like:
ant compile -Denv=test
for it to build with the latest test jar, -Denv=pilot to build with the latest pilot jar, etc.
My idea is to have three different versions of the settings file, and just change the root of a resolver based on the environment.
<property name="ivy.shared.default.root" value="/IvyRepository/test"/> would specify the root of the 'shared' resolver for the test environment. "/IvyRepository/pilot" would exist for pilot, etc.
The problem I see with this is that the local cache would contain versions from all environments (depending on which one you built with last) and would have to be cleared out every time.
Am I overthinking the problem? Is there a way to only have one repository but still be able to specify the latest jar from a specific environment?
Thanks,
Paul
-----Message Disclaimer-----
This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to Connect@principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.
Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.
While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.
Re: Published jars for test, pilot, and production environments?
Posted by Mitch Gitman <mg...@gmail.com>.
Few responses inline.
On Thu, May 21, 2009 at 10:37 AM, Vonnahme, Paul <
Vonnahme.Paul@principal.com> wrote:
> [OT] I wasn't aware you could use ant variables in the ivy.xml files. Very
> good to know, and I'm sure it will come in handy as I continue to experiment
> with ivy.
>
Small correction. You can use Ant properties (not variables) in
ivysettings.xml files, *not *ivy.xml files as you say.
> >
> > and run in test environment:
> > ant -Divy.build.env=integration compile
> >
> > You can even default the property in ivysettings.xml, with an
> > override=false setting, to ensure your command-line param
> > takes precedence.
> >
> > Now just publish your utility modules with the appropriate
> > statuses, and everything should Just Work, right?
>
> I tried this out, and at first it seemed like the answer I had been looking
> for. However, then I noticed a few resolves that weren't happening how I
> expected. I found this in the documentation (
> http://ant.apache.org/ivy/history/latest-milestone/ivyfile/dependency.html
> ):
> "latest.[any status]
> selects the latest revision of the dependency module with **at least the
> specified status**." (Emphasis mine)
>
> For our environment if I run:
> ant -Divy.build.env=pilot compile
> I would need it to compile only with dependencies that have a pilot status.
> Since ivy statuses are hierarchical, I would run the risk of pulling a
> dependency from a higher status.
If I were you and I really insisted on (A) having one Ivy repository for all
my different statuses/stages and (B) not distinguishing between integration
and milestone/release via the revision value itself, then I would ask
myself, "Isn't this default rule really what I want after all?"
Suppose I have a web service project that is depending on a domain project
and I know I haven't had to make any changes to the domain project since its
last release to support the new pilot of your web service, then that "at
least the specified status" rule makes perfect sense. You don't want to have
to produce a new pilot version of your domain project to support a new pilot
version of your web service project.
Beyond that, if you found out after all that you were happy with that rule,
you might as well just make pilot correspond to the built-in "milestone"
status, although integration/milestone/release vs. integration/pilot/release
is a trivial matter.
>
> One way I could guarantee the status would be to put
> <status name="${ivy.build.env}" integration="false"/>
> as my highest level status.
It sounds like to accomplish this, you would have to dynamically import an
Ivy settings fragment into your main Ivy settings, like
ivysettings-statuses-${ivy.build.env}.xml. Then if the build env is
integration, the imported file defines only one status, integration. If the
build env is pilot, the imported file defines two status, integration and
pilot. Etc.
So it sounds like this could be done, although I would still question the
motivation.
>
> I will continue to experiment more with this option as well the option of
> multiple repositories.
>
> Thanks to all for your responses.
>
> Paul
>
>
>
> -----Message Disclaimer-----
>
> This e-mail message is intended only for the use of the individual or
> entity to which it is addressed, and may contain information that is
> privileged, confidential and exempt from disclosure under applicable law.
> If you are not the intended recipient, any dissemination, distribution or
> copying of this communication is strictly prohibited. If you have
> received this communication in error, please notify us immediately by
> reply email to Connect@principal.com and delete or destroy all copies of
> the original message and attachments thereto. Email sent to or from the
> Principal Financial Group or any of its member companies may be retained
> as required by law or regulation.
>
> Nothing in this message is intended to constitute an Electronic signature
> for purposes of the Uniform Electronic Transactions Act (UETA) or the
> Electronic Signatures in Global and National Commerce Act ("E-Sign")
> unless a specific statement to the contrary is included in this message.
>
> While this communication may be used to promote or market a transaction
> or an idea that is discussed in the publication, it is intended to provide
> general information about the subject matter covered and is provided with
> the understanding that The Principal is not rendering legal, accounting,
> or tax advice. It is not a marketed opinion and may not be used to avoid
> penalties under the Internal Revenue Code. You should consult with
> appropriate counsel or other advisors on all matters pertaining to legal,
> tax, or accounting obligations and requirements.
>
>
RE: Published jars for test, pilot, and production environments?
Posted by "Vonnahme, Paul" <Vo...@principal.com>.
> Vonnahme, Paul wrote on 05/19/2009 01:26 PM:
> > I'm hoping someone else is in a similar situation. We have some
> > utility jars used by multiple projects. These jars have three
> > different versions: one each for our test, pilot, and production
> > environments. Therefore I believe each of the versions needs to be
> > published so it will be available for multiple apps to use.
> >
>
> Is there any reason not to use varying statuses for the
> different environments?
>
> http://ant.apache.org/ivy/history/trunk/settings/statuses.html
>
> You could either use the default
> release/milestone/integration statuses to map to your
> environments, or use your own.
>
> In your ivy.xml,
>
> <dependency org="principal" name="utility_jar"
> rev="latest.${ivy.build.env}"/>
[OT] I wasn't aware you could use ant variables in the ivy.xml files. Very good to know, and I'm sure it will come in handy as I continue to experiment with ivy.
>
> and run in test environment:
> ant -Divy.build.env=integration compile
>
> You can even default the property in ivysettings.xml, with an
> override=false setting, to ensure your command-line param
> takes precedence.
>
> Now just publish your utility modules with the appropriate
> statuses, and everything should Just Work, right?
I tried this out, and at first it seemed like the answer I had been looking for. However, then I noticed a few resolves that weren't happening how I expected. I found this in the documentation (http://ant.apache.org/ivy/history/latest-milestone/ivyfile/dependency.html):
"latest.[any status]
selects the latest revision of the dependency module with **at least the specified status**." (Emphasis mine)
For our environment if I run:
ant -Divy.build.env=pilot compile
I would need it to compile only with dependencies that have a pilot status. Since ivy statuses are hierarchical, I would run the risk of pulling a dependency from a higher status.
One way I could guarantee the status would be to put
<status name="${ivy.build.env}" integration="false"/>
as my highest level status.
I will continue to experiment more with this option as well the option of multiple repositories.
Thanks to all for your responses.
Paul
-----Message Disclaimer-----
This e-mail message is intended only for the use of the individual or
entity to which it is addressed, and may contain information that is
privileged, confidential and exempt from disclosure under applicable law.
If you are not the intended recipient, any dissemination, distribution or
copying of this communication is strictly prohibited. If you have
received this communication in error, please notify us immediately by
reply email to Connect@principal.com and delete or destroy all copies of
the original message and attachments thereto. Email sent to or from the
Principal Financial Group or any of its member companies may be retained
as required by law or regulation.
Nothing in this message is intended to constitute an Electronic signature
for purposes of the Uniform Electronic Transactions Act (UETA) or the
Electronic Signatures in Global and National Commerce Act ("E-Sign")
unless a specific statement to the contrary is included in this message.
While this communication may be used to promote or market a transaction
or an idea that is discussed in the publication, it is intended to provide
general information about the subject matter covered and is provided with
the understanding that The Principal is not rendering legal, accounting,
or tax advice. It is not a marketed opinion and may not be used to avoid
penalties under the Internal Revenue Code. You should consult with
appropriate counsel or other advisors on all matters pertaining to legal,
tax, or accounting obligations and requirements.
Re: Published jars for test, pilot, and production environments?
Posted by Mitch Gitman <mg...@gmail.com>.
Alan, I agree that configurations are a powerful--indeed a
necessary--feature of Ivy. But I would also maintain that Ivy confs are
about features, not about the problem Paul is trying to address, which is
distinguishing between integration and release builds. For that problem I
believe the techniques at hand come down to some combination of:
- Depending on status="latest.integration", etc. And Kirby above offers a
good technique for changing "latest.${...}" on the fly.
- Maintaining separate integration and release Ivy repositories.
- Establishing versioning conventions (probably in concert with the
version control system) that lead to integration publications having
distinctly different revisions than release publications. That is, you can
tell just by looking at the form of rev="..." whether it's integration or
release.
Consider it this way. Even if you have an Ivy conf to give you your
in-memory database, you're still going to need the other Ivy conf to give
you your real database--*even for your continuous integration builds*. Now
you could say, "What about the database connection strings? Wouldn't they
qualify for different Ivy confs, so you would need one Ivy conf for dev and
another for QA and yet another for production?" I would maintain that even
here you're blurring the line, but then application configuration is a whole
'nuther topic in its own right.
On Tue, May 19, 2009 at 2:11 PM, Alan Hohn <li...@anvard.org> wrote:
>
> On Tue, 19 May 2009, Kirby Files wrote:
>
> Is there any reason not to use varying statuses for the different
>> environments?
>>
>> http://ant.apache.org/ivy/history/trunk/settings/statuses.html
>>
>>
> This is a good solution if you can have separate downstream projects that
> fetch the JARs for each environment. If your situation is more complicated
> and you need to fetch different versions of an upstream JAR into the same
> downstream project for different purposes (unit test, deployment, etc.),
> look into Ivy configurations. They're designed to do exactly what you want.
>
> In our project we have a unit testing version of some of our projects (uses
> in-memory database support, etc.) and Ivy configurations let us grab one
> version of the JAR to run tests in the downstream and then grab a different
> version when it's time to package an EAR file.
>
> http://ant.apache.org/ivy/history/2.1.0-rc1/tutorial/conf.html
>
> Best regards,
> Alan
>
>
Re: Published jars for test, pilot, and production environments?
Posted by Alan Hohn <li...@anvard.org>.
On Tue, 19 May 2009, Kirby Files wrote:
> Is there any reason not to use varying statuses for the different
> environments?
>
> http://ant.apache.org/ivy/history/trunk/settings/statuses.html
>
This is a good solution if you can have separate downstream projects that
fetch the JARs for each environment. If your situation is more complicated
and you need to fetch different versions of an upstream JAR into the same
downstream project for different purposes (unit test, deployment, etc.),
look into Ivy configurations. They're designed to do exactly what you
want.
In our project we have a unit testing version of some of our projects
(uses in-memory database support, etc.) and Ivy configurations let us grab
one version of the JAR to run tests in the downstream and then grab a
different version when it's time to package an EAR file.
http://ant.apache.org/ivy/history/2.1.0-rc1/tutorial/conf.html
Best regards,
Alan
Re: Published jars for test, pilot, and production environments?
Posted by Kirby Files <kf...@masergy.com>.
Vonnahme, Paul wrote on 05/19/2009 01:26 PM:
> I'm hoping someone else is in a similar situation. We have some
> utility jars used by multiple projects. These jars have three
> different versions: one each for our test, pilot, and production
> environments. Therefore I believe each of the versions needs to be
> published so it will be available for multiple apps to use.
>
> When an app builds, it should get the latest version of the jar depending on the environment. The ivy.xml would contain:
> <dependency org="principal" name="utility_jar" rev="latest.integration"/> .
>
> I'd like to do something like:
> ant compile -Denv=test
> for it to build with the latest test jar, -Denv=pilot to build with the latest pilot jar, etc.
>
> My idea is to have three different versions of the settings file,
> and just change the root of a resolver based on the environment.
> <property name="ivy.shared.default.root" value="/IvyRepository/test"/>
> would specify the root of the 'shared' resolver for the test
> environment. "/IvyRepository/pilot" would exist for pilot, etc.
Is there any reason not to use varying statuses for the different
environments?
http://ant.apache.org/ivy/history/trunk/settings/statuses.html
You could either use the default release/milestone/integration
statuses to map to your environments, or use your own.
In your ivy.xml,
<dependency org="principal" name="utility_jar"
rev="latest.${ivy.build.env}"/>
and run in test environment:
ant -Divy.build.env=integration compile
You can even default the property in ivysettings.xml, with an
override=false setting, to ensure your command-line param takes
precedence.
Now just publish your utility modules with the appropriate statuses,
and everything should Just Work, right?
Thanks,
----
Kirby Files
Software Architect
Masergy Communications
kfiles@masergy.com
Re: Published jars for test, pilot, and production environments?
Posted by Mitch Gitman <mg...@gmail.com>.
Don't consider this an authoritative answer, and I know this isn't the
answer you want to hear. But I tend to believe that the "best practice"
approach to distinguishing between different statuses of the same module is
to literally use different repositories.
So you would have an integration repository to which the ivy:publish would
specify status="integration". And you would have a pilot repository to which
the ivy:publish would specify status="milestone" or status="release". And
finally your production repository would be all status="release".
Then you would switch between different Ivy settings depending on which
repository you're building against. At this point you're ensured that no
integration versions will leak into your release builds.
As for the potential for conflicts in your local cache, this is where I
don't feel comfortable giving an authoritative answer. But if you know that
throughout your dependency chain you're depending on "latest.integration" or
"latest.integration", then you should be good. However, if in your
dependency element in an ivy.xml you're specifying a particular revision as
opposed to "latest.integration" or "latest.release", I don't know if there's
a way to make it only a particular status.
Now, there's another approach that would address the problem of getting
confused between integration and release versions of the same Ivy module,
although I don't think addressing this problem should be the primary
rationale for taking this approach. In a development environment where
you're doing active development in the trunk and using branches to prepare
milestones and releases, it makes sense to give those milestones and
releases slightly different versions/revisions. Never mind Ivy.
So suppose active development is going on on mywebapp 2.0. Then you want to
prepare a release, alpha1. So you branch mywebapp 2.0 to create mwebapp
2.0_alpha1. If you follow a convention like this, from here on in you know
that revision="2.0" will always give you an integration version and
revision="2.0_alpha1" will always give you a milestone or release version.
A more Ivy-centric variation on this technique of having the revision itself
distinguish between integration and release builds is to literally
incorporate some marker of the integration build into the revision.
If you're doing what one would call snapshot versioning where each latest
integration build by the CI server replaces the previous one for that given
revision and you care to express the fact it's a "snapshot" that in the
revision (like Maven does I understand), then you would be publishing
mywebapp rev="2.0-SNAPSHOT" (or whatever naming convention you follow). When
it comes time to do a release, it makes sense that that -SNAPSHOT suffix
will no longer be there.
Likewise, if you're doing what I would call prolific versioning where each
latest integration build creates its own unique revision--so the CI server
is adding more and more revisions to the integration repository--then you're
ensured that each integration build has its own unique revision like
"2.0.20090510105801" with a timestamp. Or maybe "2.0.212" where you're
keeping track of an incrementing build number. I'm inclined to think that,
with this approach, when you're ready to do a release, you would just call
it "2.0" or "2.0_alpha1" or "2.0.0" or "2.0_ga"--whatever. Whatever you call
it the fine-grained timestamp or build number is no longer there.
Forgive me for making a magnum opus out of this, but this is a fairly
complicated topic.
On Tue, May 19, 2009 at 10:26 AM, Vonnahme, Paul <
Vonnahme.Paul@principal.com> wrote:
> I'm hoping someone else is in a similar situation. We have some utility
> jars used by multiple projects. These jars have three different versions:
> one each for our test, pilot, and production environments. Therefore I
> believe each of the versions needs to be published so it will be available
> for multiple apps to use.
>
> When an app builds, it should get the latest version of the jar depending
> on the environment. The ivy.xml would contain:
> <dependency org="principal" name="utility_jar"
> rev="latest.integration"/> .
>
> I'd like to do something like:
> ant compile -Denv=test
> for it to build with the latest test jar, -Denv=pilot to build with the
> latest pilot jar, etc.
>
> My idea is to have three different versions of the settings file, and just
> change the root of a resolver based on the environment.
> <property name="ivy.shared.default.root"
> value="/IvyRepository/test"/> would specify the root of the 'shared'
> resolver for the test environment. "/IvyRepository/pilot" would exist for
> pilot, etc.
>
> The problem I see with this is that the local cache would contain versions
> from all environments (depending on which one you built with last) and would
> have to be cleared out every time.
>
> Am I overthinking the problem? Is there a way to only have one repository
> but still be able to specify the latest jar from a specific environment?
>
> Thanks,
> Paul
>
>
>
>
>
>
>
> -----Message Disclaimer-----
>
> This e-mail message is intended only for the use of the individual or
> entity to which it is addressed, and may contain information that is
> privileged, confidential and exempt from disclosure under applicable law.
> If you are not the intended recipient, any dissemination, distribution or
> copying of this communication is strictly prohibited. If you have
> received this communication in error, please notify us immediately by
> reply email to Connect@principal.com and delete or destroy all copies of
> the original message and attachments thereto. Email sent to or from the
> Principal Financial Group or any of its member companies may be retained
> as required by law or regulation.
>
> Nothing in this message is intended to constitute an Electronic signature
> for purposes of the Uniform Electronic Transactions Act (UETA) or the
> Electronic Signatures in Global and National Commerce Act ("E-Sign")
> unless a specific statement to the contrary is included in this message.
>
> While this communication may be used to promote or market a transaction
> or an idea that is discussed in the publication, it is intended to provide
> general information about the subject matter covered and is provided with
> the understanding that The Principal is not rendering legal, accounting,
> or tax advice. It is not a marketed opinion and may not be used to avoid
> penalties under the Internal Revenue Code. You should consult with
> appropriate counsel or other advisors on all matters pertaining to legal,
> tax, or accounting obligations and requirements.
>