-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cfde8cd
commit bdccf70
Showing
15 changed files
with
321 additions
and
188 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
node_modules | ||
.env* | ||
action.yml | ||
LICENSE | ||
README.md | ||
.gitignore | ||
.eslintrc.yml |
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,3 +1,2 @@ | ||
test.sh | ||
node_modules | ||
.env | ||
.env* |
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,17 @@ | ||
FROM node:14 | ||
|
||
WORKDIR /app | ||
|
||
ARG HELMFILE_VERSION=v0.135.0 | ||
|
||
ADD https://github.com/roboll/helmfile/releases/download/${HELMFILE_VERSION}/helmfile_linux_amd64 \ | ||
/tmp/ | ||
|
||
COPY . . | ||
|
||
RUN npm install \ | ||
&& mv /tmp/helmfile_linux_amd64 /usr/local/bin/helmfile \ | ||
&& chmod +x /usr/local/bin/helmfile \ | ||
&& curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 | bash | ||
|
||
ENTRYPOINT [ "node", "/app/src/index.js" ] |
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
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,7 +1,8 @@ | ||
name: 'Deployment Bumper' | ||
description: 'Update deployment related stuff' | ||
runs: | ||
using: 'node12' | ||
using: 'docker' | ||
image: 'Dockerfile' | ||
branding: | ||
icon: 'edit' | ||
color: blue |
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
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
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,56 @@ | ||
const { Helmfile } = require('./processors/helmfile'); | ||
const { Ubuntu } = require('./processors/ubuntu'); | ||
|
||
/** | ||
* Ubuntu processor handler. Edits specified value in specified file | ||
* based on input parameters | ||
* @param {object} filePath - full path to file | ||
*/ | ||
const handleUbuntu = async (filePath) => { | ||
const filterValues = { | ||
cloud: process.env.CLOUD || null, | ||
zone: process.env.ZONE || null, | ||
version: process.env.VERSION || null, | ||
architecture: process.env.ARCHITECTURE || null, | ||
instanceType: process.env.INSTANCE_TYPE || null, | ||
release: process.env.RELEASE || null, | ||
}; | ||
|
||
const rawKeys = process.env.KEYS; | ||
let keys; | ||
if (rawKeys) { | ||
keys = rawKeys.split(','); | ||
} else { | ||
throw new Error('KEYS must be supplied!'); | ||
} | ||
|
||
const filter = {}; | ||
Object.keys(filterValues).forEach((value) => { | ||
if (filterValues[value]) filter[value] = filterValues[value]; | ||
}); | ||
const ubuntu = new Ubuntu(filter, filePath, keys); | ||
await ubuntu.run(); | ||
console.log(`File "${filePath}" has been successfully updated.`); | ||
}; | ||
|
||
/** | ||
* Helmfile processor handler. Updates helmfiles lock file. | ||
* @param {object} filePath - full path to file | ||
*/ | ||
const handleHelmfile = async (filePath) => { | ||
const helmfileArgs = { | ||
file: filePath, | ||
}; | ||
if (process.env.ENVIRONMENT) { | ||
helmfileArgs.environment = process.env.ENVIRONMENT; | ||
} | ||
|
||
const helmfile = new Helmfile(helmfileArgs); | ||
await helmfile.run(); | ||
console.log(`File "${filePath}" has been successfully updated.`); | ||
}; | ||
|
||
module.exports = { | ||
handleUbuntu, | ||
handleHelmfile, | ||
}; |
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
Oops, something went wrong.