Skip to content

Commit 9da1179

Browse files
0x2b3bfa0dacbd
andauthored
Wait for apt to finish (#621)
* Wait for `apt` to finish * Always disable unattended upgrades * Update tests * Fix blunder * 🥶 Co-authored-by: Daniel Barnes <dabarnes2b@gmail.com> * go test -update * review edit fail * go test -update Co-authored-by: Daniel Barnes <dabarnes2b@gmail.com>
1 parent 6f05843 commit 9da1179

7 files changed

+57
-40
lines changed

environment/setup.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
#/bin/sh
2-
FILE=/var/log/cml_stack.log
3-
if [ ! -f "$FILE" ]; then
4-
export DEBIAN_FRONTEND=noninteractive
5-
PS4='tpi:setup.sh: '
6-
set -x
7-
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
2+
PS4='tpi:setup.sh: '
3+
set -x
84

9-
sudo apt remove unattended-upgrades
10-
systemctl disable apt-daily-upgrade.service
5+
export DEBIAN_FRONTEND=noninteractive
6+
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
117

8+
sudo apt remove unattended-upgrades
9+
systemctl disable apt-daily-upgrade.service
10+
11+
FILE=/var/log/cml_stack.log
12+
if [ ! -f "$FILE" ]; then
1213
sudo add-apt-repository universe -y
1314
sudo add-apt-repository ppa:git-core/ppa -y
1415
sudo apt update && sudo apt-get install -y software-properties-common build-essential git acpid

iterative/resource_runner.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ export KUBERNETES_CONFIGURATION={{escape .KUBERNETES_CONFIGURATION}}
343343
{{- end}}
344344
{{- end}}
345345
346+
while lsof /var/lib/dpkg/lock; do sleep 1; done
347+
346348
{{- if .runner_startup_script}}
347349
{{.runner_startup_script}}
348350
{{- end}}

iterative/testdata/script_template_cloud_aws.golden

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/bin/sh
22
sudo systemctl is-enabled cml.service && return 0
3-
FILE=/var/log/cml_stack.log
4-
if [ ! -f "$FILE" ]; then
5-
export DEBIAN_FRONTEND=noninteractive
6-
PS4='tpi:setup.sh: '
7-
set -x
8-
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
3+
PS4='tpi:setup.sh: '
4+
set -x
95

10-
sudo apt remove unattended-upgrades
11-
systemctl disable apt-daily-upgrade.service
6+
export DEBIAN_FRONTEND=noninteractive
7+
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
128

9+
sudo apt remove unattended-upgrades
10+
systemctl disable apt-daily-upgrade.service
11+
12+
FILE=/var/log/cml_stack.log
13+
if [ ! -f "$FILE" ]; then
1314
sudo add-apt-repository universe -y
1415
sudo add-apt-repository ppa:git-core/ppa -y
1516
sudo apt update && sudo apt-get install -y software-properties-common build-essential git acpid
@@ -49,6 +50,8 @@ export AWS_SECRET_ACCESS_KEY='0 value with "quotes" and spaces'
4950
export AWS_ACCESS_KEY_ID='1 value with "quotes" and spaces'
5051
export AWS_SESSION_TOKEN='2 value with "quotes" and spaces'
5152
53+
while lsof /var/lib/dpkg/lock; do sleep 1; done
54+
5255
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
5356
--name '10 value with "quotes" and spaces' \
5457
--labels '16 value with "quotes" and spaces' \

iterative/testdata/script_template_cloud_azure.golden

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/bin/sh
22
sudo systemctl is-enabled cml.service && return 0
3-
FILE=/var/log/cml_stack.log
4-
if [ ! -f "$FILE" ]; then
5-
export DEBIAN_FRONTEND=noninteractive
6-
PS4='tpi:setup.sh: '
7-
set -x
8-
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
3+
PS4='tpi:setup.sh: '
4+
set -x
95

10-
sudo apt remove unattended-upgrades
11-
systemctl disable apt-daily-upgrade.service
6+
export DEBIAN_FRONTEND=noninteractive
7+
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
128

9+
sudo apt remove unattended-upgrades
10+
systemctl disable apt-daily-upgrade.service
11+
12+
FILE=/var/log/cml_stack.log
13+
if [ ! -f "$FILE" ]; then
1314
sudo add-apt-repository universe -y
1415
sudo add-apt-repository ppa:git-core/ppa -y
1516
sudo apt update && sudo apt-get install -y software-properties-common build-essential git acpid
@@ -50,6 +51,8 @@ export AZURE_CLIENT_SECRET='4 value with "quotes" and spaces'
5051
export AZURE_SUBSCRIPTION_ID='5 value with "quotes" and spaces'
5152
export AZURE_TENANT_ID='6 value with "quotes" and spaces'
5253
54+
while lsof /var/lib/dpkg/lock; do sleep 1; done
55+
5356
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
5457
--name '10 value with "quotes" and spaces' \
5558
--labels '16 value with "quotes" and spaces' \

iterative/testdata/script_template_cloud_gcp.golden

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/bin/sh
22
sudo systemctl is-enabled cml.service && return 0
3-
FILE=/var/log/cml_stack.log
4-
if [ ! -f "$FILE" ]; then
5-
export DEBIAN_FRONTEND=noninteractive
6-
PS4='tpi:setup.sh: '
7-
set -x
8-
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
3+
PS4='tpi:setup.sh: '
4+
set -x
95

10-
sudo apt remove unattended-upgrades
11-
systemctl disable apt-daily-upgrade.service
6+
export DEBIAN_FRONTEND=noninteractive
7+
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
128

9+
sudo apt remove unattended-upgrades
10+
systemctl disable apt-daily-upgrade.service
11+
12+
FILE=/var/log/cml_stack.log
13+
if [ ! -f "$FILE" ]; then
1314
sudo add-apt-repository universe -y
1415
sudo add-apt-repository ppa:git-core/ppa -y
1516
sudo apt update && sudo apt-get install -y software-properties-common build-essential git acpid
@@ -48,6 +49,8 @@ sudo tee /usr/bin/cml.sh << 'EOF'
4849
export GOOGLE_APPLICATION_CREDENTIALS_DATA=''
4950
export CML_GCP_ACCESS_TOKEN=''
5051
52+
while lsof /var/lib/dpkg/lock; do sleep 1; done
53+
5154
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
5255
--name '10 value with "quotes" and spaces' \
5356
--labels '16 value with "quotes" and spaces' \

iterative/testdata/script_template_cloud_invalid.golden

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
#!/bin/sh
22
sudo systemctl is-enabled cml.service && return 0
3-
FILE=/var/log/cml_stack.log
4-
if [ ! -f "$FILE" ]; then
5-
export DEBIAN_FRONTEND=noninteractive
6-
PS4='tpi:setup.sh: '
7-
set -x
8-
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
3+
PS4='tpi:setup.sh: '
4+
set -x
95

10-
sudo apt remove unattended-upgrades
11-
systemctl disable apt-daily-upgrade.service
6+
export DEBIAN_FRONTEND=noninteractive
7+
echo "APT::Get::Assume-Yes \"true\";" | sudo tee -a /etc/apt/apt.conf.d/90assumeyes
128

9+
sudo apt remove unattended-upgrades
10+
systemctl disable apt-daily-upgrade.service
11+
12+
FILE=/var/log/cml_stack.log
13+
if [ ! -f "$FILE" ]; then
1314
sudo add-apt-repository universe -y
1415
sudo add-apt-repository ppa:git-core/ppa -y
1516
sudo apt update && sudo apt-get install -y software-properties-common build-essential git acpid
@@ -46,6 +47,8 @@ sudo npm config set user 0 && sudo npm install --global 18 value with "quotes" a
4647
sudo tee /usr/bin/cml.sh << 'EOF'
4748
#!/bin/sh
4849
50+
while lsof /var/lib/dpkg/lock; do sleep 1; done
51+
4952
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
5053
--name '10 value with "quotes" and spaces' \
5154
--labels '16 value with "quotes" and spaces' \

iterative/testdata/script_template_cloud_kubernetes.golden

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
sudo systemctl is-enabled cml.service && return 0
33
export KUBERNETES_CONFIGURATION='8 value with "quotes" and spaces'
44

5+
while lsof /var/lib/dpkg/lock; do sleep 1; done
6+
57
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
68
--name '10 value with "quotes" and spaces' \
79
--labels '16 value with "quotes" and spaces' \

0 commit comments

Comments
 (0)