# GoMigrate
gomigrate is a simple cli tool to house functions that do not fit into
the structure or distribution of nscli or other command line tooling.

## Installing
#### Mac OSX
To install/update gomigrate on an OSX build, you can do so using Homebrew. 
If you have not already, add the gomigrate tap to your brew taps:
```$xslt
brew tap dcm/gomigrate git@github.com:RSS-Engineering/DCM-gomigrate
```
Once tapped, you can install/upgrade/remove gomigrate using the regular brew methods
```$xslt
brew update && brew install gomigrate
```
```$xslt
brew update && brew upgrade gomigrate
```
```$xslt
brew uninstall gomigrate
```

#### Linux Install
You can install gomigrate on Ubuntu by pulling down the debian build, and installing the package:
```
curl -O https://artifacts.rackspace.net/artifactory/dcm-generic-local/gomigrate/{{version}}/gomigrate_amd64.deb && sudo dpkg -i gomigrate_amd64.deb
```

## Contributing
#### Test this application 
* Run all tests
    * ```make tests```
* Run linting 
	* ```make lint```
    
#### Release a new build
The release for gomigrate includes a few things:
1. Building of the Go binary 
2. Debian build for Linux installations
3. Brew build for OSX installations (this includes the formula.rb generation)
4. Archive build of tar.gz files
5. Deployment to Artifactory 
6. Drafting of a new release in github.

Because of all these things included in the release, there are a few 
prerequisites needed prior to drafting a new release.
1. You will need to be in the `dc_migration_devs` LDAP group (request [Here](https://sailpoint.rackspace.corp/identityiq/home.jsf))
2. You need to have a valid GitHub token with permissions to make releases to the 
github.com/RSS-Engineering/DCM-gomigrate repo.  Token will need to exist here `~/.config/goreleaser/github_token`
3. Environment variables for Artifactory authentication will need to exist.
You can generate your Artifactory API key [Here](https://artifacts.rackspace.net/artifactory/webapp/#/profile)
   ```$xslt
    export ARTIFACTORY_PRODUCTION_USERNAME=<YOUR_SSO>
    export ARTIFACTORY_PRODUCTION_SECRET=<YOUR_ARTY_SECRET>
   ```

Once you have completed the prereqs, you should be able to draft a new release using make:
  * ```make release```  
    Note: this requires a clean git status and a new git tag.  If you are wanting to
    test this release, run ```make testrelease```       

#### Considerations
GoMigrate uses a go-key library that has a dependency on an Go Sqlite library. 
Sqlite requires C and has a dependency on the GCC build, which is not compatible.

To get around this, you can manually install the linux gcc libraries by running

```brew install FiloSottile/musl-cross/musl-cross```
* NOTE: the goreleaser file already contains the arguments to reference the 
linux-gcc builds.

See: https://github.com/mattn/go-sqlite3/issues/384 for more information.

## More help
> Send emails to: [NetSec DC Migrations](mailto:netsec_dc_migrations@RACKSPACE.COM)
