Skip to content

Commit

Permalink
Configurable Jenkins URL
Browse files Browse the repository at this point in the history
  • Loading branch information
lucko committed Jun 22, 2024
1 parent 01f7d7f commit 70171f0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/fetchers/jenkins/additional-plugins.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from 'axios';
import { jenkinsUrl } from './util';

export interface JenkinsAdditionalPluginsData {
additionalPlugins: Record<AdditionalPluginId, string>;
Expand All @@ -15,7 +16,7 @@ export async function fetchData(): Promise<JenkinsAdditionalPluginsData> {
}

async function fetchData0(id: string): Promise<string> {
const url = `https://ci.lucko.me/job/${id}/lastSuccessfulBuild/api/json?tree=url,artifacts[fileName,relativePath]`;
const url = `${jenkinsUrl}job/${id}/lastSuccessfulBuild/api/json?tree=url,artifacts[fileName,relativePath]`;
const resp = (await axios.get(url)).data;

const artifact = resp.artifacts[0];
Expand Down
5 changes: 3 additions & 2 deletions src/fetchers/jenkins/changelog.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from 'axios';
import { jenkinsUrl } from './util';

export interface JenkinsChangelogData {
changeLog: Array<JenkinsChangeData>;
Expand All @@ -11,8 +12,8 @@ export interface JenkinsChangeData {
commit: string;
}

const url =
'https://ci.lucko.me/job/LuckPerms/api/json?tree=builds[timestamp,result,artifacts[fileName],changeSet[items[msg,commitId]]]';
const url = jenkinsUrl +
'job/LuckPerms/api/json?tree=builds[timestamp,result,artifacts[fileName],changeSet[items[msg,commitId]]]';

export async function fetchData(): Promise<JenkinsChangelogData> {
const resp = (await axios.get(url)).data;
Expand Down
3 changes: 2 additions & 1 deletion src/fetchers/jenkins/extensions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import axios from 'axios';
import { jenkinsUrl } from './util';

export interface JenkinsExpansionsData {
extensions: Record<ExpansionId, string>;
Expand All @@ -20,7 +21,7 @@ export async function fetchData(): Promise<JenkinsExpansionsData> {
}

async function fetchData0(id: string): Promise<string> {
const url = `https://ci.lucko.me/job/${id}/lastSuccessfulBuild/api/json?tree=url,artifacts[fileName,relativePath]`;
const url = `${jenkinsUrl}job/${id}/lastSuccessfulBuild/api/json?tree=url,artifacts[fileName,relativePath]`;
const resp = (await axios.get(url)).data;

const artifact = resp.artifacts[0];
Expand Down
5 changes: 3 additions & 2 deletions src/fetchers/jenkins/latest.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import axios from 'axios';
import { jenkinsUrl } from './util';

export interface JenkinsLatestBuildData {
version: string;
versionTimestamp: string;
downloads: Record<string, string>;
}

const url =
'https://ci.lucko.me/job/LuckPerms/lastSuccessfulBuild/api/json?tree=id,timestamp,artifacts[fileName,relativePath]';
const url = jenkinsUrl +
'job/LuckPerms/lastSuccessfulBuild/api/json?tree=id,timestamp,artifacts[fileName,relativePath]';

export async function fetchData(): Promise<JenkinsLatestBuildData> {
const resp = (await axios.get(url)).data;
Expand Down
5 changes: 3 additions & 2 deletions src/fetchers/jenkins/placeholders.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import axios from 'axios';
import { jenkinsUrl } from './util';

export interface JenkinsPlaceholdersData {
placeholderExpansions: Record<string, string>;
}

const url =
'https://ci.lucko.me/job/LuckPermsPlaceholders/lastSuccessfulBuild/api/json?tree=url,artifacts[fileName,relativePath]';
const url = jenkinsUrl +
'job/LuckPermsPlaceholders/lastSuccessfulBuild/api/json?tree=url,artifacts[fileName,relativePath]';

export async function fetchData(): Promise<JenkinsPlaceholdersData> {
const resp = (await axios.get(url)).data;
Expand Down
2 changes: 2 additions & 0 deletions src/fetchers/jenkins/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const jenkinsUrl =
process.env.METADATA_API_JENKINS_URL || 'https://ci.lucko.me/';

0 comments on commit 70171f0

Please sign in to comment.