Skip to content

Commit 039916a

Browse files
authored
Merge pull request #4307 from flatcar/chewi/no-dot-env
Drop the .sdkenv and .env files by passing env vars with Docker
2 parents 928d7d8 + 3f7e4eb commit 039916a

30 files changed

Lines changed: 186 additions & 364 deletions

‎.github/workflows/run-kola-tests.yaml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ jobs:
182182
183183
PARALLEL_ARCH=5
184184
185-
cat > sdk_container/.env <<EOF
186185
# export the QEMU_IMAGE_NAME to avoid to download it.
187186
export QEMU_IMAGE_NAME="/work/flatcar_production_image.bin"
188187
export QEMU_UEFI_FIRMWARE="/work/flatcar_production_qemu_uefi_efi_code.qcow2"
@@ -194,7 +193,6 @@ jobs:
194193
# The runner uses lxc containers for kola, and can't use loopback devices to
195194
# prepare the serial console setting - this means that kola may miss some errors
196195
export QEMU_KOLA_SKIP_MANGLE=true
197-
EOF
198196
199197
export MAX_RETRIES=5
200198
export SKIP_COPY_TO_BINCACHE=1

‎.gitignore‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
# Flatcar SDK tarballs
1313
*.tar.bz2
1414

15-
# SDK container env passing helpers
16-
sdk_container/.env
17-
sdk_container/.sdkenv
15+
# SDK container files
1816
ci-cleanup.sh
1917

2018
# build cache / artefacts directories

‎build_packages‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ if [[ "${FLAGS_usepkgonly}" -eq "${FLAGS_FALSE}" ]]; then
276276
# dropping USE=pam from sys-apps/systemd requires dropping
277277
# USE=systemd from sys-auth/pambase
278278
# sys-auth/pambase[sssd] -> sys-auth/sssd -> sys-apps/shadow[pam] -> sys-auth/pambase
279-
break_dep_loop sys-apps/util-linux cryptsetup,pam,systemd,udev \
279+
break_dep_loop sys-apps/util-linux cryptsetup,pam,su,systemd,udev \
280280
sys-fs/cryptsetup udev \
281281
sys-fs/lvm2 systemd,udev \
282282
sys-apps/systemd audit,cryptsetup,pam,selinux,tpm \

‎build_sdk_container_image‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ else
229229
docker_build -t "${sdk_build_image}" \
230230
--build-arg VERSION="${docker_vernum}" \
231231
--build-arg BINHOST="http://${binhost}" \
232-
--build-arg OFFICIAL="${official}" \
232+
--build-arg COREOS_OFFICIAL="${official}" \
233233
-f sdk_lib/Dockerfile.sdk-build \
234234
.
235235

‎changelog/changes/2026-10-02-su.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Switched from shadow's su implementation to util-linux's, as the former is deprecated upstream.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- SDK: The .env and .sdkenv files are no longer used to pass environment variables into the SDK container as this is insecure. Use run_sdk_container's new -e option instead.

‎ci-automation/ci-config.env‎

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,6 @@ CONTAINER_IMAGE_ROOT="/home/sdk/trunk/src/build/images"
4040

4141
# NOTE that these settings are evaluated by the vendor-tests script inside the
4242
# SDK container. To override, new values must be passed into the container.
43-
# Use something like
44-
# echo "export [VAR]=\"${[VALUE]}\\"" > sdk_container/.env
45-
# in your CI to override, e.g.
46-
# echo "export PARALLEL_TESTS=\"5\"" > sdk_container/.env
47-
# to override the number of test cases to be run in parallel.
4843

4944
# -- General --
5045

@@ -81,10 +76,6 @@ QEMU_DEVCONTAINER_URL="${QEMU_DEVCONTAINER_URL:-}"
8176
QEMU_DEVCONTAINER_BINHOST_URL="${QEMU_DEVCONTAINER_BINHOST_URL:-}"
8277
QEMU_DEVCONTAINER_FILE="${QEMU_DEVCONTAINER_FILE:-}"
8378

