Skip to content

Commit

Permalink
Remove axios dependency (#2294)
Browse files Browse the repository at this point in the history
* fix: downgrade Java version for Spring Boot

The newer version of Spring Boot does not work with Java 21

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* chore: replace axios with fetch()

* Removed dependency on axios by using standard node fetch() function.
* Fixed getLatestPlatform(): using the 'tag_name' property instead of the 'name' property.

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Revert "fix: downgrade Java version for Spring Boot"

This reverts commit fcfe65a.

* empyt: just trigger CI

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* chore: update setup-java action

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* fix: add missing description property

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* fix: set distroless for setup-java action

Signed-off-by: Matej Vašek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vašek <mvasek@redhat.com>
  • Loading branch information
matejvasek committed May 11, 2024
1 parent 527ef6c commit 6649579
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
1 change: 1 addition & 0 deletions .github/composite/go-setup/action.yaml
@@ -1,4 +1,5 @@
name: "Golang setup"
description: "Golang setup"

runs:
using: "composite"
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/update-quarkus-platform.yaml
Expand Up @@ -18,11 +18,12 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/setup-java@v1
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- name: Install NPM deps.
run: npm install axios xml2js octokit
run: npm install xml2js octokit
- name: Create PR
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/update-springboot-platform.yaml
Expand Up @@ -18,11 +18,12 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 18
- uses: actions/setup-java@v1
- uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- name: Install NPM deps.
run: npm install axios xml2js octokit yaml semver
run: npm install xml2js octokit yaml semver
- name: Create PR
env:
GITHUB_TOKEN: ${{ github.token }}
Expand Down
5 changes: 2 additions & 3 deletions hack/update-quarkus-platform.js
@@ -1,4 +1,3 @@
const axios = require('axios')
const xml2js = require('xml2js');
const {Octokit} = require("octokit");
const {readFile,writeFile} = require('fs/promises');
Expand All @@ -10,8 +9,8 @@ const octokit = new Octokit({auth: process.env.GITHUB_TOKEN});
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/')

const getLatestPlatform = async () => {
const resp = await axios.get("https://code.quarkus.io/api/platforms")
return resp.data.platforms[0].streams[0].releases[0].quarkusCoreVersion
const data = await (await fetch("https://code.quarkus.io/api/platforms")).json()
return data.platforms[0].streams[0].releases[0].quarkusCoreVersion
}

const prExists = async (pred) => {
Expand Down
8 changes: 4 additions & 4 deletions hack/update-springboot-platform.js
@@ -1,4 +1,3 @@
const axios = require('axios')
const xml2js = require('xml2js');
const yaml = require('yaml')
const semver = require('semver')
Expand All @@ -12,8 +11,8 @@ const octokit = new Octokit({auth: process.env.GITHUB_TOKEN});
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/')

const getLatestPlatform = async () => {
const resp = await axios.get("https://api.github.com/repos/spring-projects/spring-boot/releases/latest")
return (resp.data.draft === false) ? resp.data.name.replace(/[A-Za-z]/g, "") : null;
const data = await (await fetch("https://api.github.com/repos/spring-projects/spring-boot/releases/latest")).json()
return (data.draft === false) ? data.tag_name.replace(/[A-Za-z]/g, "") : null;
}

const prExists = async (pred) => {
Expand Down Expand Up @@ -94,7 +93,8 @@ const updatePlatformInPom = async (pomPath, newPlatform) => {

const getCompatibleSpringCloudVersion = async (newPlatform) => {
const bomUrl = "https://raw.githubusercontent.com/spring-io/start.spring.io/main/start-site/src/main/resources/application.yml"
const mappings = yaml.parseAllDocuments((await axios.get(bomUrl)).data)[0].toJS()
const data = await (await fetch(bomUrl)).text()
const mappings = yaml.parseAllDocuments(data)[0].toJS()
.initializr
.env
.boms['spring-cloud']
Expand Down

0 comments on commit 6649579

Please sign in to comment.