Skip to content
This repository has been archived by the owner on Sep 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #43 from digitalrebar/change-stage
Browse files Browse the repository at this point in the history
Change stage
  • Loading branch information
galthaus authored Dec 1, 2017
2 parents 93317a4 + a2dd261 commit 066c0d6
Show file tree
Hide file tree
Showing 33 changed files with 67 additions and 25 deletions.
2 changes: 2 additions & 0 deletions content/bootenvs/centos-7.4.1708.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ Templates:
- ID: "centos-7.ks.tmpl"
Name: "compute.ks"
Path: "{{.Machine.Path}}/compute.ks"
Meta:
feature-flags: "change-stage-v2"
2 changes: 2 additions & 0 deletions content/bootenvs/centos-7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ Templates:
- ID: "centos-7.ks.tmpl"
Name: "compute.ks"
Path: "{{.Machine.Path}}/compute.ks"
Meta:
feature-flags: "change-stage-v2"
2 changes: 2 additions & 0 deletions content/bootenvs/debian-8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ Templates:
- ID: "net-post-install.sh.tmpl"
Name: "net-post-install.sh"
Path: "{{.Machine.Path}}/post-install.sh"
Meta:
feature-flags: "change-stage-v2"
2 changes: 2 additions & 0 deletions content/bootenvs/debian-9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,5 @@ Templates:
- ID: "net-post-install.sh.tmpl"
Name: "net-post-install.sh"
Path: "{{.Machine.Path}}/post-install.sh"
Meta:
feature-flags: "change-stage-v2"
14 changes: 9 additions & 5 deletions content/bootenvs/discovery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Templates:
Path: "default.ipxe"
Contents: |
#!ipxe
chain tftp://{{.ProvisionerAddress}}/${netX/ip}.ipxe && exit || goto sledgehammer
chain {{.ProvisionerURL}}/${netX/ip}.ipxe && exit || goto sledgehammer
:sledgehammer
kernel {{.Env.PathFor "http" .Env.Kernel}} {{.BootParams}} BOOTIF=01-${netX/mac:hexhyp}
initrd {{.Env.PathFor "http" (index .Env.Initrds 0)}}
Expand Down Expand Up @@ -95,10 +95,12 @@ Templates:
fi
else
dhcp_ip="$(dhcp_param "$fixed_ip")"
lookup_1=$(getent hosts $dhcp_ip | awk '{print $2}')
lookup_2=$(getent hosts $dhcp_ip | awk '{print $2}')
if [[ $lookup_1 && $lookup_1 == $lookup_2 && $lookup_1 != localhost* ]]; then
HOSTNAME=$lookup_1
if [[ $dhcp_ip != "" ]] ; then
lookup_1=$(getent hosts $dhcp_ip | awk '{print $2}')
lookup_2=$(getent hosts $dhcp_ip | awk '{print $2}')
if [[ $lookup_1 && $lookup_1 == $lookup_2 && $lookup_1 != localhost* ]]; then
HOSTNAME=$lookup_1
fi
fi
fi
export RS_ENDPOINT="$(get_param "$api_re")"
Expand Down Expand Up @@ -169,3 +171,5 @@ Templates:
echo "Did not get control.sh from $PROVISIONER_WEB/machines/$RS_UUID/control.sh"
exit 1
Meta:
feature-flags: "change-stage-v2"
3 changes: 3 additions & 0 deletions content/bootenvs/sledgehammer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,10 @@ Templates:
# used below. Reset the token to the longer machine token.
export RS_TOKEN="{{.GenerateToken}}"
{{template "reset-workflow.tmpl" .}}
{{template "runner.tmpl" .}}
# The last line in this script must always be exit 0!!
exit 0
Meta:
feature-flags: "change-stage-v2"
2 changes: 2 additions & 0 deletions content/bootenvs/ubuntu-16.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ Templates:
- ID: "net-post-install.sh.tmpl"
Name: "net-post-install.sh"
Path: "{{.Machine.Path}}/post-install.sh"
Meta:
feature-flags: "change-stage-v2"
1 change: 0 additions & 1 deletion content/stages/centos-7.4.1708.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Tasks:
- "set-hostname"
- "centos-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion content/stages/centos-7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Tasks:
- "set-hostname"
- "centos-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
2 changes: 1 addition & 1 deletion content/stages/complete-nowait.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
Name: "complete-nowait"
Description: "Stage that represents workflow completion to local disk. Does NOT change stages"
Description: "Stage that represents workflow completion to local disk. Does NOT wait in the runner."
BootEnv: "local"
Meta:
icon: "checkmark"
Expand Down
1 change: 0 additions & 1 deletion content/stages/debian-8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ RunnerWait: true
Tasks:
- "ubuntu-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion content/stages/debian-9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ RunnerWait: true
Tasks:
- "ubuntu-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion content/stages/discover-no-gohai.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ BootEnv: "sledgehammer"
RunnerWait: true
Tasks:
- "ssh-access"
- "change-stage"
Meta:
icon: "spinner"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion content/stages/discover.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ RunnerWait: true
Tasks:
- "gohai"
- "ssh-access"
- "change-stage"
Meta:
icon: "spinner"
color: "yellow"
Expand Down
2 changes: 0 additions & 2 deletions content/stages/finish-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Name: "finish-install"
Description: "Used with the STOP runner action to leave a stage that will have a task on machine boot"
BootEnv: "local"
Tasks:
- "change-stage"
Meta:
icon: "checkmark"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion content/stages/prep-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ Description: |
BootEnv: "sledgehammer"
Tasks:
- erase-hard-disks-for-os-install
- change-stage
1 change: 0 additions & 1 deletion content/stages/ssh-access.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Description: "Stage that installs SSH keys and configure SSH access policy"
RunnerWait: true
Tasks:
- "ssh-access"
- "change-stage"
Meta:
icon: "key"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion content/stages/ubuntu-16.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ RunnerWait: true
Tasks:
- "ubuntu-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
2 changes: 1 addition & 1 deletion content/templates/centos-7.ks.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ exec > /root/post-install.log 2>&1
set -x
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '

