Skip to content

Commit 31e8752

Browse files
authored
feat(pre-flight-checks): enable pre-flight-checks in ee (#127)
## 📝 Description - Enables pre-flight checks in EE. - (for testing) Installs the agent controller with the necessary image (including Erlang, required by `when`) and modifies the pre-job hook to support running the init job, which installs required packages for the toolbox. Potentially, a long-term solution is described [here](renderedtext/project-tasks#2282). For more details, see: [project task](renderedtext/project-tasks#2274) ## ✅ Checklist - [x] I have tested this change. - [x] ~This change requires a documentation update~ – No changes to the Community Edition (CE) version.
1 parent 8649b22 commit 31e8752

File tree

6 files changed

+179
-1
lines changed

6 files changed

+179
-1
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ endif
7070

7171
DOCKER_BUILD_PATH=.
7272
EX_CATCH_WARRNINGS_FLAG=--warnings-as-errors
73-
CHECK_DEPS_EXTRA_OPTS?=-w feature_provider,grpc_health_check,tentacat,util,watchman,fun_registry,sentry_grpc,traceman,cacheman,log_tee,spec,proto,sys2app,looper,job_matrix,definition_validator,gofer_client,open_api_spex,when,uuid,esaml,openid_connect
73+
CHECK_DEPS_EXTRA_OPTS?=-w feature_provider,grpc_health_check,tentacat,util,watchman,fun_registry,sentry_grpc,traceman,cacheman,log_tee,spec,proto,sys2app,looper,job_matrix,definition_validator,gofer_client,open_api_spex,when,uuid,esaml,openid_connect,block
7474
ROOT_MAKEFILE_PATH := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
7575

7676
#

ephemeral_environment/scripts/install.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ args=(
4646
"global.edition=${SEMAPHORE_EDITION}"
4747
)
4848

49+
# if edition is ee, add arguments for agent to support pre-flight-checks
50+
cp resources/agent-pre-job-hook.sh agent-pre-job-hook.sh
51+
if [ "$SEMAPHORE_EDITION" = "ee" ]; then
52+
args+=(
53+
"--set"
54+
"controller.agent.defaultImage=hexpm/elixir:1.12.3-erlang-24.3.4.13-ubuntu-focal-20230126"
55+
"--set"
56+
"controller.agent.defaultPodSpec.preJobHook.customScript=$(cat agent-pre-job-hook.sh | base64 -w 0)"
57+
)
58+
fi
59+
4960
# Provider-specific base args
5061

5162
if [ "$CLOUD_TEST_ENVIRONMENT_TYPE" = "eks" ]; then
@@ -126,6 +137,7 @@ if [[ "$CLOUD_TEST_ENVIRONMENT_TYPE" == "single-vm" ]]; then
126137
"bitbucket-app-secret.yaml"
127138
"gitlab-app-secret.yaml"
128139
"vm-install.sh"
140+
"agent-pre-job-hook.sh"
129141
)
130142

131143
for file in "${files[@]}"; do
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
apt-get update
2+
apt-get install -y --no-install-recommends curl bash make git wget locales openssh-client
3+
4+
# Install the Semaphore toolbox in the job
5+
rm -rf ~/.toolbox
6+
7+
downloadPath="https://github.com/semaphoreci/toolbox/releases/latest/download/self-hosted-linux.tar"
8+
if [ ! -z "${SEMAPHORE_TOOLBOX_VERSION}" ]; then
9+
downloadPath="https://github.com/semaphoreci/toolbox/releases/download/$SEMAPHORE_TOOLBOX_VERSION/self-hosted-linux.tar"
10+
fi
11+
12+
echo "Downloading Semaphore toolbox from $downloadPath..."
13+
curl -sL --retry 5 --connect-timeout 3 $downloadPath -o /tmp/toolbox.tar
14+
tar -xvf /tmp/toolbox.tar
15+
mv toolbox ~/.toolbox
16+
if [ ! -d ~/.toolbox ]; then
17+
echo "Failed to download toolbox."
18+
return 1
19+
fi
20+
21+
echo "Installing..."
22+
bash ~/.toolbox/install-toolbox
23+
if [ "$?" -ne "0" ]; then
24+
echo "Failed to install toolbox."
25+
rm -rf $SEMAPHORE_GIT_DIR
26+
fi
27+
28+
source ~/.toolbox/toolbox
29+
if [ "$?" -ne "0" ]; then
30+
echo "Failed to source toolbox."
31+
rm -rf $SEMAPHORE_GIT_DIR
32+
fi
33+
34+
echo "Semaphore toolbox successfully installed."
35+
36+
# Create SSH configuration.
37+
# This is required to avoid manually accepting the Server SSH key fingerprints on checkout.
38+
mkdir -p ~/.ssh
39+
40+
#
41+
# Do it for GitHub for backwards compatibility
42+
#
43+
echo 'Host github.com' | tee -a ~/.ssh/config
44+
echo ' StrictHostKeyChecking no' | tee -a ~/.ssh/config
45+
echo ' UserKnownHostsFile=/dev/null' | tee -a ~/.ssh/config
46+
47+
#
48+
# Do it for currently used one
49+
#
50+
url="${SEMAPHORE_GIT_URL#ssh://}" # Remove the "ssh://" scheme if present
51+
url="${url#*@}" # Remove everything up to (and including) the '@' if present
52+
host="${url%%[:/]*}" # Now extract the host: it's the substring until the first occurrence of either ':' (port separator) or '/' (path separator)
53+
54+
echo "Host ${host}" | tee -a ~/.ssh/config
55+
echo ' StrictHostKeyChecking no' | tee -a ~/.ssh/config
56+
echo ' UserKnownHostsFile=/dev/null' | tee -a ~/.ssh/config

