From ef72239ff81f020411887d40e3081f5d08beb23d Mon Sep 17 00:00:00 2001 From: TingluoHuang Date: Sat, 12 Sep 2020 23:40:47 -0400 Subject: [PATCH] c --- dashboard-admin.yaml | 18 --------------- prereq.yaml | 34 ++++++++++++++++++++++++++++ runners.yaml | 24 +++++++++++++++++++- src/Runner.Listener/JobDispatcher.cs | 6 ++--- src/Runner.Listener/SelfUpdater.cs | 2 +- 5 files changed, 61 insertions(+), 23 deletions(-) delete mode 100644 dashboard-admin.yaml create mode 100644 prereq.yaml diff --git a/dashboard-admin.yaml b/dashboard-admin.yaml deleted file mode 100644 index 048555393..000000000 --- a/dashboard-admin.yaml +++ /dev/null @@ -1,18 +0,0 @@ -apiVersion: v1 -kind: ServiceAccount -metadata: - name: admin-user - namespace: kubernetes-dashboard ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: admin-user -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: cluster-admin -subjects: -- kind: ServiceAccount - name: admin-user - namespace: kubernetes-dashboard \ No newline at end of file diff --git a/prereq.yaml b/prereq.yaml new file mode 100644 index 000000000..00f387cba --- /dev/null +++ b/prereq.yaml @@ -0,0 +1,34 @@ +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + namespace: default + name: pod-patcher +rules: +- apiGroups: [""] # "" indicates the core API group + resources: ["pods"] + verbs: ["get", "watch", "list", "patch"] + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + name: default-pod-patcher + namespace: default +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: pod-patcher +subjects: +- kind: ServiceAccount + name: default + namespace: default + +--- +apiVersion: v1 +kind: Secret +metadata: + name: githubtoken +type: Opaque +stringData: + GITHUB_PAT: "xxx" \ No newline at end of file diff --git a/runners.yaml b/runners.yaml index 5f1e9871b..543c6eb28 100644 --- a/runners.yaml +++ b/runners.yaml @@ -12,4 +12,26 @@ spec: template: spec: setupDockerInDocker: true - imagePullPolicy: Always \ No newline at end of file + imagePullPolicy: Always + runnerUpdateHandler: + containers: + - name: update-image + image: huangtingluo/workflow_dispatch:latest + imagePullPolicy: Always + env: + - name: GITHUB_TOKEN + valueFrom: + secretKeyRef: + name: githubtoken + key: GITHUB_PAT + - name: GITHUB_OWNER + value: tingluohuang + - name: GITHUB_REPO + value: "k8s-runner-image" + - name: GITHUB_EXTRA_CURL_ARG + value: "-v" + - name: GITHUB_WORKFLOW + value: "docker-publish.yml" + - name: GITHUB_WORKFLOW_INPUTS + value: "{\"runnerDownloadUrl\":\"https://github.com/TingluoHuang/runner/releases/download/test/actions-runner-linux-x64-2.299.0.tar.gz\"}" + restartPolicy: Never \ No newline at end of file diff --git a/src/Runner.Listener/JobDispatcher.cs b/src/Runner.Listener/JobDispatcher.cs index cad4b9fc3..10ba5d056 100644 --- a/src/Runner.Listener/JobDispatcher.cs +++ b/src/Runner.Listener/JobDispatcher.cs @@ -507,7 +507,7 @@ namespace GitHub.Runner.Listener await jobStartInvoker.ExecuteAsync( workingDirectory: HostContext.GetDirectory(WellKnownDirectory.Root), fileName: WhichUtil.Which("bash"), - arguments: $"-c \"{jobStartNotification}\" JOBSTART \"{DateTime.UtcNow.ToString("O")}\"", + arguments: $"-c \"{jobStartNotification} JOBSTART {DateTime.UtcNow.ToString("O")}\"", environment: null, requireExitCodeZero: true, outputEncoding: null, @@ -690,7 +690,7 @@ namespace GitHub.Runner.Listener await jobCompleteInvoker.ExecuteAsync( workingDirectory: HostContext.GetDirectory(WellKnownDirectory.Root), fileName: WhichUtil.Which("bash"), - arguments: $"-c \"{jobCompleteNotification}\" JOBCOMPLETE \"{DateTime.UtcNow.ToString("O")}\"", + arguments: $"-c \"{jobCompleteNotification} JOBCOMPLETE {DateTime.UtcNow.ToString("O")}\"", environment: null, requireExitCodeZero: true, outputEncoding: null, @@ -771,7 +771,7 @@ namespace GitHub.Runner.Listener await jobRunningInvoker.ExecuteAsync( workingDirectory: HostContext.GetDirectory(WellKnownDirectory.Root), fileName: WhichUtil.Which("bash"), - arguments: $"-c \"{jobRunningNotification}\" JOBRUNNING \"{DateTime.UtcNow.ToString("O")}\"", + arguments: $"-c \"{jobRunningNotification} JOBRUNNING {DateTime.UtcNow.ToString("O")}\"", environment: null, requireExitCodeZero: true, outputEncoding: null, diff --git a/src/Runner.Listener/SelfUpdater.cs b/src/Runner.Listener/SelfUpdater.cs index 7e7d1557f..23d87336e 100644 --- a/src/Runner.Listener/SelfUpdater.cs +++ b/src/Runner.Listener/SelfUpdater.cs @@ -89,7 +89,7 @@ namespace GitHub.Runner.Listener await runnerUpdateInvoker.ExecuteAsync( workingDirectory: HostContext.GetDirectory(WellKnownDirectory.Root), fileName: WhichUtil.Which("bash"), - arguments: $"-c \"{runnerUpdateNotification}\" RUNNERUPDATE \"{DateTime.UtcNow.ToString("O")}\"", + arguments: $"-c \"{runnerUpdateNotification} RUNNERUPDATE {DateTime.UtcNow.ToString("O")}\"", environment: null, requireExitCodeZero: true, outputEncoding: null,