Skip to content

Commit

Permalink
Merge pull request #7 from Conjur-Enterprise/update-for-artifact-release
Browse files Browse the repository at this point in the history
CNJR-1404: Add artifact release and promotion capabilities to build
  • Loading branch information
ismarc authored and GitHub Enterprise committed Jan 19, 2024
2 parents cb43006 + 00d61cd commit 2d267e2
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.0.1] - 2024-01-19
- Add release and promotion capabilities

## [1.0.0] - 2024-01-12

Expand Down
18 changes: 15 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,21 @@ if (params.MODE == "PROMOTE") {

//Note: assetDirectory is on the infrapool agent, not the local Jenkins agent.
// Pass assetDirectory through to publish.sh as an env var.

env.ASSET_DIR=assetDirectory

infrapool.agentSh """
set -xuo pipefail
git checkout "v${sourceVersion}"
echo -n "${targetVersion}" > VERSION
cp VERSION VERSION.original
./build_tool_image.sh
./build_package.sh
summon ./publish.sh
cp target/*.jar "${assetDirectory}"
"""
}

release.copyEnterpriseRelease(params.VERSION_TO_PROMOTE)
return
}

Expand Down Expand Up @@ -139,8 +152,7 @@ pipeline {
release(infrapool, { billOfMaterialsDirectory, assetDirectory ->
// Publish release artifacts to all the appropriate locations
// Copy any artifacts to assetDirectory to attach them to the Github release
infrapool.agentSh "mkdir -p target; cp target/*.jar ${assetDirectory}"
//INFRAPOOL_EXECUTORV2_AGENT_0.agentSh "ASSET_DIR=\"${assetDirectory}\" summon ./publish.sh"
infrapool.agentSh "ASSET_DIR=\"${assetDirectory}\" summon ./publish.sh"
})
}
}
Expand Down
82 changes: 82 additions & 0 deletions mvn-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<settings>
<pluginGroups>
<pluginGroup>org.jenkins-ci.tools</pluginGroup>
</pluginGroups>
<servers>
<server>
<id>conjurinc-releases</id>
<username>${env.JFROG_USERNAME}</username>
<password>${env.JFROG_APIKEY}</password>
</server>
<server>
<id>conjurinc-snapshots</id>
<username>${env.JFROG_USERNAME}</username>
<password>${env.JFROG_APIKEY}</password>
</server>
<server>
<id>ossrh</id>
<username>${env.OSSRH_USERNAME}</username>
<password>${env.OSSRH_PASSWORD}</password>
</server>
</servers>
<profiles>
<profile>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>conjurinc-releases</id>
<name>conjurinc-releases</name>
<url>https://conjurinc.jfrog.io/artifactory/libs-release-local</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>conjurinc-snapshots</id>
<name>conjurinc-snapshots</name>
<url>https://conjurinc.jfrog.io/artifactory/libs-snapshot-local</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>plugins-release</id>
<name>plugins-release</name>
<url>https://conjurinc.jfrog.io/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshots</name>
<url>https://conjurinc.jfrog.io/artifactory/plugins-snapshot</url>
</pluginRepository>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
131 changes: 122 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.cyberark.conjur</groupId>
<artifactId>conjur-mule-connector</artifactId>
<version>0.0.1</version>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<!-- <packaging> value should be pom instead of mule-extension while deploying
to the exchange or cloudhub -->
Expand All @@ -14,6 +14,110 @@
<description />
<!-- <parent> <groupId>org.mule.extensions</groupId> <artifactId>mule-modules-parent</artifactId>
<version>1.1.3</version> </parent> -->
<profiles>
<!-- Profile for activating Artifactory as our deployment goal -->
<profile>
<id>artifactory</id>
<distributionManagement>
<repository>
<id>conjurinc-releases</id>
<name>conjurinc-releases</name>
<url>https://conjurinc.jfrog.io/artifactory/libs-release-local</url>
</repository>
<snapshotRepository>
<id>conjurinc-snapshots</id>
<name>conjurinc-snapshots</name>
<url>https://conjurinc.jfrog.io/artifactory/libs-snapshot-local</url>
</snapshotRepository>
</distributionManagement>
</profile>
<!-- Profile for deploying and releasing to Maven Central through OSSRH -->
<profile>
<id>ossrh</id>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- Profile for signing releases -->
<profile>
<id>sign</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- This is necessary for gpg to not try to use the pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
<arg>--passphrase-file</arg>
<arg>/gpg_password</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<properties>


Expand Down Expand Up @@ -60,7 +164,7 @@
<version>3.11.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
Expand Down Expand Up @@ -96,8 +200,6 @@
<!-- https://mvnrepository.com/artifact/io.snyk/snyk-maven-plugin -->




</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -152,7 +254,7 @@
</execution>
</executions>
</plugin>

</plugins>
</build>

Expand Down Expand Up @@ -210,7 +312,18 @@
<url>https://repository.mulesoft.org/nexus/content/repositories/public/</url>
</pluginRepository>
</pluginRepositories>
<!-- <distributionManagement> <repository> <id>anypoint-exchange-v3</id>
<name>Anypoint Exchange</name> <url>https://maven.anypoint.mulesoft.com/api/v3/organizations/<orgainzationID>/maven
</url> <layout>default</layout> </repository> </distributionManagement> -->
</project>
<distributionManagement>
<snapshotRepository>
<id>conjurinc-snapshots</id>
<name>conjurinc-snapshots</name>
<url>https://conjurinc.jfrog.io/artifactory/libs-snapshot-local</url>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
<repository>
<id>conjurinc-releases</id>
<name>conjurinc-releases</name>
<url>https://conjurinc.jfrog.io/artifactory/libs-release-local</url>
<uniqueVersion>false</uniqueVersion>
</repository>
</distributionManagement>
</project>
Empty file modified publish.sh
100644 → 100755
Empty file.
14 changes: 13 additions & 1 deletion secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@ ADMIN_USERNAME: !var ci/integration-factory/conjur-cloud/admin-username
USER_NAME: !var ci/integration-factory/conjur-cloud/user-name
USER_PASSWORD: !var ci/integration-factory/conjur-cloud/user-password
CONJUR_CLOUD_URL: !var ci/integration-factory/conjur-cloud/url
CONJUR_ACCOUNT: !var ci/integration-factory/conjur-cloud/account
CONJUR_ACCOUNT: !var ci/integration-factory/conjur-cloud/account


JFROG_CLI_OFFER_CONFIG: "false"
JFROG_URL: "https://conjurinc.jfrog.io/artifactory/"
JFROG_USERNAME: !var ci/artifactory/users/jenkins/username
JFROG_APIKEY: !var ci/artifactory/users/jenkins/password
JFROG_REPO: "libs-snapshot-local"

OSSRH_USERNAME: !var ecosystems/java/ossrh/username
OSSRH_PASSWORD: !var ecosystems/java/ossrh/password
GPG_PRIVATE_KEY: !var:file ecosystems/java/gpg/private-key
GPG_PASSWORD: !var:file ecosystems/java/gpg/password

0 comments on commit 2d267e2

Please sign in to comment.