diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d86253e2..9b8b7464 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 +``` diff --git a/core/app/forms/uffizzi_core/api/cli/v1/deployment/create_form.rb b/core/app/forms/uffizzi_core/api/cli/v1/deployment/create_form.rb index 8c3e03dc..cb708996 100644 --- a/core/app/forms/uffizzi_core/api/cli/v1/deployment/create_form.rb +++ b/core/app/forms/uffizzi_core/api/cli/v1/deployment/create_form.rb @@ -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, diff --git a/core/app/forms/uffizzi_core/api/cli/v1/deployment/update_form.rb b/core/app/forms/uffizzi_core/api/cli/v1/deployment/update_form.rb index e20ca37e..083ab0e7 100644 --- a/core/app/forms/uffizzi_core/api/cli/v1/deployment/update_form.rb +++ b/core/app/forms/uffizzi_core/api/cli/v1/deployment/update_form.rb @@ -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, diff --git a/core/app/services/uffizzi_core/compose_file/builders/container_builder_service.rb b/core/app/services/uffizzi_core/compose_file/builders/container_builder_service.rb index bb85a647..c03e901f 100644 --- a/core/app/services/uffizzi_core/compose_file/builders/container_builder_service.rb +++ b/core/app/services/uffizzi_core/compose_file/builders/container_builder_service.rb @@ -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, diff --git a/core/app/services/uffizzi_core/compose_file/parsers/continuous_preview_parser_service.rb b/core/app/services/uffizzi_core/compose_file/parsers/continuous_preview_parser_service.rb index 5ccb15ce..2cb3223d 100644 --- a/core/app/services/uffizzi_core/compose_file/parsers/continuous_preview_parser_service.rb +++ b/core/app/services/uffizzi_core/compose_file/parsers/continuous_preview_parser_service.rb @@ -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']), diff --git a/core/db/migrate/20230203071725_delete_obsolete_fields_from_repo.rb b/core/db/migrate/20230203071725_delete_obsolete_fields_from_repo.rb new file mode 100644 index 00000000..77daf6ff --- /dev/null +++ b/core/db/migrate/20230203071725_delete_obsolete_fields_from_repo.rb @@ -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 diff --git a/core/test/dummy/db/schema.rb b/core/test/dummy/db/schema.rb index b4da150a..b0c5f4da 100644 --- a/core/test/dummy/db/schema.rb +++ b/core/test/dummy/db/schema.rb @@ -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 diff --git a/core/test/factories/repos.rb b/core/test/factories/repos.rb index f8ef905b..66e5383b 100644 --- a/core/test/factories/repos.rb +++ b/core/test/factories/repos.rb @@ -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 } diff --git a/db/migrate/20230203134111_delete_obsolete_fields_from_repo.uffizzi_core.rb b/db/migrate/20230203134111_delete_obsolete_fields_from_repo.uffizzi_core.rb new file mode 100644 index 00000000..29fa5570 --- /dev/null +++ b/db/migrate/20230203134111_delete_obsolete_fields_from_repo.uffizzi_core.rb @@ -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 diff --git a/db/schema.rb b/db/schema.rb index 334c076d..765abfaf 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 diff --git a/uffizzi-compose-example.yml b/uffizzi-compose-example.yml index 292568f8..e64d80d0 100644 --- a/uffizzi-compose-example.yml +++ b/uffizzi-compose-example.yml @@ -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