Set default values
This commit is contained in:
parent
dc73161dd9
commit
7d95942e9f
20
README.md
20
README.md
@ -18,16 +18,16 @@ This plugin assumes that the mapping of "_which Image tag should be deployed to
|
|||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
|
|
||||||
| Variable name | Variable meaning | Example value |
|
| Variable name | Required? | Variable meaning | Example value (default value for optional variables) |
|
||||||
|------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------|
|
|------------------|-----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
|
||||||
| BRANCH | The branch of the Infrastructure Repo on which to make a commit | `main` |
|
| BRANCH | No | The branch of the Infrastructure Repo on which to make a commit | `main` |
|
||||||
| GIT_REPO | The (https://) address of the Infrastructure Repo | `https://github.com/myusername/coolrepo` |
|
| AUTHOR_EMAIL | No | The email that should be associated with the automated commit | `auto-update-bot@example.com` |
|
||||||
| IMAGE_TAG | The Image Tag to insert into a tracking file | `a6b6e8` |
|
| AUTHOR_NAME | No | The name that should be associated with the automated commit | `Auto Update Bot` |
|
||||||
| DESTINATION_FILE | The file in Infrastructure Repo that should be updated to contain `IMAGE_TAG` | `deployed_tags/prod_image_tag` |
|
| COMMIT_MESSAGE | No | Commit message. Expands environment variables ([note that](https://docs.drone.io/plugins/overview/#plugin-inputs) any of these variables should have `PLUGIN_` prepended if you are referencing them) | `[Auto] Update $DESTINATION_FILE to $IMAGE_TAG` |
|
||||||
| AUTHOR_EMAIL | The email that should be associated with the automated commit | `myname@gmail.com` |
|
| GIT_REPO | Yes | The (https://) address of the Infrastructure Repo | `https://github.com/myusername/coolrepo` |
|
||||||
| AUTHOR_NAME | The name that should be associated with the automated commit | `Adam Nonymous` |
|
| IMAGE_TAG | Yes | The Image Tag to insert into a tracking file | `a6b6e8` |
|
||||||
| COMMIT_MESSAGE | Commit message. Expands environment variables ([note that](https://docs.drone.io/plugins/overview/#plugin-inputs) any of these variables should have `PLUGIN_` prepended if you are referencing them) | `[Auto] Automated commit to write $PLUGIN_IMAGE_TAG to $PLUGIN_DESTINATION_FILE` |
|
| DESTINATION_FILE | Yes | The file in Infrastructure Repo that should be updated to contain `IMAGE_TAG` | `deployed_tags/prod_image_tag` |
|
||||||
| ACCESS_TOKEN | Personal Access Token providing access to the Git Repo | <PAT> |
|
| ACCESS_TOKEN | Yes | Personal Access Token providing access to the Git Repo | <PAT> |
|
||||||
|
|
||||||
# FAQs
|
# FAQs
|
||||||
|
|
||||||
|
@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
set -eox pipefail
|
set -eox pipefail
|
||||||
|
|
||||||
|
# Set default values
|
||||||
|
PLUGIN_BRANCH="${PLUGIN_BRANCH:=main}"
|
||||||
|
PLUGIN_AUTHOR_EMAIL="${PLUGIN_AUTHOR_EMAIL:=auto-update-bot@example.com}"
|
||||||
|
PLUGIN_AUTHOR_NAME="${PLUGIN_AUTHOR_NAME:=Auto Update Bot}"
|
||||||
|
PLUGIN_COMMIT_MESSAGE="${PLUGIN_COMMIT_MESSAGE:=[Auto] Update $PLUGIN_DESTINATION_FILE to $PLUGIN_IMAGE_TAG}"
|
||||||
|
|
||||||
mkdir /working
|
mkdir /working
|
||||||
cd /working
|
cd /working
|
||||||
git clone -b "$PLUGIN_BRANCH" "$PLUGIN_GIT_REPO" .
|
git clone -b "$PLUGIN_BRANCH" "$PLUGIN_GIT_REPO" .
|
||||||
|
Loading…
x
Reference in New Issue
Block a user