84-
# -- PXE --
85-
PXE_KERNEL_NAME="flatcar_production_pxe.vmlinuz"
86-
PXE_IMAGE_NAME="flatcar_production_pxe_image.cpio.gz"
87-
8879
GCE_IMAGE_NAME="flatcar_production_gce.tar.gz"
8980
GCE_GCS_IMAGE_UPLOAD="gs://flatcar-jenkins/developer/gce-ci"
9081
GCE_MACHINE_TYPE="${GCE_MACHINE_TYPE:-n1-standard-2}"
@@ -99,13 +90,13 @@ GCE_PARALLEL="${PARALLEL_TESTS:-4}"
9990
: ${DIGITALOCEAN_MACHINE_SIZE:='s-2vcpu-2gb'}
10091
DIGITALOCEAN_PARALLEL="${PARALLEL_TESTS:-8}"
10192
# DIGITALOCEAN_TOKEN_JSON env var is used for credentials, and should
102-
# come from sdk_container/.env. It must be base64-encoded.
93+
# come from the caller. It must be base64-encoded.
10394

10495
# -- VMware ESX --
10596

10697
: ${VMWARE_ESX_IMAGE_NAME:='flatcar_production_vmware_ova.ova'}
10798
VMWARE_ESX_PARALLEL="${PARALLEL_TESTS:-4}"
108-
# VMWARE_ESX_CREDS should come from sdk_container/.env and must be
99+
# VMWARE_ESX_CREDS should come from the caller and must be
109100
# base64-encoded.
110101

111102
# -- AWS --
@@ -122,8 +113,7 @@ VMWARE_ESX_PARALLEL="${PARALLEL_TESTS:-4}"
122113
: ${AWS_REGION:="us-east-1"}
123114
: ${AWS_AMI_ID:=""}
124115
AWS_PARALLEL="${PARALLEL_TESTS:-8}"
125-
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY should come from
126-
# sdk_container/.env
116+
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY should come from the caller.
127117

128118
# -- Azure --
129119
: ${AZURE_IMAGE_NAME:="flatcar_production_azure_image.vhd"}
@@ -132,7 +122,6 @@ AWS_PARALLEL="${PARALLEL_TESTS:-8}"
132122
: ${AZURE_USE_GALLERY:=""}
133123
: ${AZURE_KOLA_VNET:=""}
134124
: ${AZURE_USE_PRIVATE_IPS:=true}
135-
: ${AZURE_VNET_SUBNET_NAME:="jenkins-vnet-westeurope"}
136125
AZURE_PARALLEL="${PARALLEL_TESTS:-20}"
137126
AZURE_LOCATION="${AZURE_LOCATION:-westeurope}"
138127

‎ci-automation/garbage_collect.sh‎

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -255,21 +255,7 @@ function _garbage_collect_impl() {
255255

256256
local mantle_ref
257257
mantle_ref=$(cat sdk_container/.repo/manifests/mantle-container)
258-
docker run --pull always --rm --net host \
259-
--env AWS_ACCESS_KEY_ID --env AWS_SECRET_ACCESS_KEY \
260-
--env AWS_CREDENTIALS \
261-
--env DIGITALOCEAN_TOKEN_JSON \
262-
--env GCP_JSON_KEY \
263-
--env VMWARE_ESX_CREDS \
264-
--env BRIGHTBOX_CLIENT_ID --env BRIGHTBOX_CLIENT_SECRET \
265-
--env AKAMAI_TOKEN \
266-
--env STACKIT_SERVICE_ACCOUNT \
267-
--env STACKIT_PROJECT_ID \
268-
--env ORACLECLOUD_TENANCY \
269-
--env ORACLECLOUD_USER \
270-
--env ORACLECLOUD_FINGERPRINT \
271-
--env ORACLECLOUD_PRIVATE_KEY \
272-
--env ORACLECLOUD_COMPARTMENT_ID \
258+
docker run --pull always --rm --net host --env-file="sdk_lib/env_mantle.txt" \
273259
-w /work -v "$PWD":/work "${mantle_ref}" /work/ci-automation/garbage_collect_cloud.sh
274260

275261
echo

‎ci-automation/garbage_collect_cloud.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
set -euo pipefail
33
source ci-automation/ci_automation_common.sh
44
timeout --signal=SIGQUIT 60m ore aws gc --access-id "${AWS_ACCESS_KEY_ID}" --secret-key "${AWS_SECRET_ACCESS_KEY}"
5-
timeout --signal=SIGQUIT 60m ore gcloud gc --json-key <(echo "${GCP_JSON_KEY}" | base64 --decode)
5+
timeout --signal=SIGQUIT 60m ore gcloud gc --json-key <(base64 --decode <<< "${GCP_JSON_KEY}")
66
timeout --signal=SIGQUIT 60m ore azure gc --duration 6h
77
timeout --signal=SIGQUIT 60m ore brightbox gc --duration 6h \
88
--brightbox-client-id="${BRIGHTBOX_CLIENT_ID}" --brightbox-client-secret="${BRIGHTBOX_CLIENT_SECRET}"
99
timeout --signal=SIGQUIT 60m ore akamai gc --duration 6h \
1010
--akamai-token="${AKAMAI_TOKEN}"
1111
timeout --signal=SIGQUIT 60m ore stackit gc --duration 6h \
12-
--stackit-service-account-key-path=<(echo "${STACKIT_SERVICE_ACCOUNT}" | base64 --decode) \
12+
--stackit-service-account-key-path=<(base64 --decode <<< "${STACKIT_SERVICE_ACCOUNT}") \
1313
--stackit-project-id="${STACKIT_PROJECT_ID}"
1414
secret_to_file aws_credentials_config_file "${AWS_CREDENTIALS}"
1515
for channel in alpha beta stable lts; do
@@ -29,5 +29,5 @@ timeout --signal=SIGQUIT 60m ore oraclecloud gc --duration 6h \
2929
--oraclecloud-tenancy="${ORACLECLOUD_TENANCY}" \
3030
--oraclecloud-user="${ORACLECLOUD_USER}" \
3131
--oraclecloud-fingerprint="${ORACLECLOUD_FINGERPRINT}" \
32-
--oraclecloud-private-key="$(echo "${ORACLECLOUD_PRIVATE_KEY}" | base64 --decode)" \
32+
--oraclecloud-private-key="$(base64 --decode <<< "${ORACLECLOUD_PRIVATE_KEY}")" \
3333
--oraclecloud-compartment-id="${ORACLECLOUD_COMPARTMENT_ID}"

‎ci-automation/release.sh‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ function _inside_mantle() {
7575
source sdk_lib/sdk_container_common.sh
7676
source ci-automation/ci_automation_common.sh
7777
source sdk_container/.repo/manifests/version.txt
78-
# Needed because we are not the SDK container here
79-
source sdk_container/.env
8078
CHANNEL="$(get_git_channel)"
8179
VERSION="${FLATCAR_VERSION}"
8280
aws_credentials_config_file=""
@@ -240,8 +238,6 @@ function _release_build_impl() {
240238
source ci-automation/gpg_setup.sh
241239

242240
source sdk_container/.repo/manifests/version.txt
243-
# Needed because we are not the SDK container here
244-
source sdk_container/.env
245241
local sdk_version="${FLATCAR_SDK_VERSION}"
246242
local docker_sdk_vernum=""
247243
docker_sdk_vernum="$(vernum_to_docker_image_version "${sdk_version}")"
@@ -257,9 +253,9 @@ function _release_build_impl() {
257253
# A job on each worker prunes old mantle images (docker image prune), no need to do it here
258254
echo "docker rm -f '${container_name}'" >> ./ci-cleanup.sh
259255

260-
touch sdk_container/.env # This file should already contain the required credentials as env vars
261256
docker run --pull always --rm --name="${container_name}" --net host \
262-
-w /work -v "$PWD":/work "${mantle_ref}" bash -c "git config --global --add safe.directory /work && source ci-automation/release.sh && _inside_mantle"
257+
-w /work -v "$PWD":/work --env-file="sdk_lib/env_mantle.txt" "${mantle_ref}" \
258+
bash -c "git config --global --add safe.directory /work && source ci-automation/release.sh && _inside_mantle"
263259
# Push flatcar_production_ami_*txt and flatcar_production_ami_*json to the right bincache folder
264260
for arch in amd64 arm64; do
265261
sudo chown -R "$USER:$USER" "aws-${arch}"

0 commit comments

Comments
 (0)