Send account validation email when pipeline fails
What does this MR do and why?
This MR is part of #346233 (closed).
It implements sending of Account Validation email (introduced in !75080 (merged)) when a pipeline fails due to an unverified account (of the pipeline creator).
Why are we sending this email?
We want to check if sending this email increases initial verify usage (see #346233 (closed)).
Note: tracking will be implemented in a separate MR.
Screenshots or screen recordings
- Create a project
- Start a pipeline by adding a
.gitlab-ci.yml
to the project - Pipeline fails because user's account is not verified
- Account Validation email is sent
How to set up and validate locally
Set up
-
Ensure your GDK instance is EE (you might have to upload a License)
-
Ensure the following feature flags are enabled:
account_validation_email
ci_require_credit_card_on_trial_plan
# In Rails console (run `bin/rails c` in `/path/to/gitlab-development-kit/gitlab`) > Feature.enable(:account_validation_email) > Feature.enable(:ci_require_credit_card_on_trial_plan)
-
Create a test user and group
# In Rails console > user = FactoryBot.create(:user, username: 'user_dec1_1', email: 'user_dec1_1@example.org', password: '12345678') # Create a new Group & assign the new user as its owner > group = FactoryBot.create(:group) > group.add_owner(user)
-
Create a trial subscription for the group
# In Rails console # Turn on billing features in the app > ApplicationSetting.first.update(check_namespace_plan: true) # Find or create the Ultimate plan > plan = Plan.create_with(title: 'Ultimate (Formerly Gold)').find_or_create_by(name: :ultimate) # Create a new trial subscription for the Group > GitlabSubscription.create(namespace: group, hosted_plan: plan, seats: 10, start_date: Date.current, end_date: Date.current.advance(years: 1), trial: true, trial_starts_on: Date.current, trial_ends_on: Date.current.advance(days: 30))
-
Ensure that your test user is opted-in to receive marketing emails Go to
http://localhost:3000/-/profile/notifications
and checkReceive product marketing emails
checkbox
Validate
-
Login with your test user
-
Navigate to the test group
-
Create a project
-
Add a
.gitlab-ci.yml
to the project to start a pipeline -
Validate that the pipeline for the commit fails with the reason
Pipeline failed due to the user not being verified
-
Go to letter opener (http://127.0.0.1:3000/rails/letter_opener/) and validate that the email has been sent
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.