gha_config 0.15 → 0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/CI.yml +0 -25
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +1 -1
- data/README.md +15 -0
- data/bin/gha_config +0 -1
- data/lib/gha_config/config.rb +2 -0
- data/lib/gha_config/parser.rb +1 -2
- data/lib/gha_config/version.rb +1 -1
- data/lib/gha_config/writer.rb +29 -15
- metadata +2 -3
- data/.github/workflow-src +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16a002da5b1417fffef6cf22c9ec166e258c4000377072a952fa8998f9c33146
|
4
|
+
data.tar.gz: f822acdf86ae16bc7b94275777ce0f693a154b8d417d16845e3ac993889b49e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 730cf61647df7abffa62cf6ed4fc35bff2bee33dd0365e5e8a13b0c42f49f7cbf7286ac93d0d5bf859026d8bdd0fe1a617cb90dd8eab2a2d0c44f0684664b433
|
7
|
+
data.tar.gz: b73d3b11704a7ed1dddffeaffa8a2219fbb3486fc3df996386008d9deaf3ea0f081b1e2317c5d776ec3f661fda3566bb3db3a30fce05d44faf256aea30508af3
|
data/.github/workflows/CI.yml
CHANGED
@@ -41,28 +41,3 @@ jobs:
|
|
41
41
|
run: |
|
42
42
|
sudo chmod 1777 -R /home/circleci/.bundle && bundle config path 'vendor/bundle' && bundle install --jobs=4
|
43
43
|
|
44
|
-
deploy-gem:
|
45
|
-
runs-on: [ubuntu, runner-fleet]
|
46
|
-
needs: [build]
|
47
|
-
container:
|
48
|
-
image: ghcr.io/wishabi/ci-build-environment:ruby-3.0-buster
|
49
|
-
credentials:
|
50
|
-
username: ${{ github.repository_owner }}
|
51
|
-
password: ${{ secrets.GHCR_TOKEN }}
|
52
|
-
if: github.ref == 'refs/heads/main'
|
53
|
-
steps:
|
54
|
-
- name: Checkout code
|
55
|
-
uses: actions/checkout@v2
|
56
|
-
- name: Bundle cache
|
57
|
-
uses: actions/cache@v1
|
58
|
-
with:
|
59
|
-
path: vendor/bundle
|
60
|
-
key: rails-{{ arch }}-{{ checksum "Gemfile.lock" }}
|
61
|
-
restore-keys: rails-{{ arch }}-
|
62
|
-
- name: Bundle install
|
63
|
-
run: |
|
64
|
-
sudo chmod 1777 -R /home/circleci/.bundle && bundle config path 'vendor/bundle' && bundle install --jobs=4
|
65
|
-
- name: Deploy to production
|
66
|
-
run: |
|
67
|
-
chmod +x ./deploy/artifactory.sh && ./deploy/artifactory.sh
|
68
|
-
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [0.19] - 2021-08-06
|
9
|
+
- Add `_options_` for submodules and SSH.
|
10
|
+
|
11
|
+
## [0.17] - 2021-08-04
|
12
|
+
- Adds submodules to checkout action
|
13
|
+
|
14
|
+
## [0.16] - 2021-07-27
|
15
|
+
- Remove dependency on activesupport and byebug
|
16
|
+
- Auto-create directory if it doesn't exist
|
17
|
+
|
8
18
|
## [0.15] - 2021-07-27
|
9
19
|
- Fix bug where defaults are not given (uses [] instead of {})
|
10
20
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -131,6 +131,21 @@ Templates get expanded into their contents whenever they are used. Templates can
|
|
131
131
|
|
132
132
|
If you're using Ruby, you can add this gem to your app Gemfile. Otherwise, you can install it locally. Either way, you can re-run it whenever your "source workflow" changes.
|
133
133
|
|
134
|
+
### Special options
|
135
|
+
|
136
|
+
In addition to `_defaults_`, there are other options that will affect how the output of certain steps is emitted. These options are parsed from the `_options_` key:
|
137
|
+
|
138
|
+
```yaml
|
139
|
+
_options_:
|
140
|
+
use_submodules: true
|
141
|
+
enable_ssh: true
|
142
|
+
```
|
143
|
+
|
144
|
+
* `use_submodules`: If this is set it will check out code recursively with submodules. This requires two things:
|
145
|
+
* A secret called `FLIPPCIRCLECIPULLER_REPO_TOKEN` - Eng Cap will need to add this
|
146
|
+
* Your repo needs to have a Git version > 2.18
|
147
|
+
* `enable_ssh`: If set to true, the Flipp global action will have SSH enabled on failures. This should generally only be set to true while debugging things.
|
148
|
+
|
134
149
|
## Contributing
|
135
150
|
|
136
151
|
Pull requests are welcome!
|
data/bin/gha_config
CHANGED
data/lib/gha_config/config.rb
CHANGED
data/lib/gha_config/parser.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'byebug'
|
2
|
-
|
3
1
|
module GhaConfig
|
4
2
|
module Parser
|
5
3
|
def self.parse(input_file)
|
@@ -8,6 +6,7 @@ module GhaConfig
|
|
8
6
|
hash = YAML.safe_load(input)
|
9
7
|
config = GhaConfig::Config.new
|
10
8
|
config.defaults = hash.delete('_defaults_') || {}
|
9
|
+
config.options = hash.delete('_options_') || {}
|
11
10
|
config.env = hash.delete('env') || {}
|
12
11
|
|
13
12
|
hash['jobs'] = replace_defaults(config, hash['jobs'])
|
data/lib/gha_config/version.rb
CHANGED
data/lib/gha_config/writer.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
1
3
|
module GhaConfig
|
2
4
|
module Writer
|
3
5
|
def self.write(config, output_file)
|
@@ -33,21 +35,32 @@ module GhaConfig
|
|
33
35
|
'runs-on' => '[ubuntu, runner-fleet]'
|
34
36
|
}
|
35
37
|
job['runs-on'] = '[ubuntu, runner-fleet]'
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
38
|
+
flipp_global = {
|
39
|
+
'name' => 'Flipp global',
|
40
|
+
'uses' => 'wishabi/github-actions@v0.4',
|
41
|
+
'env' => {
|
42
|
+
'SLACK_BOT_TOKEN' => "${{ secrets.SLACK_BOT_TOKEN }}"
|
43
|
+
},
|
44
|
+
'timeout-minutes' => 10,
|
45
|
+
'with' => {
|
46
|
+
'slack_channel' => '${{env.SLACK_CHANNEL }}',
|
47
|
+
'job_status' => '${{ job.status }}'
|
48
|
+
}}
|
49
|
+
if config.options['enable_ssh']
|
50
|
+
flipp_global['with']['enable_ssh'] = true
|
51
|
+
end
|
52
|
+
job['steps'].unshift(flipp_global)
|
53
|
+
checkout = {
|
54
|
+
'name' => 'Checkout code',
|
55
|
+
'uses' => 'actions/checkout@v2'
|
56
|
+
}
|
57
|
+
if config.options['use_submodules']
|
58
|
+
checkout['with'] = {
|
59
|
+
'token' => "${{ secrets.FLIPPCIRCLECIPULLER_REPO_TOKEN }}",
|
60
|
+
'submodules' => 'recursive'
|
61
|
+
}
|
62
|
+
end
|
63
|
+
job['steps'].unshift(checkout)
|
51
64
|
job['needs'] = "[#{job['needs'].join(', ')}]" if job['needs'].is_a?(Array)
|
52
65
|
new_job.merge!(job)
|
53
66
|
output_hash['jobs'][name] = new_job
|
@@ -60,6 +73,7 @@ module GhaConfig
|
|
60
73
|
|
61
74
|
OUT
|
62
75
|
output = header + output
|
76
|
+
FileUtils.mkdir_p(File.dirname(output_file))
|
63
77
|
File.write(output_file, output)
|
64
78
|
end
|
65
79
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gha_config
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.19'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Orner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -32,7 +32,6 @@ executables:
|
|
32
32
|
extensions: []
|
33
33
|
extra_rdoc_files: []
|
34
34
|
files:
|
35
|
-
- ".github/workflow-src"
|
36
35
|
- ".github/workflows/CI.yml"
|
37
36
|
- ".gitignore"
|
38
37
|
- ".rubocop.yml"
|