botbotbot 's blog

Drone.io CI

Drone - Continuous Integration platform built on Docker, written in Go - better than Drone.io

Drone.io based on Drone - Simple CI Server

Private Configuration:

Can run shell command

  1. upload your configuration into gist with secret
  2. get url of your raw configuration
  3. add your configuration url in “Environment Variable”

    # Example
    CONFIG_URL="<your_configuration_url>"
    
  4. in “Commands” download your configurations via wget without display result

    #!/bin/sh
    wget $CONFIG_URL -O <config_name> &> /dev/null
    

Keep Variables in Environment

# Example
#!/bin/sh
export CLIENT_ID=<your id>
export TAGS=<your tags>
#!/usr/bin/env python
import os
client_id = os.environ.get('CLIENT_ID',<default value>)
tags = os.environ.get('TAGS',<default value>)

Dynamic Solution

#!/usr/bin/env python
import os

# Configuration from Environment Variables if can't load config.ini
# you can make you own configuration from config.ini.sample

if os.path.isfile("config.ini"):
    import configparser
    config = configparser.ConfigParser()
    config.read('config.ini')
    client_id = config.get('DEFAULT', 'client_id')
else:
    client_id = os.environ.get('CLIENT_ID', <default value>)

References:

  1. Drone.io Quickstart
  2. Drone.io Building Python Projects
  3. Hosting Your Open Source Project on Heroku with Private Configuration
  4. How to hide connection string, user name, pw when using source control?