ephemeral_environment/scripts/vm-install.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ args=(
5959
"global.edition=${SEMAPHORE_EDITION}"
6060
)
6161

62+
# if edition is ee, add arguments for agent to support pre-flight-checks
63+
if [ "$SEMAPHORE_EDITION" = "ee" ]; then
64+
args+=(
65+
"--set"
66+
"controller.agent.defaultImage=hexpm/elixir:1.12.3-erlang-24.3.4.13-ubuntu-focal-20230126"
67+
"--set"
68+
"controller.agent.defaultPodSpec.preJobHook.customScript=$(cat agent-pre-job-hook.sh | base64 -w 0)"
69+
)
70+
fi
71+
6272
#
6373
# Generate diff of chart being applied
6474
#

helm-chart/templates/configmaps/features.yaml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ metadata:
44
name: features
55
namespace: {{ .Release.Namespace }}
66
data:
7+
{{- if eq .Values.global.edition "ce" }}
78
features.yml: |-
89
activity_monitor:
910
enabled: true
@@ -99,3 +100,100 @@ data:
99100
enabled: true
100101
new_project_onboarding:
101102
enabled: true
103+
{{- else }}
104+
features.yml: |-
105+
activity_monitor:
106+
enabled: true
107+
advanced_deployment_targets:
108+
enabled: false
109+
artifacts:
110+
enabled: true
111+
audit_logs:
112+
enabled: false
113+
audit_streaming:
114+
enabled: false
115+
badges:
116+
enabled: true
117+
billing:
118+
enabled: false
119+
bitbucket:
120+
enabled: true
121+
gitlab:
122+
enabled: true
123+
github_oauth_token:
124+
enabled: false
125+
deployment_targets:
126+
enabled: false
127+
expose_cloud_agent_types:
128+
enabled: false
129+
feedback:
130+
enabled: false
131+
help:
132+
enabled: false
133+
ip_allow_list:
134+
enabled: false
135+
just_run:
136+
enabled: true
137+
max_paralellism_in_org:
138+
quantity: 500
139+
max_people_in_organization:
140+
quantity: 600
141+
max_projects_in_org:
142+
quantity: 10000
143+
multiple_organizations:
144+
enabled: false
145+
okta:
146+
enabled: false
147+
open_id_connect:
148+
enabled: false
149+
open_id_connect_aws_tags:
150+
enabled: false
151+
organization_health:
152+
enabled: false
153+
parameterized_promotions:
154+
enabled: true
155+
permission_patrol:
156+
enabled: false
157+
pipeline_summaries:
158+
enabled: false
159+
pre_flight_checks:
160+
enabled: true
161+
project_level_roles:
162+
enabled: false
163+
project_level_secrets:
164+
enabled: true
165+
rbac__groups:
166+
enabled: false
167+
rbac__saml:
168+
enabled: false
169+
rbac__project_roles:
170+
enabled: false
171+
restrict_job_ssh_access:
172+
enabled: false
173+
scheduler_hook:
174+
enabled: true
175+
secrets_access_policy:
176+
enabled: false
177+
secrets_exposed_content:
178+
enabled: false
179+
self_hosted_agents:
180+
quantity: 1000
181+
superjerry_tests:
182+
enabled: false
183+
test_explorer:
184+
enabled: false
185+
test_results:
186+
enabled: false
187+
tmp_rbac_test:
188+
enabled: false
189+
toggle_skipped_blocks:
190+
enabled: true
191+
instance_git_integration:
192+
enabled: true
193+
get_started:
194+
enabled: true
195+
ui_agent_page:
196+
enabled: true
197+
new_project_onboarding:
198+
enabled: true
199+
{{- end }}

plumber/ppl/helm/templates/plumber-dpl.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,10 @@ spec:
4848
- configMapRef:
4949
name: {{ .Values.global.internalApi.configMapName }}
5050
env:
51+
{{- if eq .Values.global.edition "ce" }}
5152
- name: SKIP_PFC
5253
value: "true"
54+
{{- end }}
5355
- name: SKIP_PROMOTIONS
5456
value: "true"
5557
- name: REPO_PROXY_NEW_GRPC_URL

0 commit comments

Comments
 (0)