Push Kaniko artifacts via harbor-core for Harbor UI visibility.
Build and Deploy Platform / build-and-deploy (push) Failing after 12m36s
Build and Deploy Platform / build-and-deploy (push) Failing after 12m36s
Add REGISTRY_PUSH_URL config, route CI Kaniko to harbor-core, and document dual-host kaniko auth for core push plus registry base-image pull. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -124,11 +124,17 @@ export default () => ({
|
||||
},
|
||||
|
||||
registry: {
|
||||
/** In-cluster registry — Kaniko push and app image pull (same host). */
|
||||
/** Kaniko push target — harbor-core when set (Harbor UI metadata); else in-cluster registry. */
|
||||
url: process.env.REGISTRY_URL || 'registry.cloudhost-builds.svc.cluster.local:5000',
|
||||
pushUrl:
|
||||
process.env.REGISTRY_PUSH_URL ||
|
||||
process.env.REGISTRY_URL ||
|
||||
'registry.cloudhost-builds.svc.cluster.local:5000',
|
||||
/** Kubelet / workload pull (external hostname on Harbor setups). */
|
||||
pullUrl: process.env.REGISTRY_PULL_URL || process.env.REGISTRY_URL || 'registry.cloudhost-builds.svc.cluster.local:5000',
|
||||
username: process.env.REGISTRY_USERNAME || 'admin',
|
||||
password: process.env.REGISTRY_PASSWORD || '',
|
||||
harborCoreService: process.env.HARBOR_CORE_SERVICE || 'harbor-core',
|
||||
},
|
||||
|
||||
build: {
|
||||
|
||||
@@ -35,10 +35,11 @@ export class RegistryService {
|
||||
return slash === -1 ? url : url.slice(0, slash);
|
||||
}
|
||||
|
||||
/** Push target host[:port][/project] — Kaniko destination (may differ from pull URL on Harbor). */
|
||||
/** Push target host[:port][/project] — Kaniko via harbor-core when configured (Harbor UI metadata). */
|
||||
getRegistryPushUrl(): string {
|
||||
const buildNs = this.getBuildNamespace();
|
||||
const url =
|
||||
this.configService.get<string>('registry.pushUrl') ||
|
||||
this.configService.get<string>('registry.url') ||
|
||||
`registry.${buildNs}.svc.cluster.local:5000`;
|
||||
return url.replace(/^https?:\/\//, '');
|
||||
@@ -112,6 +113,12 @@ export class RegistryService {
|
||||
if (pushHost !== pullHost) {
|
||||
auths[pushHost] = { auth };
|
||||
}
|
||||
// Legacy direct-registry push host (base image pulls during Kaniko build).
|
||||
const directPushHost = this.configService.get<string>('registry.url')?.replace(/^https?:\/\//, '');
|
||||
const directHostOnly = directPushHost?.includes('/') ? directPushHost.slice(0, directPushHost.indexOf('/')) : directPushHost;
|
||||
if (directHostOnly && directHostOnly !== pushHost && directHostOnly !== pullHost) {
|
||||
auths[directHostOnly] = { auth };
|
||||
}
|
||||
return JSON.stringify({ auths });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user