Skip to content

Commit e7e361d

Browse files
fix: attach runtime to agent when existing agent token is provided (#594)
1 parent 283004d commit e7e361d

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

charts/cf-runtime/Chart.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
description: A Helm chart for Codefresh Runner
33
name: cf-runtime
4-
version: 7.9.3
4+
version: 7.9.4
55
keywords:
66
- codefresh
77
- runner
@@ -17,10 +17,8 @@ annotations:
1717
artifacthub.io/containsSecurityUpdates: "true"
1818
# Supported kinds: `added`, `changed`, `deprecated`, `removed`, `fixed`, `security`:
1919
artifacthub.io/changes: |
20-
- kind: security
21-
description: "Bump venona with security fixes"
22-
- kind: security
23-
description: "Bump k8s-agent with security fixes"
20+
- kind: fixed
21+
description: "Attach runtime to agent when existing agent token is provided."
2422
dependencies:
2523
- name: cf-common
2624
repository: oci://quay.io/codefresh/charts

charts/cf-runtime/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Codefresh Runner
22

3-
![Version: 7.9.3](https://img.shields.io/badge/Version-7.9.3-informational?style=flat-square)
3+
![Version: 7.9.4](https://img.shields.io/badge/Version-7.9.4-informational?style=flat-square)
44

55
Helm chart for deploying [Codefresh Runner](https://codefresh.io/docs/docs/installation/codefresh-runner/) to Kubernetes.
66

charts/cf-runtime/files/init-runtime.sh

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,38 @@ EOF
3434

3535
}
3636

37+
create_auth_context() {
38+
codefresh auth create-context --api-key ${USER_CODEFRESH_TOKEN} --url ${API_HOST}
39+
}
40+
41+
attach_runtime() {
42+
(set -x; codefresh attach runtime \
43+
--runtime-name ${RUNTIME_NAME} \
44+
--agent-name ${AGENT_NAME} \
45+
--platform-only)
46+
}
47+
3748
OWNER_UID=$(kubectl get deploy ${OWNER_NAME} --namespace ${KUBE_NAMESPACE} -o jsonpath='{.metadata.uid}')
3849
echo "got owner uid: ${OWNER_UID}"
3950

4051
if [ ! -z "${AGENT_CODEFRESH_TOKEN}" ]; then
4152
echo "-----"
4253
echo "runtime and agent are already initialized"
4354
echo "-----"
55+
56+
create_auth_context
57+
attach_runtime
58+
4459
exit 0
4560
fi
4661

4762
if [ ! -z "${EXISTING_AGENT_CODEFRESH_TOKEN}" ]; then
4863
echo "using existing agentToken value"
4964
create_agent_secret $EXISTING_AGENT_CODEFRESH_TOKEN
65+
66+
create_auth_context
67+
attach_runtime
68+
5069
exit 0
5170
fi
5271

@@ -57,7 +76,7 @@ if [ -z "${USER_CODEFRESH_TOKEN}" ]; then
5776
exit 1
5877
fi
5978

60-
codefresh auth create-context --api-key ${USER_CODEFRESH_TOKEN} --url ${API_HOST}
79+
create_auth_context
6180

6281
# AGENT_TOKEN might be empty, in which case it will be returned by the call
6382
RES=$(codefresh install agent \

0 commit comments

Comments
 (0)