Skip to content

Commit

Permalink
Update CI settings
Browse files Browse the repository at this point in the history
  • Loading branch information
tom-tan committed Mar 19, 2021
1 parent 10a21b6 commit 25c1b66
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
curl -SL https://github.com/tom-tan/medal-hook/releases/download/${medal_hook_ver}/medal-hook-linux-x86_64.tar.gz \
| sudo tar xC /usr/bin
env:
medal_ver: v0.4.0
medal_hook_ver: v0.0.7
medal_ver: v0.4.3
medal_hook_ver: v0.1.1
- uses: actions/setup-node@v2
with:
node-version: '14.x'
Expand Down
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ FROM alpine:3.13.0

LABEL maintainer="Tomoya Tanjo <[email protected]>"

ARG medal_ver=v0.4.0
ARG medal_hook_ver=v0.0.7
ARG medal_ver=v0.4.3
ARG medal_hook_ver=v0.1.1

RUN apk --no-cache add ruby ruby-json ruby-etc nodejs jq docker-cli \
ruby-irb ruby-webrick bash curl && \
RUN echo "@testing http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk --no-cache add ruby ruby-json ruby-etc nodejs jq docker-cli \
ruby-irb ruby-webrick bash curl \
telegraf util-linux fluent-bit@testing && \
curl -SL https://github.com/tom-tan/medal/releases/download/${medal_ver}/medal-linux-x86_64.tar.gz \
| tar xC /usr/bin && \
curl -SL https://github.com/tom-tan/medal-hook/releases/download/${medal_hook_ver}/medal-hook-linux-x86_64.tar.gz \
| tar xC /usr/bin && \
apk del --purge curl
| tar xC /usr/bin

COPY . /ep3

Expand Down
22 changes: 22 additions & 0 deletions lib/ep3/extensions/cwl-metrics/bin/isAWorkflow
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env ruby
require 'optparse'
require_relative "#{ENV['EP3_LIBPATH']}/runtime/inspector"

if $0 == __FILE__
opt = OptionParser.new
opt.banner = "#{$0} [options] <root.yml>"
opt.parse!(ARGV)

unless ARGV.length == 1
puts opt.help
exit
end

dir = File.dirname(ARGV.first)
cwl = File.join(dir, 'job.cwl')

unless walk(cwl, '.class', '') == 'Workflow'
puts 'It only supports a simple workflow'
exit 1
end
end
33 changes: 25 additions & 8 deletions lib/ep3/extensions/cwl-metrics/extension.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ hooks:
- which fluent-bit > /dev/null
- which uuidgen > /dev/null
- curl -s $ES_HOST:$ES_PORT > /dev/null
- ./bin/isAWorkflow ~(target)
operations:
- type: replace-env
env:
Expand All @@ -24,7 +25,7 @@ hooks:
- type: add-out
target: to-fullpath-object
out:
- place: ready-to-start-telegraf
- place: ready-to-collect
pattern: 1

- type: add-transitions
Expand All @@ -48,24 +49,40 @@ hooks:
"${ES_HOST}:${ES_PORT}/workflow/_doc/${uuid}?pretty" \
--data-binary @"~(cwl.metrics.json)" > /dev/null
transitions:
- name: prepare-metrics-directory
type: shell
in:
- place: ready-to-collect
pattern: _
out:
- place: ready-to-start-telegraf
pattern: 1
- place: ready-to-start-fluent-bit
pattern: 1
command: mkdir -p $MEDAL_TMPDIR/metrics
- name: keep-collecting-metrics
type: shell
in:
- place: ready-to-start-telegraf
pattern: _
out:
- place: fluent-bit.log
pattern: FILE
- place: telegraf.log
pattern: STDERR
command: |
mkdir -p $MEDAL_TMPDIR/metrics
fluent-bit -c $EP3_EXT_PATH/cwl-metrics/conf/fluent-bit.conf \
--log_file=~(fluent-bit.log)&
telegraf_ver=$(telegraf --version | awk '{ print $2}')
env TELEGRAF_VERSION=$telegraf_ver \
telegraf --config $EP3_EXT_PATH/cwl-metrics/conf/telegraf.conf&
wait
telegraf --config $EP3_EXT_PATH/cwl-metrics/conf/telegraf.conf
- name: keep-sending-metrics
type: shell
in:
- place: ready-to-start-fluent-bit
pattern: _
out:
- place: fluent-bit.log
pattern: FILE
command: |
fluent-bit -c $EP3_EXT_PATH/cwl-metrics/conf/fluent-bit.conf \
--log_file=~(fluent-bit.log)
- type: add-out
target: workflow
out:
Expand Down

0 comments on commit 25c1b66

Please sign in to comment.