Skip to content

Commit

Permalink
Change version to 1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeny authored and zipofar committed Sep 21, 2022
1 parent d5cfdfb commit 2abe384
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 62 deletions.
58 changes: 0 additions & 58 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,50 +9,8 @@ on:
types: [opened,synchronize,reopened]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.2
bundler-cache: true
- name: Run rubocop
run: bundle exec rubocop
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.2
bundler-cache: true
- name: Run tests
run: bundle exec rake test
test-installation:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.2
bundler-cache: true
- name: Build Image
uses: docker/build-push-action@v2
with:
tags: uffizzi/cli:test-install
platforms: linux/amd64
- name: Display uffizzi-cli version
run: docker run --rm uffizzi/cli:test-install version
build-and-push-some-branches:
runs-on: ubuntu-latest
needs:
- lint
- test
- test-installation
if: ${{ github.ref_name == 'main' || github.ref_name == 'qa' || github.ref_name == 'develop' || github.event_name == 'pull_request' }}
steps:
- name: Checkout
Expand Down Expand Up @@ -91,19 +49,3 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: uffizzi/cli
notify:
needs:
- lint
- test
- build-and-push-some-branches
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- uses: technote-space/workflow-conclusion-action@v2
- uses: 8398a7/action-slack@v3
with:
status: ${{ env.WORKFLOW_CONCLUSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: ${{ (github.ref_name == 'main' && env.WORKFLOW_CONCLUSION == 'success') || ((github.ref_name == 'main' || github.ref_name == 'qa' || github.ref_name == 'develop') && env.WORKFLOW_CONCLUSION == 'failure') }}
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
uffizzi-cli (1.0.1)
uffizzi-cli (1.0.2)
awesome_print
thor
tty-prompt
Expand Down
12 changes: 12 additions & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/bin/sh

set -e # Exit immediately if anything below exits with non-zero status.
echo $UFFIZZI_SERVER
echo $UFFIZZI_USER
echo $UFFIZZI_PASSWORD

if
[ $UFFIZZI_USER ] &&
[ $UFFIZZI_SERVER ] &&
[ $UFFIZZI_PASSWORD ]
then
echo "USE PASSWORD"
uffizzi login --username "${UFFIZZI_USER}" --server "${UFFIZZI_SERVER}"
if [ $UFFIZZI_PROJECT ]
then
Expand All @@ -17,6 +21,7 @@ else
[ $REQUEST_TOKEN ] &&
[ $REQUEST_TOKEN_URL ]
then
echo "USE TOKEN"
OIDC_TOKEN=$(curl -sLS "${REQUEST_TOKEN_URL}&audience=uffizzi" -H "User-Agent: actions/oidc-client" -H "Authorization: Bearer $REQUEST_TOKEN")
uffizzi login_by_identity_token --token "${OIDC_TOKEN}" --server "${UFFIZZI_SERVER}"
else
Expand All @@ -32,6 +37,7 @@ if
[ $DOCKERHUB_PASSWORD ]
then
uffizzi connect docker-hub --update-credential-if-exists
echo "uffizzi connect docker-hub --update-credential-if-exists"
fi

if
Expand All @@ -40,6 +46,7 @@ if
[ $DOCKER_REGISTRY_URL ]
then
uffizzi connect docker-registry --update-credential-if-exists
echo "uffizzi connect docker-registry --update-credential-if-exists"
fi

if
Expand All @@ -48,6 +55,7 @@ if
[ $ACR_REGISTRY_URL ]
then
uffizzi connect acr --update-credential-if-exists
echo "uffizzi connect acr --update-credential-if-exists"
fi

if
Expand All @@ -56,19 +64,23 @@ if
[ $AWS_REGISTRY_URL ]
then
uffizzi connect ecr --update-credential-if-exists
echo "uffizzi connect ecr --update-credential-if-exists"
fi

if
[ $GCLOUD_SERVICE_KEY ]
then
uffizzi connect gcr --update-credential-if-exists
echo "uffizzi connect gcr --update-credential-if-exists"
fi

if
[ $GITHUB_USERNAME ] &&
[ $GITHUB_ACCESS_TOKEN ]
then
uffizzi connect ghcr --update-credential-if-exists
echo "uffizzi connect ghcr --update-credential-if-exists"
fi

echo "START UFFIZZI COMMAND"
exec uffizzi "$@"
20 changes: 18 additions & 2 deletions lib/uffizzi/cli/preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,20 @@ def events(deployment_name)
private

def run(command, file_path: nil, deployment_name: nil)
Uffizzi.ui.output_format = options[:output]
Uffizzi.ui.say('====RUN====')
Uffizzi.ui.say('====RUN====')
Uffizzi.ui.say('====RUN====')
Uffizzi.ui.say(options.to_s)
# Uffizzi.ui.output_format = options[:output]
Uffizzi.ui.say('0====RUN====')
raise Uffizzi::Error.new('You are not logged in.') unless Uffizzi::AuthHelper.signed_in?
Uffizzi.ui.say('1====RUN====')
raise Uffizzi::Error.new('This command needs project to be set in config file') unless CommandService.project_set?(options)
Uffizzi.ui.say('2====RUN====')

project_slug = options[:project].nil? ? ConfigFile.read_option(:project) : options[:project]
Uffizzi.ui.say('3====RUN====')
Uffizzi.ui.say(project_slug)

case command
when 'list'
Expand Down Expand Up @@ -86,23 +95,30 @@ def handle_list_command(project_slug, filter)
end

def handle_create_command(file_path, project_slug, labels)
Uffizzi.ui.disable_stdout unless options[:output].nil?
Uffizzi.ui.say('====RUN=handle_create_command===')
# Uffizzi.ui.disable_stdout unless options[:output].nil?

params = prepare_params(file_path, labels)
Uffizzi.ui.say(params)

response = create_deployment(ConfigFile.read_option(:server), project_slug, params)
Uffizzi.ui.say(response)

if !ResponseHelper.created?(response)
Uffizzi.ui.say('if !ResponseHelper.created?(response)')
ResponseHelper.handle_failed_response(response)
end

deployment = response[:body][:deployment]
Uffizzi.ui.say("Preview with ID deployment-#{deployment[:id]} was created.")

success = PreviewService.run_containers_deploy(project_slug, deployment)
Uffizzi.ui.say(success)

display_deployment_data(deployment, success)
rescue SystemExit, Interrupt, SocketError
Uffizzi.ui.say('RESCUE')
Uffizzi.ui.say(response)
deployment_id = response[:body][:deployment][:id]
handle_preview_interruption(deployment_id, ConfigFile.read_option(:server), project_slug)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/uffizzi/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Uffizzi
VERSION = '1.0.1'
VERSION = '1.0.2'
end

0 comments on commit 2abe384

Please sign in to comment.