From 7e1e21f1f4507bd21e6638c117737d4f300dc34a Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Thu, 2 Nov 2017 10:20:45 -0700 Subject: [PATCH 1/3] Add HOSTNAME env var to container Signed-off-by: Mrunal Patel --- server/container_create.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/container_create.go b/server/container_create.go index 04f7c2ea..6501db79 100644 --- a/server/container_create.go +++ b/server/container_create.go @@ -912,7 +912,9 @@ func (s *Server) createSandboxContainer(ctx context.Context, containerID string, specgen.AddBindMount("/etc/hosts", "/etc/hosts", options) } + // Set hostname and add env for hostname specgen.SetHostname(sb.Hostname()) + specgen.AddProcessEnv("HOSTNAME", sb.Hostname()) specgen.AddAnnotation(annotations.Name, containerName) specgen.AddAnnotation(annotations.ContainerID, containerID) From 894c98bde875479bb4eea6f8f2bb02d442ed1c16 Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Thu, 2 Nov 2017 10:54:26 -0700 Subject: [PATCH 2/3] test: Add a test for HOSTNAME env Signed-off-by: Mrunal Patel --- test/ctr.bats | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/ctr.bats b/test/ctr.bats index 90f42b68..e13b4e9d 100644 --- a/test/ctr.bats +++ b/test/ctr.bats @@ -600,6 +600,31 @@ function teardown() { stop_crio } +@test "ctr hostname env" { + start_crio + run crioctl pod run --config "$TESTDATA"/sandbox_config.json + echo "$output" + [ "$status" -eq 0 ] + pod_id="$output" + run crioctl ctr create --config "$TESTDATA"/container_config.json --pod "$pod_id" + echo "$output" + [ "$status" -eq 0 ] + ctr_id="$output" + run crioctl ctr execsync --id "$ctr_id" env + echo "$output" + [ "$status" -eq 0 ] + [[ "$output" =~ "HOSTNAME" ]] + run crioctl pod stop --id "$pod_id" + echo "$output" + [ "$status" -eq 0 ] + run crioctl pod remove --id "$pod_id" + echo "$output" + [ "$status" -eq 0 ] + cleanup_ctrs + cleanup_pods + stop_crio +} + @test "ctr execsync failure" { start_crio run crioctl pod run --config "$TESTDATA"/sandbox_config.json From 06b4946e68ce2ecdec91cfe7c878d3508499f18f Mon Sep 17 00:00:00 2001 From: Mrunal Patel Date: Thu, 2 Nov 2017 14:41:51 -0700 Subject: [PATCH 3/3] travis: Take out make lint for go tip It is failing and our source can't be compatible with stable and tip at the same time. Signed-off-by: Mrunal Patel --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index be326c1a..3e1047b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,8 +47,6 @@ jobs: go: 1.9.x - script: - make .gitvalidation - - make gofmt - - make lint - make testunit - make docs - make