Merge pull request #2149 from pikasTech/fix/pikaoa-pac-shared-bootstrap
Pipelines as Code CI / hwlab-web-probe-sentinel-nc01- Success
Pipelines as Code CI / platform-infra-gitea-nc01- Success
Pipelines as Code CI / unidesk-host- Success

fix(pac): secondary consumer 跳过共享 Repository 重复 apply
This commit is contained in:
Lyon
2026-07-15 15:01:42 +08:00
committed by GitHub
2 changed files with 7 additions and 1 deletions
@@ -345,7 +345,11 @@ apply_action() {
{ printf '%s' "$token"; printf '\0'; printf '%s' "$UNIDESK_PAC_WEBHOOK_SECRET"; } \
| pac_repository_secret_manifest \
| kubectl apply --server-side --force-conflicts --field-manager="$UNIDESK_PAC_FIELD_MANAGER-repository-secret" -f - >/dev/null
repository_manifest | kubectl apply --server-side --force-conflicts --field-manager="$UNIDESK_PAC_FIELD_MANAGER" -f - >/dev/null
if [ "${UNIDESK_PAC_REPOSITORY_APPLY:-1}" = "1" ]; then
repository_manifest | kubectl apply --server-side --force-conflicts --field-manager="$UNIDESK_PAC_FIELD_MANAGER" -f - >/dev/null
else
kubectl -n "$UNIDESK_PAC_TARGET_NAMESPACE" get repository.pipelinesascode.tekton.dev "$UNIDESK_PAC_REPOSITORY_NAME" >/dev/null
fi
argo_bootstrap=false
if [ -n "${UNIDESK_PAC_ARGO_BOOTSTRAP_MANIFEST_B64:-}" ]; then
if [ -n "${UNIDESK_PAC_ARGO_REPOSITORY_SECRET_NAME:-}" ]; then
@@ -1722,6 +1722,7 @@ function remoteScript(action: "apply" | "status" | "history" | "debug-step", pac
const admissionIdentity = pacAdmissionDesiredIdentity(target.id);
const rbacIdentity = pacConsumerRbacDesiredIdentity(target.id);
const consumerConfig = historyConsumerConfig(pac, consumer);
const repositoryOwner = pac.consumers.find((item) => item.repositoryRef === repository.id);
const env: Record<string, string> = {
UNIDESK_PAC_ACTION: action,
UNIDESK_PAC_EVALUATOR_B64: Buffer.from(readFileSync(evaluatorFile, "utf8"), "utf8").toString("base64"),
@@ -1743,6 +1744,7 @@ function remoteScript(action: "apply" | "status" | "history" | "debug-step", pac
UNIDESK_PAC_WEBHOOK_URL: webhookUrl,
UNIDESK_PAC_WEBHOOK_SECRET: secrets.webhookSecret,
UNIDESK_PAC_REPOSITORY_NAME: repository.name,
UNIDESK_PAC_REPOSITORY_APPLY: repositoryOwner?.id === consumer.id ? "1" : "0",
UNIDESK_PAC_REPOSITORY_URL: repository.url,
UNIDESK_PAC_SECRET_NAME: repository.secretName,
UNIDESK_PAC_TOKEN_KEY: repository.tokenKey,