Skip to content

Commit

Permalink
Fix running CML inside CML with pkg binaries (#458)
Browse files Browse the repository at this point in the history
Co-authored-by: Casper da Costa-Luis <[email protected]>
  • Loading branch information
0x2b3bfa0 and casperdcl authored Mar 25, 2022
1 parent 7b14283 commit 81872fa
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion iterative/resource_runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ export KUBERNETES_CONFIGURATION={{escape .KUBERNETES_CONFIGURATION}}
{{.runner_startup_script}}
{{- end}}
HOME="$(mktemp -d)" exec $(which cml-runner || echo "cml runner") \
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
{{if .name}} --name {{escape .name}}{{end}} \
{{if .labels}} --labels {{escape .labels}}{{end}} \
{{if .idle_timeout}} --idle-timeout {{escape .idle_timeout}}{{end}} \
Expand Down
2 changes: 1 addition & 1 deletion iterative/testdata/script_template_cloud_aws.golden
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export AWS_SECRET_ACCESS_KEY='0 value with "quotes" and spaces'
export AWS_ACCESS_KEY_ID='1 value with "quotes" and spaces'
export AWS_SESSION_TOKEN='2 value with "quotes" and spaces'
HOME="$(mktemp -d)" exec $(which cml-runner || echo "cml runner") \
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
--name '10 value with "quotes" and spaces' \
--labels '16 value with "quotes" and spaces' \
--idle-timeout 11 \
Expand Down
2 changes: 1 addition & 1 deletion iterative/testdata/script_template_cloud_azure.golden
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export AZURE_CLIENT_SECRET='4 value with "quotes" and spaces'
export AZURE_SUBSCRIPTION_ID='5 value with "quotes" and spaces'
export AZURE_TENANT_ID='6 value with "quotes" and spaces'
HOME="$(mktemp -d)" exec $(which cml-runner || echo "cml runner") \
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
--name '10 value with "quotes" and spaces' \
--labels '16 value with "quotes" and spaces' \
--idle-timeout 11 \
Expand Down
2 changes: 1 addition & 1 deletion iterative/testdata/script_template_cloud_gcp.golden
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ sudo tee /usr/bin/cml.sh << 'EOF'
#!/bin/sh
export GOOGLE_APPLICATION_CREDENTIALS_DATA='7 value with "quotes" and spaces'
HOME="$(mktemp -d)" exec $(which cml-runner || echo "cml runner") \
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
--name '10 value with "quotes" and spaces' \
--labels '16 value with "quotes" and spaces' \
--idle-timeout 11 \
Expand Down
2 changes: 1 addition & 1 deletion iterative/testdata/script_template_cloud_invalid.golden
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ sudo npm config set user 0 && sudo npm install --global 18 value with "quotes" a
sudo tee /usr/bin/cml.sh << 'EOF'
#!/bin/sh
HOME="$(mktemp -d)" exec $(which cml-runner || echo "cml runner") \
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
--name '10 value with "quotes" and spaces' \
--labels '16 value with "quotes" and spaces' \
--idle-timeout 11 \
Expand Down
2 changes: 1 addition & 1 deletion iterative/testdata/script_template_cloud_kubernetes.golden
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sudo systemctl is-enabled cml.service && return 0
export KUBERNETES_CONFIGURATION='8 value with "quotes" and spaces'

HOME="$(mktemp -d)" exec $(which cml-runner || echo "cml runner") \
HOME="$(mktemp -d)" exec $(which cml-runner || echo $(which cml-internal || echo cml) runner) \
--name '10 value with "quotes" and spaces' \
--labels '16 value with "quotes" and spaces' \
--idle-timeout 11 \
Expand Down
3 changes: 2 additions & 1 deletion iterative/utils/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ func getGHCML(v string) string {
return fmt.Sprintf(`sudo mkdir -p /opt/cml/
sudo curl --location --url %s --output /opt/cml/cml-linux
sudo chmod +x /opt/cml/cml-linux
sudo ln -s /opt/cml/cml-linux /usr/bin/cml`, v)
sudo ln -s /opt/cml/cml-linux /usr/bin/cml
sudo ln /opt/cml/cml-linux /usr/bin/cml-internal`, v) // hard link to fix cml#920
}

func getNPMCML(v string) string {
Expand Down

0 comments on commit 81872fa

Please sign in to comment.