diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b698c0d3..198b47c4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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') }} diff --git a/Gemfile.lock b/Gemfile.lock index 7a4f0046..a4d7a441 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - uffizzi-cli (1.0.1) + uffizzi-cli (1.0.2) awesome_print thor tty-prompt diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index a92e3778..6cf268e1 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -56,12 +64,14 @@ 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 @@ -69,6 +79,8 @@ if [ $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 "$@" diff --git a/lib/uffizzi/cli/preview.rb b/lib/uffizzi/cli/preview.rb index 7bed53cc..8800bf87 100644 --- a/lib/uffizzi/cli/preview.rb +++ b/lib/uffizzi/cli/preview.rb @@ -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' @@ -86,13 +95,17 @@ 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 @@ -100,9 +113,12 @@ def handle_create_command(file_path, project_slug, labels) 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 diff --git a/lib/uffizzi/version.rb b/lib/uffizzi/version.rb index 6ff13cc9..71a2d68b 100644 --- a/lib/uffizzi/version.rb +++ b/lib/uffizzi/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module Uffizzi - VERSION = '1.0.1' + VERSION = '1.0.2' end