-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on docs and changing ci options
- Loading branch information
1 parent
9e6127b
commit d7dcb8f
Showing
6 changed files
with
157 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,34 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/dropseed/deps/internal/output" | ||
"github.com/dropseed/deps/internal/runner" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var ciAuto bool | ||
var ciManual bool | ||
var ciTypes []string | ||
var ciQuiet bool | ||
|
||
var ciCMD = &cobra.Command{ | ||
Use: "ci", | ||
Short: "Run deps on the current directory", | ||
Short: "Update all dependencies of the current branch, as pull requests", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
if err := runner.CI(ciAuto, ciTypes); err != nil { | ||
// CI will run verbose by default | ||
if !ciQuiet { | ||
output.Verbosity = 1 | ||
} | ||
|
||
auto := !ciManual | ||
if err := runner.CI(auto, ciTypes); err != nil { | ||
printErrAndExitFailure(err) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
ciCMD.Flags().BoolVarP(&ciAuto, "autoconfigure", "a", false, "automatically configure repo for deps usage (push access)") | ||
ciCMD.Flags().BoolVarP(&ciManual, "manual", "m", false, "do not automatically configure repo") | ||
ciCMD.Flags().BoolVarP(&ciQuiet, "quiet", "q", false, "disable verbose output") | ||
ciCMD.Flags().StringArrayVarP(&ciTypes, "type", "t", []string{}, "only run on specified dependency types") | ||
rootCmd.AddCommand(ciCMD) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,114 @@ | ||
# Building a dependencies.io component | ||
|
||
- local or git repo | ||
- dependencies_component.yml | ||
- install | ||
- collect | ||
- act | ||
- manifests | ||
- dependencies updated individually by default | ||
- json example | ||
- lockfiles | ||
- any updates to a lockfile will be grouped together (the lockfile is either up to date or not) | ||
- json example | ||
- testing | ||
|
||
# Using deps | ||
|
||
- your CI | ||
- cron | ||
- examples of each | ||
- splitting by type | ||
# How to use deps | ||
|
||
## Locally | ||
|
||
An easy way to get started with `deps` is to try it on your own machine! | ||
|
||
To install it, | ||
[download a release](https://github.com/dropseed/deps/releases) or use the following install script: | ||
```sh | ||
$ curl https://www.dependencies.io/install.sh | bash -s -- -b $HOME/bin | ||
``` | ||
|
||
Once `deps` is in your `$PATH`, you can check a local project for dependency updates: | ||
```sh | ||
$ cd MY_GIT_REPO | ||
$ deps run | ||
``` | ||
|
||
## In CI | ||
|
||
When you are comfortable with how deps works, | ||
you'll want to set it up in your CI provider to automate your dependency updates. | ||
Most CI systems have a cron or scheduled job function, | ||
which is how we recommend using it. | ||
This way your regular CI pipeline can run uninterruped by deps during your normal workflows. | ||
|
||
Below are some simple examples of how you might configure this, | ||
but you should adjust the setup to work how you want within your existing CI configuration. | ||
|
||
You will also need to give deps access to your git repo. The easiest way to do this is usually with personal access tokens. | ||
|
||
### TravisCI | ||
|
||
1. Set your environment variables | ||
1. Add a daily/weekly/monthly [cron job in the Travis settings UI](https://docs.travis-ci.com/user/cron-jobs/) | ||
1. Define `jobs` in your `.travis.yml` and use `if` statements to define a deps job that only runs via cron | ||
|
||
```yaml | ||
language: python | ||
|
||
jobs: | ||
include: | ||
- name: test | ||
script: echo "Tests passing here..." | ||
install: ./scripts/install_requirements | ||
- name: deps | ||
if: branch = master AND type = cron | ||
git: | ||
depth: false # required for existing deps branches to be available | ||
install: | ||
- ./scripts/install_requirements | ||
- curl https://www.dependencies.io/install.sh | bash -s -- -b $HOME/bin | ||
script: deps ci | ||
``` | ||
### CircleCI | ||
1. Set your environment variables in a [context](https://circleci.com/docs/2.0/contexts/) | ||
1. Add a deps workflow and accompanying jobs to your `.circleci/config.yml` | ||
|
||
This example shows two different languages in use, | ||
each running in their own container. | ||
The `--type` option is used to run the specific language updates in their respective containers. | ||
|
||
```yaml | ||
version: 2 | ||
jobs: | ||
# in addition to your existing jobs | ||
deps-python: | ||
docker: | ||
- image: circleci/python:3.7 | ||
steps: | ||
- checkout | ||
- run: curl https://www.dependencies.io/install.sh | bash -s -- -b $HOME/bin | ||
- run: $HOME/bin/deps ci --type python | ||
deps-node: | ||
docker: | ||
- image: circleci/node:12 | ||
steps: | ||
- checkout | ||
- run: curl https://www.dependencies.io/install.sh | bash -s -- -b $HOME/bin | ||
- run: $HOME/bin/deps ci --type js | ||
workflows: | ||
version: 2 | ||
# in addition to your existing workflows | ||
deps: | ||
jobs: | ||
- deps-python: | ||
context: deps | ||
- deps-node: | ||
context: deps | ||
triggers: | ||
- schedule: | ||
cron: "0 0 * * *" # nightly | ||
filters: | ||
branches: | ||
only: | ||
- master | ||
``` | ||
|
||
### BitBucket Pipelines | ||
|
||
TBD | ||
|
||
### Jenkins | ||
|
||
TBD | ||
|
||
### GitHub Actions | ||
|
||
TBD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Building a dependencies.io component | ||
|
||
- local or git repo | ||
- dependencies_component.yml | ||
- install | ||
- collect | ||
- act | ||
- manifests | ||
- dependencies updated individually by default | ||
- json example | ||
- lockfiles | ||
- any updates to a lockfile will be grouped together (the lockfile is either up to date or not) | ||
- json example | ||
- testing |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# GitHub | ||
|
||
To use deps on a GitHub repo, | ||
you'll need to give it access. | ||
|
||
The easiest way to do this is with a personal access token, | ||
either from your personal account or a bot account that your company already has set up. | ||
|
||
## Personal access token | ||
|
||
## GitHub App |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# GitLab | ||
|
||
In GitLab, you'll need to create a personal access token for deps to use. | ||
You can do this from your user account or a bot account. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters