wballard / starphleet

19 stars 37 forks source link

Base container build #375

Closed AlexisJackson closed 5 years ago

AlexisJackson commented 5 years ago

Only build the base container when we need to.

This checks for the env vars for s3 container storage, and if the ship is only serving containers, will skip the build.

Tested in multiple scenarios.

  1. Userdata included variables for a "serve only" server, where the containers are all pulled from s3.
  2. Userdata included variables marking the server as a "build" server.
  3. Userdata had no related variables.

In the first case, it skipped the build as we intended. In tests 2 and 3, the base-container built as expected.

Example of userdata that will skip the base-container build (censored):

{
  "StarphleetRepo": "https://github.com/AlexisJackson/starphleet.git#base-container-build",
  "Headquarters": "git@github.com:<HEADQUARTERS>",
  "StarphleetEnvironment": [{
    "MAX_CONCURRENT_CONTAINER_BUILDS": 5,
    "S3_STORAGE_AWS_ACCESS_KEY_ID":"\"<KEY>\"",
    "S3_STORAGE_AWS_SECRET_ACCESS_KEY":"\"<SECRET>\"",
    "S3_STORAGE_BUCKET_REGION":"\"<REGION>\"",
    "S3_STORAGE_BUCKET_PATH":"\"<S3_BUCKET>"",
    "SERVE_CONTAINERS":"\"true\""
  }]
}