Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate x-uffizzi options #378

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 6 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ bin/rails test

In order to add a new migration do the following steps:

1. Add a new migration inside the core
1. Add a new migration to `core/db/migrate`.
2. Run the command inside the `web` container

```bash
rake uffizzi_core:install
```

This command copies the new migration to the `db/migrate` folder

3. Migrate both `core` and `web` with
```
bundler exec rails db:migrate
```
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class UffizziCore::Api::Cli::V1::Deployment::CreateForm < UffizziCore::Deploymen
:kind,
:dockerfile_path,
:dockerfile_context_path,
:deploy_preview_when_pull_request_is_opened,
:delete_preview_when_pull_request_is_closed,
:deploy_preview_when_image_tag_is_created,
:delete_preview_when_image_tag_is_updated,
:share_to_github,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ class UffizziCore::Api::Cli::V1::Deployment::UpdateForm < UffizziCore::Deploymen
:kind,
:dockerfile_path,
:dockerfile_context_path,
:deploy_preview_when_pull_request_is_opened,
:delete_preview_when_pull_request_is_closed,
:deploy_preview_when_image_tag_is_created,
:delete_preview_when_image_tag_is_updated,
:share_to_github,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ def build_repo_attributes(container_data)

def set_continuous_preview_attributes_to_repo(repo_attributes, global_data, container_data)
condition_attributes = [
:deploy_preview_when_pull_request_is_opened,
:delete_preview_when_pull_request_is_closed,
:deploy_preview_when_image_tag_is_created,
:delete_preview_when_image_tag_is_updated,
:share_to_github,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ def parse(continuous_preview_data)
return {} if continuous_preview_data.nil?

{
deploy_preview_when_pull_request_is_opened: trigger_value(continuous_preview_data, 'deploy_preview_when_pull_request_is_opened'),
delete_preview_when_pull_request_is_closed: trigger_value(continuous_preview_data, 'delete_preview_when_pull_request_is_closed'),
deploy_preview_when_image_tag_is_created: trigger_value(continuous_preview_data, 'deploy_preview_when_image_tag_is_created'),
delete_preview_when_image_tag_is_updated: trigger_value(continuous_preview_data, 'delete_preview_when_image_tag_is_updated'),
delete_preview_after: delete_preview_after_value(continuous_preview_data['delete_preview_after']),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class DeleteObsoleteFieldsFromRepo < ActiveRecord::Migration[6.1]
def change
remove_columns :uffizzi_core_repos, :deploy_preview_when_pull_request_is_opened, :delete_preview_when_pull_request_is_closed,
type: :boolean
end
end
2 changes: 0 additions & 2 deletions core/test/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@
t.boolean "share_to_github"
t.integer "delete_preview_after"
t.string "tag_pattern_deprecated"
t.boolean "deploy_preview_when_pull_request_is_opened"
t.boolean "delete_preview_when_pull_request_is_closed"
t.index ["project_id"], name: "index_repos_on_project_id"
end

Expand Down
2 changes: 0 additions & 2 deletions core/test/factories/repos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
branch
description
repository_id { generate(:number) }
deploy_preview_when_pull_request_is_opened { false }
delete_preview_when_pull_request_is_closed { false }
deploy_preview_when_image_tag_is_created { false }
delete_preview_when_image_tag_is_updated { false }
delete_preview_after { nil }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

# This migration comes from uffizzi_core (originally 20230203071725)
class DeleteObsoleteFieldsFromRepo < ActiveRecord::Migration[6.1]
def change
remove_columns :uffizzi_core_repos, :deploy_preview_when_pull_request_is_opened, :delete_preview_when_pull_request_is_closed,
type: :boolean
end
end
2 changes: 0 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,6 @@
t.boolean "share_to_github"
t.integer "delete_preview_after"
t.string "tag_pattern_deprecated"
t.boolean "deploy_preview_when_pull_request_is_opened"
t.boolean "delete_preview_when_pull_request_is_closed"
t.index ["project_id"], name: "index_repos_on_project_id"
end

Expand Down
18 changes: 8 additions & 10 deletions uffizzi-compose-example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@ services:
context: https://github.com/UffizziCloud/example-voting-result:main
dockerfile: Dockerfile

continuous_preview:
deploy_preview_when_pull_request_is_opened: false
delete_preview_when_pull_request_is_closed: false
deploy_preview_for_image_tag_PR_#-branchname: true
delete_preview_when_pull_request_is_closed: false
delete_preview_in_x_hours: 24
share_to_github: true
x-uffizzi:
continuous_preview:
deploy_preview_when_image_tag_is_created: true
delete_preview_after: 24
share_to_github: true

ingress:
service: nginx
port: 8080
ingress:
service: nginx
port: 8080