Add java library jobs
Change-Id: I226a77ba336c074e57b61adf829237fefc94e9ea Depends-On: https://review.opendev.org/c/nebulous/zuul-jobs/+/896890
This commit is contained in:
parent
0283b71154
commit
14250a403a
23
playbooks/java-libraries/promote.yaml
Normal file
23
playbooks/java-libraries/promote.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
- hosts: all
|
||||
tasks:
|
||||
- name: Set Sonatype Username
|
||||
set_fact:
|
||||
sonatype_username: "{{ nebulous_nexus_repository_credentials.username }}"
|
||||
|
||||
- name: Set Sonatype Password
|
||||
set_fact:
|
||||
sonatype_password: "{{ nebulous_nexus_repository_credentials.password }}"
|
||||
|
||||
- name: Retrieve the Staging Repository ID
|
||||
shell: |
|
||||
response=$(curl -s -u "{{ sonatype_username }}:{{ sonatype_password }}" \
|
||||
"https://s01.oss.sonatype.org/service/local/staging/deployByRepositoryId/{{ sonatype_username }}")
|
||||
echo $response | jq -r '.data[].stagedRepositoryId' | tail -n 1
|
||||
register: result
|
||||
|
||||
- name: Release the staging repository
|
||||
shell: |
|
||||
curl -u "{{ sonatype_username }}:{{ sonatype_password }}" \
|
||||
-X POST https://s01.oss.sonatype.org/service/local/staging/profiles/your-profile-id/finish \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"data": {"stagedRepositoryId": "{{ result.stdout }}"}}'
|
9
playbooks/java-libraries/settings.xml.j2
Normal file
9
playbooks/java-libraries/settings.xml.j2
Normal file
@ -0,0 +1,9 @@
|
||||
<settings>
|
||||
<servers>
|
||||
<server>
|
||||
<id>ossrh</id>
|
||||
<username>{{ username }}</username>
|
||||
<password>{{ password }}</password>
|
||||
</server>
|
||||
</servers>
|
||||
</settings>
|
28
playbooks/java-libraries/upload.yaml
Normal file
28
playbooks/java-libraries/upload.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
- hosts: all
|
||||
roles:
|
||||
- install-jdk
|
||||
- install-maven
|
||||
tasks:
|
||||
- name: Ensure .m2 directory exists
|
||||
file:
|
||||
path: "{{ ansible_env.HOME }}/.m2"
|
||||
state: directory
|
||||
|
||||
- name: Template out settings.xml
|
||||
template:
|
||||
src: settings.xml.j2
|
||||
dest: "{{ ansible_env.HOME }}/.m2/settings.xml"
|
||||
vars:
|
||||
username: "{{ nebulous_nexus_repository_credentials.username }}"
|
||||
password: "{{ nebulous_nexus_repository_credentials.password }}"
|
||||
|
||||
- name: Deploy the artifact to OSSRH
|
||||
shell: |
|
||||
mvn deploy -DskipTests
|
||||
args:
|
||||
chdir: "{{ project_path }}" # Pointing to the directory with pom.xml
|
||||
vars:
|
||||
project_path: "{{ zuul.project.src_dir }}/{{ java_library_path }}"
|
||||
environment:
|
||||
MAVEN_HOME: "/opt/apache-maven-3.8.8"
|
||||
PATH: "{{ ansible_env.PATH }}:/opt/apache-maven-3.8.8/bin"
|
@ -24,3 +24,19 @@
|
||||
- name: container_registry_credentials
|
||||
secret: nebulous-container-registry-credentials
|
||||
pass-to-parent: true
|
||||
|
||||
- job:
|
||||
name: nebulous-upload-java-libraries
|
||||
run: playbooks/java-libraries/upload.yaml
|
||||
roles:
|
||||
- zuul: nebulous/zuul-jobs
|
||||
secrets:
|
||||
- name: nebulous_nexus_repository_credentials
|
||||
secret: nebulous-nexus-repository-credentials
|
||||
|
||||
- job:
|
||||
name: nebulous-promote-java-libraries
|
||||
run: playbooks/java-libraries/promote.yaml
|
||||
secrets:
|
||||
- name: nebulous_nexus_repository_credentials
|
||||
secret: nebulous-nexus-repository-credentials
|
||||
|
@ -25,3 +25,19 @@
|
||||
DekpJZQiv1onTsjCTrEJEIrKKEojLCO0XogqgrUEm20FxXBhSxYeYW14jCCG5PMhCVIcN
|
||||
kQMMbDLd/OehCRGeeVKIyUsimrN4CZdADvROIigoBuVS4B5se4A1Ih97TWnnFUqVLVJsd
|
||||
rG3rNBmNN84llWFYp8z6//AT10V8kVlNrEFTtu34O17eZpXm1z+OazD5yCbGl4=
|
||||
|
||||
- secret:
|
||||
name: nebulous-nexus-repository-credentials
|
||||
data:
|
||||
username: nebulousbot
|
||||
password: !encrypted/pkcs1-oaep
|
||||
- iiqYEHwz8KS07RnDDEt/yxbO/OUuwn7UqXgZoT97QvO3ueJL7Pyh2R1YvzecgIoUciyaL
|
||||
KZ5k6aTsTYUWEc9sroEfOJhc7VtxKaPJoZSMA/WWBa2Fmu8qsoDSffQiOyeEPhxzEZB9r
|
||||
46V1ptYoBo5Svp65fupmpNnG+bEMRhOIJmyun62zn3EpVSE1XWof/CJRS3NVYwkTBWnWC
|
||||
Xwp4cLW6GF2uyF/2eZpQhy0qbzgIHyqg7SG65Lq0XAUdwS9OBhDeho02Sfy7+gJyolAip
|
||||
lxrxs4o9RIMkUFtX19PfmhjFT9RxqvK0QFJ48mOaT0vXu7SRjUQ9ysHDISZl5UO/ee8UG
|
||||
oWeOW6XmG4WZLxantqCfmAhcVJD7xh6i7qgFzYgvisC/caNMdT8pNV2uXyP3xYFJjOG5s
|
||||
yhv/mp+zKs2kJlQL+dcjWABaiFhuij53bbopmoCacIsAewC1jKAyr1U3dmbtPvp9QlLUN
|
||||
E4ZedePTml5DEvK0xExsjPye+VqeLrwVxf5PMYL2l9yK0O0852iPHTDAdTfBAumXfXuqt
|
||||
5hXA7dM8lRNUoEImmH4FgEXFCU7rDwmiGUWoXsw3ZrL2bt+sevUSsnyM90yjsRvZktBQD
|
||||
UXQ4eZDyww9gu8YrFrTvgMsSwG0DP1eEuqzL9dod/XWx2hWofJkAoRyGsaxhPw=
|
||||
|
Loading…
x
Reference in New Issue
Block a user