Skip to content

Commit

Permalink
Merge pull request #78 from stelcheck/docs/release
Browse files Browse the repository at this point in the history
Docs/release
  • Loading branch information
k-t-yukana authored Feb 20, 2019
2 parents 21513d5 + 589e799 commit fe08cda
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 5 deletions.
40 changes: 39 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,45 @@ them under the `./scripts` folder.
Releasing
---------

To make a release, update `buildconfig.yml`, then:
**Note**: You will need to set a `GITHUB_TOKEN` environment variable for the
release process to work properly.

See [this help page](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/) to
learn how to
create one. We then recommend to add the variable to your `~/.bashrc`. `~/.zshrc` or equivalent.

> ~/.bashrc
```shell
export GITHUB_TOKEN="deadbeef15dead"
```

To make a release, update `buildconfig.yml`. There are two version
numbers being recorded: one for the binary, and one for the Dawn image.

> buildconfig.yml
```yml
binary:
# The name of the binary to output
name: "dawn"

# The current version of the binary
version: "0.15.0"

# [...]
image:
# User or organization on Docker Hub
organization: wizcorp

# Image name (must match the Docker Hub repository name)
name: dawn

# Current image version
version: "0.15.0"
```
> Releasing Dawn
```bash
./scripts/release/release.sh
Expand Down
4 changes: 2 additions & 2 deletions buildconfig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ binary:
name: "dawn"

# The current version of the binary
version: "0.14.7"
version: "0.15.0"

# (Optional) URLs to call when attempting auto-update.
# Defaults:
Expand Down Expand Up @@ -78,7 +78,7 @@ image:
name: dawn

# Current image version
version: "0.14.7"
version: "0.15.0"

# Root folder where most files will be uploaded or mounted
root_folder: /dawn
Expand Down
4 changes: 2 additions & 2 deletions docker-image/ansible/roles/portainer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ ldap_server_port: 389
ldap_dc: "dc={{ local_domain_name.split('.') | join(',dc=') }}"
ldap_admin_user: "cn=admin,{{ ldap_dc }}"

portainer_ldap_user_search: "users,{{ ldap_dc }}"
portainer_ldap_group_search: "groups,{{ ldap_dc }}"
portainer_ldap_user_search: "ou=users,{{ ldap_dc }}"
portainer_ldap_group_search: "ou=groups,{{ ldap_dc }}"

53 changes: 53 additions & 0 deletions src/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ func printHelp() {
fmt.Println(" --update Update this binary")
fmt.Println(" --version Show version information")
fmt.Println(" --build <environment> Build a docker image that embeds the environment")
fmt.Println(" --push <environment> Push image for an environment")
fmt.Println(" --pull <environment> Pull image for an environment")
fmt.Println(" --help Show this screen")
fmt.Println()
fmt.Printf("For more information: %s\n", cliDocsURL)
Expand Down Expand Up @@ -244,6 +246,10 @@ func getConfigurationFolderPath() string {
return fmt.Sprintf("%s/%s", getProjectRoot(), cliConfigurationFolder)
}

func getEnvironmentFolderPath(env string) string {
return fmt.Sprintf("%s/%s", getConfigurationFolderPath(), env)
}

func getConfigurationFilePath() string {
return fmt.Sprintf("%s/%s", getConfigurationFolderPath(), cliConfigurationFilename)
}
Expand Down Expand Up @@ -434,6 +440,34 @@ func runUpdate() (int, error) {
return runSubProcess(shell, arguments)
}

func runPull(environment string) (int, error) {
configuration, err := getConfigurationForEnvironment(environment)
if err != nil {
panic(err)
}

arguments := []string{
"pull",
fmt.Sprintf("%s:%s", configuration.Image, environment),
}

return runSubProcess("docker", arguments)
}

func runPush(environment string) (int, error) {
configuration, err := getConfigurationForEnvironment(environment)
if err != nil {
panic(err)
}

arguments := []string{
"push",
fmt.Sprintf("%s:%s", configuration.Image, environment),
}

return runSubProcess("docker", arguments)
}

func runBuild(environment string) (int, error) {
configuration, err := getConfigurationForEnvironment(environment)
if err != nil {
Expand Down Expand Up @@ -512,6 +546,20 @@ func main() {
printVersion()
case "--update":
exitCode, err = runUpdate()
case "--pull":
if len(args) < 2 {
printHelp()
return
}

exitCode, err = runPull(args[1])
case "--push":
if len(args) < 2 {
printHelp()
return
}

exitCode, err = runPush(args[1])
case "--build":
if len(args) < 2 {
printHelp()
Expand Down Expand Up @@ -547,6 +595,11 @@ func main() {
panic(err)
}

envFolder := getEnvironmentFolderPath(environment)
if _, err := os.Stat(envFolder); os.IsNotExist(err) {
exitCode, err = runBuild(environment)
}

// Run the container
exitCode, err = runEnvironmentContainer(environment, configuration, command)
}
Expand Down

0 comments on commit fe08cda

Please sign in to comment.