RUNNER_WAIT=false
{{template "reset-workflow.tmpl" .}}
{{template "runner.tmpl" .}}

sync
Expand Down
2 changes: 1 addition & 1 deletion content/templates/net-post-install.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '
wget "{{.Machine.Url}}/seed" -O /var/log/provision.seed
RUNNER_WAIT=false
{{template "reset-workflow.tmpl" .}}
{{template "runner.tmpl" .}}
EOF2341
Expand Down
19 changes: 19 additions & 0 deletions content/templates/reset-workflow.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash

# Make sure we have a drpcli somewhere
if [[ ! -e /usr/local/bin/drpcli ]] ; then
ProvURL="{{.ProvisionerURL}}"
(mkdir -p /usr/local/bin; cd /usr/local/bin; curl -s -f -L -o drpcli "$ProvURL/files/drpcli.amd64.linux"; chmod 755 drpcli)
fi

# Get a Machine token that we can use for drpcli actions
export RS_TOKEN="{{.GenerateToken}}"

# Get API endpoint
export RS_ENDPOINT="{{.ApiURL}}"

# One day Reset the workflow chain here as well

# Reset the current task list and mark the machine runnable.
/usr/local/bin/drpcli machines update "{{.Machine.UUID}}" '{ "Runnable": true, "CurrentTask": -1 }'

2 changes: 2 additions & 0 deletions contrib/bootenvs/centos-6.9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ Templates:
- ID: "centos-6.ks.tmpl"
Name: "compute.ks"
Path: "{{.Machine.Path}}/compute.ks"
Meta:
feature-flags: "sane-exit-codes"
2 changes: 2 additions & 0 deletions contrib/bootenvs/centos-6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ Templates:
- ID: "centos-6.ks.tmpl"
Name: "compute.ks"
Path: "{{.Machine.Path}}/compute.ks"
Meta:
feature-flags: "sane-exit-codes"
2 changes: 2 additions & 0 deletions contrib/bootenvs/centos-7.3.1611.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ Templates:
- ID: "centos-7.ks.tmpl"
Name: "compute.ks"
Path: "{{.Machine.Path}}/compute.ks"
Meta:
feature-flags: "sane-exit-codes"
2 changes: 2 additions & 0 deletions contrib/bootenvs/scientificlinux-6.8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ Templates:
- ID: "centos-6.ks.tmpl"
Name: "compute.ks"
Path: "{{.Machine.Path}}/compute.ks"
Meta:
feature-flags: "sane-exit-codes"
2 changes: 2 additions & 0 deletions contrib/bootenvs/ubuntu-14.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,5 @@ Templates:
- ID: "net-post-install.sh.tmpl"
Name: "net-post-install.sh"
Path: "{{.Machine.Path}}/post-install.sh"
Meta:
feature-flags: "sane-exit-codes"
1 change: 0 additions & 1 deletion contrib/stages/centos-6.9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Tasks:
- "set-hostname"
- "centos-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion contrib/stages/centos-6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Tasks:
- "set-hostname"
- "centos-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion contrib/stages/centos-7.3.1611.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Tasks:
- "set-hostname"
- "centos-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion contrib/stages/scientificlinux-6.8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Tasks:
- "set-hostname"
- "centos-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
1 change: 0 additions & 1 deletion contrib/stages/ubuntu-14.04.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ RunnerWait: true
Tasks:
- "ubuntu-drp-only-repos"
- "ssh-access"
- "change-stage"
Meta:
icon: "download"
color: "yellow"
Expand Down
2 changes: 1 addition & 1 deletion contrib/templates/centos-6.ks.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ exec > /root/post-install.log 2>&1
set -x
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): '

RUNNER_WAIT=false
{{ template "reset-workflow.tmpl" . }}
{{ template "runner.tmpl" . }}

sync
Expand Down
12 changes: 12 additions & 0 deletions tools/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

set -e

. tools/version.sh
version="$Prepart$MajorV.$MinorV.$PatchV$Extra-$GITHASH"

DOIT=0
if [[ $version =~ ^v || $version =~ ^tip ]] ; then
DOIT=1
fi
if [[ $DOIT == 0 ]] ;then
echo "Not a publishing branch."
exit 0
fi

[[ $GOPATH ]] || export GOPATH="$HOME/go"
fgrep -q "$GOPATH/bin" <<< "$PATH" || export PATH="$PATH:$GOPATH/bin"

Expand Down

0 comments on commit 066c0d6

Please sign in to comment.