forked from ember-redux/ember-redux
-
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.
Merge pull request #3 from gynzy/SRE-230
[SRE-230] add gh actions ci
- Loading branch information
Showing
24 changed files
with
1,208 additions
and
2 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,38 @@ | ||
local util = import './.github/jsonnet/index.jsonnet'; | ||
local image = 'eu.gcr.io/unicorn-985/docker-images_node14-with-libnss:deploy-5893c6fca68ea35a0a51e855d5a3cb7082ef39fa'; | ||
|
||
util.pipeline( | ||
'test-pr', | ||
[ | ||
util.ghJob( | ||
'test-pr', | ||
image=image, | ||
useCredentials=true, | ||
steps=[ | ||
util.checkoutAndYarn(ref='${{ github.event.pull_request.head.sha }}', fullClone=false), | ||
util.action('setup chrome', 'browser-actions/setup-chrome@latest'), | ||
util.step('test', './node_modules/.bin/ember test'), | ||
util.yarnPublish(isPr=true), | ||
], | ||
runsOn=['ubuntu-latest'], // it's public fork. don't use private runners for public fork | ||
), | ||
], | ||
) + | ||
util.pipeline( | ||
'publish-tag', | ||
[ | ||
util.ghJob( | ||
'publish', | ||
image=image, | ||
useCredentials=true, | ||
steps=[ | ||
util.checkoutAndYarn(ref='${{ github.sha }}', fullClone=false), | ||
util.yarnPublish(isPr=false), | ||
], | ||
runsOn=['ubuntu-latest'], // it's public fork. don't use private runners for public fork | ||
), | ||
], | ||
event={ | ||
push: { tags: ['*'] }, | ||
}, | ||
) |
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 @@ | ||
497456f307c7f9ef1d9ac1660b951b1cf8a6e024 |
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,2 @@ | ||
These files come from https://www.github.com/gynzy/lib-jsonnet/ | ||
Do not update here, but extend the libraries upstream. |
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,59 @@ | ||
{ | ||
pipeline(name, jobs, event = 'pull_request', permissions = null):: { | ||
[name + '.yml']: | ||
std.manifestYamlDoc( | ||
{ | ||
name: name, | ||
on: event, | ||
jobs: std.foldl(function(x, y) x + y, jobs, {}), | ||
} + (if permissions == null then {} else {permissions: permissions}), | ||
), | ||
}, | ||
|
||
ghJob(name, | ||
timeoutMinutes=30, | ||
runsOn=null, | ||
image=$.default_job_image, | ||
steps=[], | ||
ifClause=null, | ||
needs=null, | ||
outputs=null, | ||
useCredentials=true, | ||
services=null, | ||
):: | ||
{ | ||
[name]: { | ||
'timeout-minutes': timeoutMinutes, | ||
'runs-on': (if runsOn == null then ['self-hosted', 'runner-2'] else runsOn), | ||
container: { | ||
image: image, | ||
} + (if useCredentials then { credentials: { username: '_json_key', password: $.secret('docker_gcr_io') }} else {}) | ||
, | ||
steps: std.flattenArrays(steps), | ||
} + | ||
(if ifClause != null then {'if': ifClause} else {}) + | ||
(if needs != null then {'needs': needs} else {}) + | ||
(if outputs != null then {'outputs': outputs} else {}) + | ||
(if services != null then {'services': services} else {}) | ||
}, | ||
|
||
step(name, run, env=null, workingDirectory=null, ifClause=null, id=null):: | ||
[{ | ||
name: name, | ||
run: run, | ||
} + (if workingDirectory != null then { 'working-directory': workingDirectory } else { }) | ||
+ (if env != null then { env: env } else {}) | ||
+ (if ifClause != null then { 'if': ifClause } else {}) | ||
+ (if id != null then { id: id } else {}) | ||
], | ||
|
||
action(name, uses, env=null, with=null, id=null, ifClause=null):: | ||
[{ | ||
name: name, | ||
uses: uses, | ||
} + (if env != null then { env: env } else {}) | ||
+ (if with != null && with != {} then { with: with } else {}) | ||
+ (if id != null then { id: id } else {}) | ||
+ (if ifClause != null then { 'if': ifClause } else {}) | ||
], | ||
} |
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 @@ | ||
{ | ||
clusters: { | ||
test: { | ||
project: 'gynzy-test-project', | ||
name: 'test', | ||
zone: 'europe-west4-b', | ||
secret: '${{ secrets.GCE_NEW_TEST_JSON }}', | ||
}, | ||
|
||
prod: { | ||
project: 'unicorn-985', | ||
name: 'prod-europe-west4', | ||
zone: 'europe-west4', | ||
secret: '${{ secrets.GCE_JSON }}', | ||
} | ||
} | ||
} |
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,76 @@ | ||
{ | ||
database_servers: { | ||
test: { | ||
server: 'test-ams', | ||
region: 'europe-west4', | ||
project: 'unicorn-985', | ||
}, | ||
'test-ams-8': { | ||
server: 'test-ams-8', | ||
region: 'europe-west4', | ||
project: 'unicorn-985', | ||
}, | ||
'eu-w4-unicorn-production': { | ||
server: 'eu-w4-unicorn-production', | ||
region: 'europe-west4', | ||
project: 'unicorn-985', | ||
}, | ||
'eu-w4-responses-production' : { | ||
server: 'eu-w4-responses-production', | ||
region: 'europe-west4', | ||
project: 'unicorn-985', | ||
}, | ||
'eu-w4-metrics-production' : { | ||
server: 'eu-w4-metrics-production', | ||
region: 'europe-west4', | ||
project: 'unicorn-985', | ||
}, | ||
'gynzy-test' : { | ||
server: 'gynzy-test', | ||
region: 'europe-west4', | ||
project: 'gynzy-1090', | ||
}, | ||
'gynzy-production' : { | ||
server: 'gynzy-production', | ||
region: 'europe-west4', | ||
project: 'gynzy-1090', | ||
}, | ||
'accounts-production': { | ||
server: 'eu-w4-accounts-production', | ||
region: 'europe-west4', | ||
project: 'unicorn-985', | ||
}, | ||
'eu-w4-licenses-v8' : { | ||
server: 'eu-w4-licenses-v8', | ||
region: 'europe-west4', | ||
project: 'unicorn-985', | ||
}, | ||
'eu-w4-curriculum-v8': { | ||
server: 'eu-w4-curriculum-v8', | ||
region: 'europe-west4', | ||
project: 'unicorn-985', | ||
} | ||
}, | ||
|
||
copyDatabase(mysqlActionOptions):: | ||
assert std.length(std.findSubstr('_pr_', mysqlActionOptions.database_name_target)) > 0; // target db gets deleted. must contain _pr_ | ||
|
||
// overwrite and set task to clone | ||
// delete database by setting it to null and calling prune afterwards | ||
local pluginOptions = std.prune(mysqlActionOptions + { task: 'clone', database: null }); | ||
|
||
$.action('copy-database', $.mysql_action_image, | ||
with=pluginOptions | ||
), | ||
|
||
deleteDatabase(mysqlActionOptions):: | ||
assert std.length(std.findSubstr('_pr_', mysqlActionOptions.database_name_target)) > 0; // this fn deletes the database. destination db must contain _pr_ | ||
|
||
// overwrite and set task to clone | ||
// delete database by setting it to null and calling prune afterwards | ||
local pluginOptions = std.prune(mysqlActionOptions + { task: 'remove', database: null }); | ||
|
||
$.action('delete-database', $.mysql_action_image, | ||
with=pluginOptions | ||
), | ||
} |
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,24 @@ | ||
{ | ||
buildDocker(imageName, | ||
imageTag = 'deploy-${{ github.event.pull_request.head.sha }}', | ||
context = '.', | ||
dockerfile = null, | ||
env = {}, | ||
build_args = null, | ||
registry = 'eu.gcr.io', | ||
):: | ||
$.action( | ||
'build-docker', | ||
$.docker_action_image, | ||
with={ | ||
context: context, | ||
gcloud_service_key: $.secret('docker_gcr_io_base64'), | ||
image_name: imageName, | ||
image_tag: imageTag, | ||
project_id: 'unicorn-985', | ||
registry: registry, | ||
} + if build_args != null then {build_args: build_args} else {} | ||
+ if dockerfile != null then {dockerfile: dockerfile} else {}, | ||
env=env, | ||
), | ||
} |
Oops, something went wrong.