Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
zipofar committed Jul 11, 2023
2 parents 512623a + b6e99ca commit 0c1a456
Show file tree
Hide file tree
Showing 8 changed files with 87 additions and 62 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
workflow_call:
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: false
- 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
63 changes: 8 additions & 55 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,18 @@ on:
branches:
- qa
- develop
- main
pull_request:
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: false
- 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
code-quality:
name: Test and Lint
uses: ./.github/workflows/code-quality.yml
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' }}
- code-quality
if: ${{ github.ref_name == 'qa' || github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down Expand Up @@ -93,17 +55,8 @@ jobs:
repository: uffizzi/cli
notify:
needs:
- lint
- test
- code-quality
- 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') }}
uses: ./.github/workflows/notify.yml
secrets: inherit
14 changes: 14 additions & 0 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
workflow_call:
jobs:
notify:
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') }}
18 changes: 15 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
name: Uffizzi CLI Release
on:
push:
tags:
- 'v*.*.*'
release:
types: [created, published]

jobs:
code-quality:
name: Test and Lint
uses: ./.github/workflows/code-quality.yml
release:
runs-on: ubuntu-latest
needs:
- code-quality
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -29,3 +34,10 @@ jobs:
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
notify:
needs:
- code-quality
- build-and-push-some-branches
if: ${{ always() }}
uses: ./.github/workflows/notify.yml
secrets: inherit
6 changes: 3 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
uffizzi-cli (2.0.0)
uffizzi-cli (2.0.1)
activesupport
awesome_print
faker
Expand Down Expand Up @@ -36,7 +36,7 @@ GEM
factory_bot (6.2.0)
activesupport (>= 5.0.0)
fakefs (1.8.0)
faker (2.20.0)
faker (3.2.0)
i18n (>= 1.8.11, < 2)
hashdiff (1.0.1)
i18n (1.8.11)
Expand Down Expand Up @@ -99,7 +99,7 @@ GEM
rubocop-rake (0.6.0)
rubocop (~> 1.0)
ruby-progressbar (1.11.0)
securerandom (0.1.0)
securerandom (0.2.2)
sentry-ruby (5.9.0)
concurrent-ruby (~> 1.0, >= 1.0.2)
thor (1.2.2)
Expand Down
4 changes: 4 additions & 0 deletions lib/uffizzi/cli/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,16 @@ def handle_create_command(project_slug)

return ResponseHelper.handle_failed_response(response) unless ResponseHelper.created?(response)

spinner = TTY::Spinner.new("[:spinner] Creating cluster #{cluster_name}...", format: :dots)
spinner.auto_spin
cluster_data = ClusterService.wait_cluster_deploy(project_slug, cluster_name)

if ClusterService.failed?(cluster_data[:state])
spinner.error
Uffizzi.ui.say_error_and_exit("Cluster with name: #{cluster_name} failed to be created.")
end

spinner.success
handle_succeed_create_response(cluster_data, options[:kubeconfig])
rescue SystemExit, Interrupt, SocketError
handle_interruption(cluster_data, ConfigFile.read_option(:server), project_slug)
Expand Down
1 change: 1 addition & 0 deletions lib/uffizzi/services/cluster_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def wait_cluster_deploy(project_slug, cluster_name)
return Uffizzi::ResponseHelper.handle_failed_response(response) unless Uffizzi::ResponseHelper.ok?(response)

cluster_data = response.dig(:body, :cluster)

return cluster_data unless deploying?(cluster_data[:state])

sleep(5)
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 = '2.0.1'
VERSION = '2.0.2'
end

0 comments on commit 0c1a456

Please sign in to comment.