-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from Roblox/entrypoint
Add support for entrypoint.
- Loading branch information
Showing
6 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
job "entrypoint" { | ||
datacenters = ["dc1"] | ||
|
||
group "entrypoint-group" { | ||
task "entrypoint-task" { | ||
driver = "containerd-driver" | ||
|
||
config { | ||
image = "ubuntu:16.04" | ||
entrypoint = ["/bin/echo"] | ||
args = ["container1", "container2"] | ||
} | ||
|
||
resources { | ||
cpu = 500 | ||
memory = 256 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
source $SRCDIR/utils.sh | ||
|
||
job_name=entrypoint | ||
|
||
test_entrypoint_nomad_job() { | ||
pushd ~/go/src/github.com/Roblox/nomad-driver-containerd/example | ||
|
||
echo "INFO: Starting nomad $job_name job using nomad-driver-containerd." | ||
nomad job run $job_name.nomad | ||
|
||
# Even though $(nomad job status) reports job status as "running" | ||
# The actual container process might not be running yet. | ||
# We need to wait for actual container to start running before executing $(nomad alloc logs). | ||
echo "INFO: Wait for ${job_name} container to get into RUNNING state." | ||
is_container_active ${job_name} true | ||
|
||
echo "INFO: Checking status of $job_name job." | ||
job_status=$(nomad job status -short $job_name|grep Status|awk '{split($0,a,"="); print a[2]}'|tr -d ' ') | ||
if [ "$job_status" != "running" ];then | ||
echo "ERROR: Error in getting ${job_name} job status." | ||
return 1 | ||
fi | ||
|
||
output=$(nomad logs -job ${job_name}) | ||
for result in "container1" "container2" ; do | ||
echo -e "$output" |grep "$result" &>/dev/null | ||
if [ $? -ne 0 ];then | ||
echo "ERROR: $result not found in the output." | ||
return 1 | ||
fi | ||
done | ||
|
||
echo "INFO: purge nomad ${job_name} job." | ||
nomad job stop -purge ${job_name} | ||
popd | ||
} | ||
|
||
test_entrypoint_nomad_job |
File renamed without changes.