Skip to content

Commit 616eb89

Browse files
authored
Release automation (#251)
1 parent 07ea538 commit 616eb89

File tree

11 files changed

+118
-14
lines changed

11 files changed

+118
-14
lines changed

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
7+
env:
8+
REGISTRY: ghcr.io
9+
BASE_IMAGE_NAME: ghcr.io/oracle/weblogic-monitoring-exporter
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: "Set environmental variables"
17+
run: |
18+
VERSION=${GITHUB_REF_NAME#v}
19+
echo "VERSION=$VERSION" >> $GITHUB_ENV
20+
echo "IMAGE_NAME=${{ env.REGISTRY }}/${{ env.BASE_IMAGE_NAME }}:$VERSION" >> $GITHUB_ENV
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
24+
- name: Set up JDK
25+
uses: actions/setup-java@v3
26+
with:
27+
distribution: 'temurin'
28+
java-version: 17
29+
- name: Cache Maven packages
30+
uses: actions/cache@v3
31+
with:
32+
path: ~/.m2
33+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
34+
restore-keys: ${{ runner.os }}-m2
35+
- name: Build
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.ECNJ_GITHUB_TOKEN }} # Needed to get PR information, if any
38+
run: mvn clean package -Dtag=${{ env.VERSION }}
39+
40+
- name: Create Draft Release
41+
id: draft-release
42+
run: |
43+
echo 'PR_URL<<EOF' >> $GITHUB_ENV
44+
gh release create ${{ env.VERSION }}\
45+
--draft \
46+
--generate-notes \
47+
--title 'WebLogic Monitoring Exporter ${{ env.VERSION }}' \
48+
--repo https://github.com/oracle/weblogic-monitoring-exporter \
49+
wls-exporter-war/target/wls-exporter.war wls-exporter-war/target/classes/get_v${{ env.VERSION }}.sh
50+
echo 'EOF' >> $GITHUB_ENV
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Log in to the Container registry
55+
uses: docker/login-action@v2
56+
with:
57+
registry: ${{ env.REGISTRY }}
58+
username: ${{ github.actor }}
59+
password: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Build and push Docker image
62+
uses: docker/build-push-action@v3
63+
with:
64+
context: .
65+
push: true
66+
tags: ${{ env.IMAGE_NAME }}

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# WebLogic Monitoring Exporter
22

