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

TBT-137 Be able to use environment variables across different repos #1350

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

tonoyansergey-devt
Copy link

@tonoyansergey-devt tonoyansergey-devt commented Jan 15, 2025

Pull Request contains temporary change of migration repository branch, should be reverted before merge.

Copy link
Collaborator

@gbarc-dt gbarc-dt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

specs!


def account_env_vars
return @account_env_vars if defined? @account_env_vars
@account_env_vars = Models::AccountEnvVar.where(owner_type: 'User', owner_id: id)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use ||=instead

def run!
raise LoginRequired unless access_control.full_access_or_logged_in?

query(:account_env_var).delete(params, access_control.user)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check user roles here, might not be authorized to delete (same for create)

@@ -2,7 +2,7 @@ language: ruby
group: edge

import:
- travis-ci/build-configs:db-setup.yml
- travis-ci/build-configs:db-setup.yml@TBT-137-account-env-vars
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is not needed I have mentioned that in the PR description so we don't merge it by accident - #1350 (comment)

I added that to be able to test on staging, we should revert it before merge.

Comment on lines +29 to +37
- sudo apt-get install -yq --no-install-suggests --no-install-recommends postgresql-common
- sudo service postgresql stop
- sudo apt install -yq --no-install-suggests --no-install-recommends postgresql-11 postgresql-client-11
- sed -e 's/^port.*/port = 5432/' /etc/postgresql/11/main/postgresql.conf > postgresql.conf
- sudo chown postgres postgresql.conf
- sudo mv postgresql.conf /etc/postgresql/11/main
- sudo cp /etc/postgresql/{10,11}/main/pg_hba.conf
- sudo service postgresql stop
- sudo systemctl start postgresql@11-main
Copy link
Contributor

@murtaza-swati murtaza-swati Feb 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are these changes related to TBT-137? I don't know why this is added here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is not needed I have mentioned that in the PR description so we don't merge it by accident - #1350 (comment)

I added that to be able to test on staging, we should revert it before merge.

params['public']
)

Travis::API::V3::Models::Audit.create!(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it not be better if it's done in some callback on the model like after_create.
If it's absolutely meant here, then I think it should be done in transaction so this 'AccountEnvVar' create and related 'Audit' create either both succeed or both fail together.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented. Please check.

env_var
end

def delete(params, current_user)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an audit entry would be needed here too, isn't it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented. Please check.

@@ -350,6 +350,16 @@ module Routes
delete :delete
end

hidden_resource :account_env_var do
route '/account_env_var'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the name be plural like account_env_vars?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, correct , changed the create path to /account_env_vars.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add the association with account_env_var here for convenience?
like:
has_many :account_env_vars, as: :owner
what do you think?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for remark added.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similarly here too - maybe add the association with account_env_var?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for remark added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants