Added app update storage URL to config and modified artifact mapping to use the new storage path in app update service.
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
This commit is contained in:
parent
779cb8cdf1
commit
afce36b30a
@ -18,7 +18,8 @@
|
||||
"urlElectronClient": "http://localhost:5780",
|
||||
"urlApi": "https://dev.tombutcher.work/api",
|
||||
"devAuthClient": "http://localhost:3500",
|
||||
"jenkinsProject": "https://ci.tombutcher.work/job/farmcontrol/job/farmcontrol-ui"
|
||||
"jenkinsProject": "https://ci.tombutcher.work/job/farmcontrol/job/farmcontrol-ui",
|
||||
"appUpdateStorage": "https://dist.farmcontrol.app/jenkins/farmcontrol/farmcontrol-ui"
|
||||
},
|
||||
"database": {
|
||||
"mongo": {
|
||||
@ -79,7 +80,8 @@
|
||||
"urlElectronClient": "http://localhost:5780",
|
||||
"urlApi": "http://localhost:8788/api",
|
||||
"devAuthClient": "http://localhost:3500",
|
||||
"jenkinsProject": "https://ci.tombutcher.work/job/farmcontrol/job/farmcontrol-ui"
|
||||
"jenkinsProject": "https://ci.tombutcher.work/job/farmcontrol/job/farmcontrol-ui",
|
||||
"appUpdateStorage": "https://dist.farmcontrol.app/jenkins/farmcontrol/farmcontrol-ui"
|
||||
},
|
||||
"database": {
|
||||
"mongo": {
|
||||
@ -138,7 +140,8 @@
|
||||
"urlElectronClient": "http://localhost:3000",
|
||||
"urlApi": "https://api.farmcontrol.app",
|
||||
"devAuthClient": "http://localhost:3500",
|
||||
"jenkinsProject": "https://ci.tombutcher.work/job/farmcontrol/job/farmcontrol-ui"
|
||||
"jenkinsProject": "https://ci.tombutcher.work/job/farmcontrol/job/farmcontrol-ui",
|
||||
"appUpdateStorage": "https://dist.farmcontrol.app/jenkins/farmcontrol/farmcontrol-ui"
|
||||
},
|
||||
"database": {
|
||||
"mongo": {
|
||||
|
||||
@ -21,14 +21,14 @@ const buildApiUrl = (baseUrl, query = '') => {
|
||||
const getBranchBuildApiUrl = (branchUrl, buildType = 'lastSuccessfulBuild') =>
|
||||
`${normalizeProjectUrl(branchUrl)}/${buildType}/api/json?tree=number,url,result,timestamp,artifacts[fileName,relativePath]`;
|
||||
|
||||
const mapArtifacts = (build) => {
|
||||
const mapArtifacts = (build, requestedBranch) => {
|
||||
const buildUrl = normalizeProjectUrl(build?.url);
|
||||
const artifacts = Array.isArray(build?.artifacts) ? build.artifacts : [];
|
||||
console.log(artifacts);
|
||||
return artifacts.map((artifact) => ({
|
||||
fileName: artifact.fileName,
|
||||
relativePath: artifact.relativePath,
|
||||
url: `${buildUrl}/artifact/${artifact.relativePath}`,
|
||||
url: `${config.app.appUpdateStorage}/${requestedBranch}/${build.number}/artifacts/${artifact.relativePath}`,
|
||||
}));
|
||||
};
|
||||
|
||||
@ -111,7 +111,7 @@ export const appUpdateCurrentRouteHandler = async (req, res) => {
|
||||
buildResult: build.result,
|
||||
buildTimestamp: build.timestamp,
|
||||
buildSource: source,
|
||||
artifacts: mapArtifacts(build),
|
||||
artifacts: mapArtifacts(build, requestedBranch),
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error('Failed to fetch Jenkins build info:', error);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user