Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d383e75
DRAFT: trying to write a execWait
jeffque Feb 6, 2023
658bdc9
DRAFT: fixing previous commit with gambis
jeffque Feb 6, 2023
5e6be23
DRAFT: hmmm, should close wr on completition
jeffque Feb 6, 2023
f652766
adapt to docker api, add host
Dec 10, 2023
85ce828
hello world workflow
uxjp Feb 19, 2024
143337c
fix ci
uxjp Feb 19, 2024
c93ff6c
exploring dir in ci
uxjp Feb 19, 2024
ad8c359
testing ouroborus dir contents
uxjp Feb 19, 2024
2658fd6
fix cd doesnt work
uxjp Feb 19, 2024
9f49245
using checkout
uxjp Feb 19, 2024
e91d3e1
cd ouroborus
uxjp Feb 19, 2024
d50e456
use ruby version 3
uxjp Feb 19, 2024
8c7426f
build gem
uxjp Feb 19, 2024
701338c
change version for gem
uxjp Feb 19, 2024
14d3aa7
cat gem using wildcart for name
uxjp Feb 19, 2024
9060f84
publish gem
uxjp Feb 19, 2024
217ea10
fix to push gem
uxjp Feb 19, 2024
bc9ec24
trying to push gem
uxjp Feb 19, 2024
932c99e
remove RUBYGEMS_API_KEY: ${{ secrets.GITHUB_TOKEN }}
uxjp Feb 19, 2024
8fb0a15
rm ls and pwd
uxjp Feb 19, 2024
d74bc21
fix
uxjp Feb 19, 2024
b39b645
.gem/credentials
uxjp Feb 19, 2024
0c54e33
fix
uxjp Feb 19, 2024
9e805f3
mkdir .gem
uxjp Feb 19, 2024
b6a2c1b
explore ~
uxjp Feb 19, 2024
2e66942
trying to create .gem/credentials
uxjp Feb 19, 2024
526b978
fix
uxjp Feb 19, 2024
272f48c
ls ~/.gemrc
uxjp Feb 19, 2024
64e8127
cat ~/.gemrc
uxjp Feb 19, 2024
bf6bbda
fix
uxjp Feb 19, 2024
1d7cd90
cat ~/.gem/credentials
uxjp Feb 19, 2024
5b1e7d7
build gem in ouroborus folder
uxjp Feb 19, 2024
260b254
try to add source
uxjp Feb 19, 2024
5b24d18
fix
uxjp Feb 19, 2024
b07c0fa
try https://github.com/features/packages tip
uxjp Feb 19, 2024
b63be6d
fix
uxjp Feb 19, 2024
3766046
fix remove --add
uxjp Feb 19, 2024
7c9ad5b
gem name
uxjp Feb 19, 2024
f91d4cf
fix
uxjp Feb 19, 2024
a07d252
uxjp/self-deployable-docker
uxjp Feb 19, 2024
a776e17
fix
uxjp Feb 19, 2024
0ceec88
comment gem push
uxjp Feb 19, 2024
83751ec
push direto
uxjp Feb 19, 2024
dc8b55a
gem sources --add https://rubygems.pkg.github.com/uxjp
uxjp Feb 19, 2024
831520e
fix
uxjp Feb 19, 2024
00e15a8
fix
uxjp Feb 19, 2024
e64097c
test
uxjp Feb 19, 2024
77c41db
* to publish all gems
uxjp Feb 20, 2024
40b3963
clean script
uxjp Feb 20, 2024
f9004e8
rm chmod 0600 ~/.gem/credentials
uxjp Feb 20, 2024
dbbb87c
chmod 0600 necessary
uxjp Feb 20, 2024
cbfcab2
github actor to decouple workflow from repo
uxjp Feb 20, 2024
ca5965f
filter by tag
uxjp Feb 20, 2024
2d67849
version 2
uxjp Feb 20, 2024
e1ee78e
version 3
uxjp Feb 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/gem_deploy_ouroborus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish Ouroborus Gem

on:
push:
tags:
- 'ouroborus*'

jobs:
publish-gem:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0

- name: Publish Ouroborus Gem to GitHub Registry
run: |
mkdir -p ~/.gem
echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" > ~/.gem/credentials
chmod 0600 ~/.gem/credentials
cd ouroborus
gem build ouroborus.gemspec
gem push --key github --host https://rubygems.pkg.github.com/${{ github.actor }} ouroborus-*.gem
19 changes: 18 additions & 1 deletion ouroborus/lib/ouroborus/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def initialize(name:, image:, tag: 'latest')
@dockerArgs = Args.new
@args = Args.new
@daemon = true
@add_host = ''
end

def daemon?
Expand All @@ -42,6 +43,19 @@ def daemon=(value)
end
end


def add_host?
!@add_host.empty?
end

def add_host=(value)
@add_host = value.to_s
end

def teste
puts "teste >> exec branch jp"
end

def imgTag
"#{@image}:#{@tag}"
end
Expand All @@ -58,6 +72,9 @@ def as_args
else
replaceable << "-i"
end
if add_host?
replaceable << "--add-host=#{@add_host}"
end
replaceable << @dockerArgs << "--name" << @name << imgTag << @args
end

Expand Down Expand Up @@ -142,7 +159,7 @@ def normalizeEnvValue(name, value = nil)

def runCommand(cmd, &block)
if block_given? then
yield cmd
yield cmd, :out
else
cmd
end
Expand Down
30 changes: 22 additions & 8 deletions ouroborus/lib/ouroborus/executor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,64 @@

module Ouroborus
class Executor
def exec(cmd)
def exec(cmd, wrDepot = :out)
puts cmd
true
end

def willExec
return Proc.new { |cmd|
exec cmd
return Proc.new { |cmd, wrDepot|
exec cmd, wrDepot
}
end

def wait
false
end

def execWait(cmd, wrDepot = :out)
exec cmd, wrDepot
wait
end
end

class ShellExecutor < Executor
def initialize(input = nil)
@input = input
@wrDepotMap = {}
end

def <<(str)
@wr.write str
end

def exec(cmd)
def exec(cmd, wrDepot = :out)
@retValue = nil
#wrDepot = wrDepot
p wrDepot
if @input.is_a? IO
@pid = spawn("#{cmd}", :in => @input)
@pid = spawn("#{cmd}", :in => @input, :out => wrDepot)
else
rd, wr = IO.pipe
@pid = spawn("#{cmd}", :in => rd)
@pid = spawn("#{cmd}", :in => rd, :out => wrDepot)
if @input.nil?
@wr = wr
else
wr.write(@input)
end
end
@wrDepotMap[@pid] = wrDepot unless wrDepot == :out

return @pid
end

def wait
unless @retValue.nil?
if @retValue.nil?
Process.wait @pid
@retValue = $?.exitStatus
outWrDepot = @wrDepotMap.delete @pid
outWrDepot.close unless outWrDepot.nil?
@pid = nil
@retValue = $?.exitstatus
end
@retValue == 0
end
Expand Down
2 changes: 1 addition & 1 deletion ouroborus/lib/ouroborus/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Ouroborus
VERSION = "0.0.1"
VERSION = "0.0.3"
end