...
För att utveckla och underhålla SKLTP samt köra automatiska enhetstester och integrationstester i utvecklingsmiljön krävs:
- Java SE 7 och 8
- Maven 3
- Subversion och Git klient
Val av IDE är valfritt men om Eclipse används så rekommenderas följande pluginer för versionshantering av källkod:
...
- EGit för Git
För att exekvera systemtester används:
...
Utöver detta behövs rättigheter till följande:
- Github push rättigheter
- Jenkins Cloudbees rättigheter
- Sonatype nexus rättigheterRättigheter till Ineras Jenkins server.
- Rättigheter till Ineras Nexus
- JIRA och Confluence wiki
- Tillgång till fysiska testmiljöer
...
/wiki/spaces/SKLTP/pages/3187835204
License headers
...
Maven bygget kontrollerar att det finns licensheadrar i källkodsfilerna (till exempel, när man kör: mvn clean install)
...
genom att använda com.mycila.maven-license-plugin:maven-license-plugin.
If a build fails due to missing license headersOm bygget falerar p.g.a. att licensheadrar saknas:
Inget format |
---|
[INFO] Missing header in: /Users/hakan/Documents/scm/svn_skltp/jms-admin-web_tr/src/main/java/se/skltp/admin/core/services/HdLabAmq.java [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE |
it can be fixed by runningDet kan man lösa genom:
Kodblock |
---|
mvn license:format |
Verifiering
Innan release av en component komponent ska funktionella tester, lasttester och robusthetstester genomföras.
/wiki/spaces/SKLTP/pages/3187836104
Release Management
To release software components we use Maven and its För att skapa releaser används Maven och Mavens release-plugin. Kontrollera att följande kod finns i rot-pom'en. I annat fall kommer releasepluginen att försöka checka in koden i det centrala github-repot.
Info |
---|
<build> |
När man är klar får incheckning mot github göras manuellt.
To be able to publish released artifacts on the central Maven repository we use Sonatype OSS Repository Hosting Service, see instructions for more information.
Info |
---|
To get permissions to publish a release on Maven, create a JIRA on https://issues.sonatype.org/projects/OSSRH. If you don't have an account, create an account and log in. See example JIRA: https://issues.sonatype.org/browse/OSSRH-7085. Note: original hosting request: https://issues.sonatype.org/browse/OSSRH-5414 |
After a successful registration and setup of a OSS project according to the instruction above a release can be done to the central repository just by doing the ordinary:
Kodblock |
---|
mvn release:prepare
mvn release:perform
|
Info |
---|
If you during release:perform get a Failed to deploy artifacts: Could not transfer artifact <artifact:url> peer not authenticated error. Try adding: -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true In cases when SSLv3 is somehow set as default version, this will fail with the same error, then use -Dhttps.protocols="TLSv1" |
The artifacts are now pushed to a Nexus staging repository and can be published in its staging repository for verification and after that the artifacts can be released for publication on the central Maven repository. See below for instructions.
For the SKLTP project with the group-id se.skltp
, see http://repo1.maven.org/maven2/se/skltp/.
Verify and publish released artifacts
Before publishing released artifacts to the public Maven repository we can verify its functionality by publishing them to a staging repository.
After a successful verification we can move on and make them public available in the central Maven repository.
Publish to a staging repository for verification
- Go to: https://oss.sonatype.org
- Login to the Nexus UI.
- Select "Staging Repositories" in the menu to the left.
- Select the release-bundle in the list that is displayed, e.g. seskltp-nnnn, and validates its content (click on the Content-tab below the selected bundle)
- Click the Close button in the top menu.
Validate
The suggested validation procedure assumes that you have a maven profile in your settings-file För att Mavens deploy plugin ska veta var den ska deploya releaserna skall följande finnas i projektets root pom (eller i parent till root pom). Url:erna kan man sedan sätta i den lokala (eller Jenkins) Maven settings filen (se kommande exempel)
Info |
---|
<distributionManagement> |
Maven settings fil (~/.m2/settings.xml) like:) bör sedan sättas upp enligt nedan för att peka ut var dependencies skall hämtas (via mirror) och vart den skall deploya filerna (Till Ineras Nexus i exemplet nedan) samt användaruppgifter till Ineras Nexus (i sektionen "servers").
Kodblock | ||||
---|---|---|---|---|
| ||||
<servers><mirrors> <server> <id>sonatype-nexus-staging</id> <username>xxxxxxxxx</username> <password>pppppppppp</password> </server> </servers> <profile> <id>sonatype-nexus-staging</id> <repositories> <!-- Mirror används för att hämta dependencies via Inera Nexus --> <mirror> <repository> <id>sonatype-nexus-staging<<id>Inera Nexus</id> <name>Inera <name>SonatypeNexus NexusPublic Staging<Mirror</name> <url>https://ossnexus.sonatypeinera.orgse/contentrepository/repositoriesmaven-public/staging</ </url>url> <mirrorOf>*,!grails</mirrorOf> </mirror> </mirrors> <profiles> <releases> <profile> <enabled>true<<id>skltp</enabled>id> <properties> </releases> <!-- <snapshots>Ställer om URL för snapshots och release i distributionManagement <enabled>false</enabled> </snapshots> i pom.xml, pom.xml måste använda dessa för att det ska fungera --> </repository> </repositories> </profile> |
OBS! I Sonatype under användarprofilen kan man skapa ett user token som ersätter inloggningsuppgifter i klartext under <server> med krypterade användarnamn och lösenord.
Perform the following steps:
- Validate against the staging repo https://oss.sonatype.org/content/repositories/staging/
- Activate the maven profile sonatype-nexus-staging in the maven settings.xml - file:
Kodblock | ||
---|---|---|
xml | xml | <activeProfiles> <releases-nexus-url>https://nexus.inera.se/repository/SKLTP-Releases/</releases-nexus-url> <activeProfile>sonatype-nexus-staging</activeProfile> </activeProfiles> |
- If you are using the released artifacts are used in other components:
- Remove the released artifacts from the local maven repository (to ensure that the artifacts are downloaded as expected from the Sonatypes staging repository)
- Update other components that depend on the released artefacts to the new versions in their maven dependencies and perform a clean build of the components.
- Perform whatever tests to ensure the the components work as expected with the released artifacts.
- If the released artifacts contains ready to use applications
- Download the application runtime-files for the staging repository and deploy then into your test environment.
- Perform tests that verify that the new release of the application works as expected.
- If errors are detected then go back to the Nexus UI and click on the Drop button to stop the release.
- Correct any errors and redo the deploy process...
Publish to the central Maven repository for public availability
- Go back to the Nexus UI, i.e. https://oss.sonatype.org
- Login and select the release bundle again
- Click on the Release button.
- Artifacts should now be synced with central Maven repository on a hourly bases...
Skapa GPG-nyckel för att signera artefakter vid release
Sonatype OSS kräver signering av artefakter med GPG (konfiguration för detta finns i Sonatype OSS maven parent-pom).
Install pgp, create key-pair and distribute public key.See http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven/ for details.
...
Install pgp
If you are a Mac user and have macports installed then simply install pgp with the command:
Inget format |
---|
sudo port install gnupg |
For Windows user download the GpG software http://www.gpg4win.org/ and install the application. You may need to restart the machine.
Create key-pair
Inget format |
---|
gpg --gen-key |
List keys
Inget format |
---|
gpg --list-keys
gpg --list-secret-keys |
Keys will be listed in the following format where the key id, nnnnnnnn, is the most important:
Inget format |
---|
pub mmmmm/nnnnnnnn date
uid name <email>
sub mmmmm/ssssssss date |
Distribute public key
Inget format |
---|
gpg --keyserver hkp://pgp.mit.edu --send-keys nnnnnnnn |
Define the default key
If you have only one private key then you can skip this step. If you have more than one private key you can define a default key by editing the configuration file:
Inget format |
---|
mate ~/.gnupg/gpg.conf |
And set the default-key option to your preferred default key:
...
<snapshot-nexus-url>https://nexus.inera.se/repository/SKLTP-Snapshots/</snapshot-nexus-url>
</properties>
</profile>
</profiles>
<servers>
<!-- Release Repot på Inera Nexus, exakt repo pekas ut av profilen -->
<server>
<id>release-nexus</id>
<username>xxxxxxxxx</username>
<password>pppppppppp</password>
</server>
<!-- Snapshot Repot på Inera Nexus, exakt repo pekas ut av profilen -->
<server>
<id>snapshot-nexus</id>
<username>xxxxxxxxx</username>
<password>pppppppppp</password>
</server>
</servers>
|
Normalt bör en release skapas via ett releasejobb i Ineras Jenkins server men går att skapa lokalt genom:
Kodblock |
---|
mvn release:prepare
mvn release:perform |
eller genom att manuellt uppdatera versioner, skapa taggar, pusha till github och köra:
Kodblock |
---|
mvn deploy |
Artifakterna kommer nu laddas upp på Ineras Nexus och vara publikt tillgängliga under group-id se.skltp
,.
Paketnamn
SKLTP komponenter
...
se.skltp.virtualservices.<tjänstedomän>, tex se.skltp.virtualservices.clinicalprocess.activityprescription.actoutcome.https://oss.sonatype.org/#profile;User Token