3-
[![Build Status](https://travis-ci.org/oracle/weblogic-monitoring-exporter.svg?branch=master)](https://travis-ci.org/oracle/weblogic-monitoring-exporter)
4-
53
The WebLogic Monitoring Exporter is a [Prometheus](http://prometheus.io)-compatible exporter of metrics from
64
WebLogic Server (WLS) instances, which it obtains by using the
75
[WLS RESTful Management API](https://docs.oracle.com/middleware/12213/wls/WLRUR/overview.htm#WLRUR111), available in version 12.2.1 or later.

build-helper-mojo/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<parent>
1010
<artifactId>wls-exporter-parent</artifactId>
1111
<groupId>com.oracle.wls.exporter</groupId>
12-
<version>2.1.0</version>
12+
<version>2.1.0-SNAPSHOT</version>
1313
</parent>
1414

1515
<artifactId>build-helper-mojo</artifactId>

pom.xml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77

88
<groupId>com.oracle.wls.exporter</groupId>
99
<artifactId>wls-exporter-parent</artifactId>
10-
<version>2.1.0</version>
10+
<version>2.1.0-SNAPSHOT</version>
1111
<modules>
12+
<module>build-helper-mojo</module>
1213
<module>wls-exporter-core</module>
1314
</modules>
1415
<packaging>pom</packaging>
@@ -85,7 +86,9 @@
8586
<requireJavaVersion>
8687
<version>${java.version.range}</version>
8788
</requireJavaVersion>
88-
<requirePluginVersions></requirePluginVersions>
89+
<requirePluginVersions>
90+
<unCheckedPluginList>com.oracle.wls.exporter:build-helper-mojo</unCheckedPluginList>
91+
</requirePluginVersions>
8992
</rules>
9093
</configuration>
9194
</execution>

wls-exporter-core/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<artifactId>wls-exporter-parent</artifactId>
1010
<groupId>com.oracle.wls.exporter</groupId>
11-
<version>2.1.0</version>
11+
<version>2.1.0-SNAPSHOT</version>
1212
</parent>
1313

1414
<artifactId>wls-exporter-core</artifactId>

wls-exporter-core/src/main/java/com/oracle/wls/exporter/domain/ExporterConfig.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import com.google.gson.JsonObject;
1717
import org.yaml.snakeyaml.Yaml;
18-
import org.yaml.snakeyaml.constructor.SafeConstructor;
1918
import org.yaml.snakeyaml.scanner.ScannerException;
2019

2120
/**
@@ -62,7 +61,7 @@ public static ExporterConfig createEmptyConfig() {
6261
*/
6362
public static ExporterConfig loadConfig(InputStream inputStream) {
6463
try {
65-
return loadConfig(asMap(new Yaml(new SafeConstructor()).load(inputStream)));
64+
return loadConfig(asMap(new Yaml().load(inputStream)));
6665
} catch (ScannerException e) {
6766
throw new YamlParserException(e);
6867
}

wls-exporter-sidecar/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.oracle.wls.exporter</groupId>
1010
<artifactId>wls-exporter-parent</artifactId>
11-
<version>2.1.0</version>
11+
<version>2.1.0-SNAPSHOT</version>
1212
</parent>
1313
<artifactId>wls-exporter-sidecar</artifactId>
1414
<name>WebLogic Monitoring Exporter Sidecar</name>

wls-exporter-sidecar/src/main/java/com/oracle/wls/exporter/sidecar/Main.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static void main(String[] args) {
1919
final MetricsService metricsService = new MetricsService(configuration, new WebClientFactoryImpl());
2020

2121
WebServer.builder()
22-
.routing(Routing.builder().register(metricsService).build())
22+
.addRouting(Routing.builder().register(metricsService).build())
2323
.port(metricsService.getListenPort())
2424
.build()
2525
.start()

wls-exporter-war/pom.xml

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<artifactId>wls-exporter-parent</artifactId>
99
<groupId>com.oracle.wls.exporter</groupId>
10-
<version>2.1.0</version>
10+
<version>2.1.0-SNAPSHOT</version>
1111
</parent>
1212
<modelVersion>4.0.0</modelVersion>
1313

@@ -117,6 +117,44 @@
117117
</plugins>
118118
</build>
119119
</profile>
120+
121+
<profile>
122+
<id>github-release</id>
123+
<activation>
124+
<property>
125+
<name>tag</name>
126+
</property>
127+
</activation>
128+
<build>
129+
<finalName>wls-exporter</finalName>
130+
<resources>
131+
<resource>
132+
<directory>src/main/resources</directory>
133+
<filtering>true</filtering>
134+
</resource>
135+
</resources>
136+
<plugins>
137+
<plugin>
138+
<groupId>com.coderplus.maven.plugins</groupId>
139+
<artifactId>copy-rename-maven-plugin</artifactId>
140+
<version>1.0.1</version>
141+
<executions>
142+
<execution>
143+
<id>rename-file</id>
144+
<phase>compile</phase>
145+
<goals>
146+
<goal>rename</goal>
147+
</goals>
148+
<configuration>
149+
<sourceFile>${project.build.outputDirectory}/get.sh</sourceFile>
150+
<destinationFile>${project.build.outputDirectory}/get_v${tag}.sh</destinationFile>
151+
</configuration>
152+
</execution>
153+
</executions>
154+
</plugin>
155+
</plugins>
156+
</build>
157+
</profile>
120158
</profiles>
121159

122160
</project>

get2.0.sh renamed to wls-exporter-war/src/main/resources/get.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Copyright (c) 2021, 2022, Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
44

5-
curl -L -O https://github.com/oracle/weblogic-monitoring-exporter/releases/download/v${version}/wls-exporter.war
5+
curl -L -O https://github.com/oracle/weblogic-monitoring-exporter/releases/download/${tag}/wls-exporter.war
66

77
if [ ! -z "$1" ]; then
88
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)

0 commit comments

Comments
 (0)