Automatic building of NSF from (git) repository

I finally had some time to try new "experimental" feature that has been added to IBM Notes in 9.0.1 release. And it is the ability to automatically take repository containing so called on-disk project and build NSF out of it. Which is something you probably do daily, but you have to do it manually in Designer.

After couple of tweets about this matter Jonathan Roche from IBM offered me help in case I have any problems. I always have problems ;-) But this was easy... What was missing in slides from IBM Connect 2014 session AD209: Making Your Development Team More Productive with IBM Domino Designer is the need to add one notes.ini variable. Thanks a lot Jonathan! I wish all problems with IBM sofware are solved like this one.

To make it work you need:

  • 9.0.1 Designer
  • add DESIGNER_AUTO_ENABLED=true to notes.ini file
  • and then simply run
    designer.exe -RPARAMS -console -vmargs"true,true,nameof.nsf,importandbuild,C:\pathto\.project,nameof.nsf"
    from command line.

Provided you have on-disk project in C:\pathto\ after a while you'll have a new database (in this case named nameof.nsf) in Notes data directory.

Why I'm writing about it? Imagine this: you can trigger NSF creation after each commit to repository, then run a set of tests to make sure application is not "broken" and see the results for each of these builds. All automatically, without any other action apart from the commit/push itself.
And as a bonus you can easily see who broke the build and proceed with spanking or whatever it is you do to a naughty developer.


One way to get it to server

I did some experiments how to get the db to server. Here are first thoughts. I'Il probably write more later
.I had to create 2 components:

1. Batch file to run it
2. NSF db that does notes operations

1. In batch file biggest issue was to find when the job is done, since it creates separate processes. Google offered some advices, so I ended up using pslist from pstools and sleep command found somewhere else.

Here is the file
designer.exe -RPARAMS -console -vmargs"true,true,trtest.nsf,importandbuild,C:\Git\Teamroom\TR\.project,trtest.nsf"

@echo off
C:\pstools\PSLIST notes2 >nul 2>&1
) ELSE (
ECHO designer is still running
C:\sleep\SLEEP 5 /quiet


echo "launch client to copy"

nlnotes.exe notes:///cideploy.nsf/84AD4CF25D638F66C1257C77006547DA/53D2901644D70EDFC1257C77006588AA?OpenDocument

echo "open"

explorer http://devserver/servertr.nsf

2. Local db that has configuration profile for the app. it is called using notes:// link (and calling it with nlnotes has nice sideeffect that it waits to complete). Biggest issue was to automatically closed notes when done.

Link actually opens document using form that has queryopenevent to do the job and postopen with @Command([ExitNotes]) . It has to be called using viewunid and unid of the document, since I use form formula of the view to redirect it to form that does the job, instead of standard form that I use for configuration.

Code can be than pretty much anything I have for now just:
Dim doc As NotesDocument
Set doc=source.document

Dim sourcedb As New NotesDatabase("",doc.profilekey(0))
If sourcedb.IsOpen Then

Dim targetdb As New NotesDatabase(doc.targetserver(0),doc.targetnsf(0))

If targetdb.IsOpen Then
Call targetdb.Remove
End If

Call sourcedb.CreateCopy(doc.targetserver(0),doc.targetnsf(0))

End If

And that's all. I tested it with teamroom db and it worked fine.