ThoughtWorksStudios / eb_deployer

AWS Elastic Beanstalk blue-green deployment automation from ThoughtWorks Mingle Team
MIT License
400 stars 94 forks source link

Load/run rb file for smoke test #81

Open darrenhaken opened 8 years ago

darrenhaken commented 8 years ago

Is it possible to load an rb file for the smoke test rather than being inline? If so can you share an example?

wpc commented 8 years ago

It's ruby code so you can do anything you want.

Execute a rake task:

    smoke_test: |
      raise "smoke failed" unless system("rake test:smoke SMOKE_TEST_HOSTNAME=#{host_name}")

Run a python verify script:

    smoke_test: |
      raise "smoke failed" unless system("python verify.py #{host_name}")

load a ruby script

    smoke_test: |
        load "smoke_test.rb"
darrenhaken commented 8 years ago

I tried below but it didn't work as it said the rb file didn't exist. Now you've confirmed it should work I'll look into it again

smoke_test: |
        load "smoke_test.rb"
darrenhaken commented 8 years ago

@wpc do you know if eb_deployer defines an environment variable for the environment set?

I ran ENVIRONMENT=test eb_deploy -c eb_deployer.yml -p test.zip -e test and ENV['ENVIRONMENT'] returns "project-name-test"

wpc commented 8 years ago

That's weird, eb_deployer do not set any environment variables. Use export to check predefined environment variable in your terminal, and check your inline code in the config file as well.

darrenhaken commented 8 years ago

@wpc I'll look if it's being set on the CI server.

In the smoke test examples it defines a variable host_name but when I used it in smoke_test.rb it says its undefined. How does this get set?

wpc commented 8 years ago

i guess you can do

smoke_test: |
        SMOKE_TEST_HOST_NAME="#{host_name}"
        load "smoke_test.rb"

then reference the host name by constant.