Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit593d659

Browse files
authored
chore(scripts/develop.sh): auto determine first org name and run terraform init (#15603)
Updates `develop.sh` to automatically determine the name of the 'firstorg' when pushing the initial template.Also runs `terraform init` before running `coder templates push` (petpeeve).
1 parent6ed7692 commit593d659

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎scripts/develop.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,8 @@ fatal() {
203203
# If we have docker available and the "docker" template doesn't already
204204
# exist, then let's try to create a template!
205205
template_name="docker"
206+
# Determine the name of the default org with some jq hacks!
207+
first_org_name=$("${CODER_DEV_SHIM}" organizations show me -o json| jq -r'.[] | select(.is_default) | .name')
206208
if docker info>/dev/null2>&1&&!"${CODER_DEV_SHIM}" templates versions list"${template_name}">/dev/null2>&1;then
207209
# sometimes terraform isn't installed yet when we go to create the
208210
# template
@@ -212,12 +214,14 @@ fatal() {
212214
echo"Initializing docker template..."
213215
temp_template_dir="$(mktemp -d)"
214216
"${CODER_DEV_SHIM}" templates init --id"${template_name}""${temp_template_dir}"
217+
# Run terraform init so we get a terraform.lock.hcl
218+
pushd"${temp_template_dir}"&& terraform init&&popd
215219

216220
DOCKER_HOST="$(docker context inspect --format'{{ .Endpoints.docker.Host }}')"
217221
printf'docker_arch: "%s"\ndocker_host: "%s"\n'"${GOARCH}""${DOCKER_HOST}">"${temp_template_dir}/params.yaml"
218222
(
219-
echo"Pushing docker template to 'first-organization'..."
220-
"${CODER_DEV_SHIM}" templates push"${template_name}" --directory"${temp_template_dir}" --variables-file"${temp_template_dir}/params.yaml" --yes --orgfirst-organization
223+
echo"Pushing docker template to '${first_org_name}'..."
224+
"${CODER_DEV_SHIM}" templates push"${template_name}" --directory"${temp_template_dir}" --variables-file"${temp_template_dir}/params.yaml" --yes --org"${first_org_name}"
221225
if ["${multi_org}"-gt"0" ];then
222226
echo"Pushing docker template to '${another_org}'..."
223227
"${CODER_DEV_SHIM}" templates push"${template_name}" --directory"${temp_template_dir}" --variables-file"${temp_template_dir}/params.yaml" --yes --org"${another_org}"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp