Skip to content

Commit

Permalink
deploy safer
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jun 27, 2024
1 parent a9ffda6 commit 7941e06
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
9 changes: 4 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@

set -e

if [ -e /code/z/j ]; then
git --git-dir=/code/z/j/.git pull
else
git clone git@github.com:zerocracy/j.git /code/z
if [ ! -e /code/z/j ]; then
echo "You should git clone git@github.com:zerocracy/j.git to /code/z/j"
exit 1
fi
rm -rf j
mkdir j
Expand All @@ -44,7 +43,7 @@ git add config.yml
git add Gemfile.lock
git add .gitignore
git commit -m 'config.yml for heroku'
trap 'git reset HEAD~1 && rm config.yml && git checkout -- .gitignore && git checkout -- Gemfile.lock' EXIT
trap 'git reset HEAD~1 && rm -rf j && rm config.yml && git checkout -- .gitignore && git checkout -- Gemfile.lock' EXIT
git push heroku master -f
rm -f target/pgsql-config.yml
bundle exec rake liquibase
11 changes: 10 additions & 1 deletion objects/baza/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def start(pause = 15)
stdout = Loog::Buffer.new
code = run(job, input, stdout)
uuid = code.zero? ? @fbs.save(input) : nil
job.finish!(uuid, stdout.to_s, code, ((Time.now - start) * 1000).to_i)
job.finish!(uuid, escaped(job, stdout.to_s), code, ((Time.now - start) * 1000).to_i)
@loog.info("Job ##{job.id} finished, exit=#{code}!")
end
end
Expand Down Expand Up @@ -105,4 +105,13 @@ def run(job, input, stdout)
stdout.error(Backtrace.new(e))
1
end

# Replace all secrets in the text with *****
def escaped(job, stdout)
e = stdout
job.secrets.each do |s|
e.gsub(s['value'], '********')
end
e
end
end

0 comments on commit 7941e06

Please sign in to comment.