Skip to content

Commit

Permalink
aks build
Browse files Browse the repository at this point in the history
  • Loading branch information
ahjyrkia committed May 14, 2024
1 parent 86e9bfa commit c0aad1a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 11 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,23 @@ jobs:
name: hsldevcom/pulsar-mqtt-gateway
username: ${{ secrets.TRANSITDATA_DOCKERHUB_USER }}
password: ${{ secrets.TRANSITDATA_DOCKERHUB_TOKEN }}
tag_semver: true
tag_semver: true
build-aks-dev-docker-image:
needs: test
runs-on: ubuntu-latest
# Run only on aks-dev branch
if: github.ref == 'refs/heads/aks-dev'
steps:
- uses: actions/checkout@v2
- name: Download .jar file
uses: actions/download-artifact@v2
with:
name: pulsar-mqtt-gateway.jar
path: target
- name: Build and publish aks-dev Docker image
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: hsldevcom/pulsar-mqtt-gateway
username: ${{ secrets.TRANSITDATA_DOCKERHUB_USER }}
password: ${{ secrets.TRANSITDATA_DOCKERHUB_TOKEN }}
tags: aks-dev
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<common.version>1.3.29</common.version>
<common.version>1.5.4</common.version>
<paho.version>1.2.5</paho.version>
</properties>

Expand Down
15 changes: 6 additions & 9 deletions src/main/java/fi/hsl/pulsar/mqtt/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@ private static MqttConfig createSinkConfig(Config config) {

if (hasAuthentication) {
try {
//Default path is what works with Docker out-of-the-box. Override with a local file if needed
final String usernamePath = ConfigUtils.getEnv("FILEPATH_USERNAME_SECRET").orElse("/run/secrets/mqtt_broker_username");
log.debug("Reading username from " + usernamePath);
username = new Scanner(new File(usernamePath)).useDelimiter("\\Z").next();

final String passwordPath = ConfigUtils.getEnv("FILEPATH_PASSWORD_SECRET").orElse("/run/secrets/mqtt_broker_password");
log.debug("Reading password from " + passwordPath);
password = new Scanner(new File(passwordPath)).useDelimiter("\\Z").next();

username = System.getenv("MQTT_BROKER_USERNAME");
password = System.getenv("MQTT_BROKER_PASSWORD");
if (username == null || username.isEmpty() || password == null || password.isEmpty()) {
log.error("Failed to find credentials");
throw new IllegalArgumentException("Failed to find credentials");
}
} catch (Exception e) {
log.error("Failed to read secret files", e);
}
Expand Down

0 comments on commit c0aad1a

Please sign in to comment.