Skip to content

Deploy purchaserTester: clean up dry-run parameter#4140

Merged
aboedo merged 9 commits into
mainfrom
andy/dry-run-parameter-cleanup-deploy-purchasetester
Aug 7, 2024
Merged

Deploy purchaserTester: clean up dry-run parameter#4140
aboedo merged 9 commits into
mainfrom
andy/dry-run-parameter-cleanup-deploy-purchasetester

Conversation

@aboedo

@aboedo aboedo commented Jul 31, 2024

Copy link
Copy Markdown
Member

Cleans up the deploy purchase tester job's treatment of dry-run: it's now a parameter of the job instead of a separate job entirely.

This is based off of @tonidero and @vegaro's feedback in #4131

@aboedo aboedo added the ci label Jul 31, 2024
@aboedo aboedo self-assigned this Jul 31, 2024
Comment thread .circleci/config.yml Outdated
dry_run:
type: boolean
default: false
environment:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this bit I don't love: I had to make it a parameter of base job rather than the concrete deploy purchase tester job.

It doesn't actually affect anything other than the fact that all jobs get this param now. Maybe that's deceiving in that if you run the other deploy stuff with dry_run: true, it's not an actual dry run, and that's a bit concerning.

But I couldn't find a better way of keeping it specific to the job: the thing is that we inherit all the stuff from the base job, and that includes parameters. If I declare it again, it breaks the config.

I could also not inherit from base job and just copy/paste all of its things, but I feel like that's worse than what we had before.

I'm open to other ideas, especially since overall this doesn't entirely feel better to me than having two almost identical jobs. I'm worried that a future dev could think that dry_run on all jobs actually means dry run.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Right, I certainly don't love it either and it can be confusing... Not aware of any other options off the top of my head, so I agree with you we might as well leave it as 2 separate jobs.

@vegaro vegaro Aug 1, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think the base job should actually be an executor not an alias:

executors:
  macos-executor:
    parameters:
      xcode_version:
        type: string
        default: '15.3'
      install_swiftlint:
        type: boolean
        default: true
    macos:
      xcode: << parameters.xcode_version >>
    resource_class: macos.m1.medium.gen1
    environment:
      CIRCLECI_TESTS_GENERATE_SNAPSHOTS: << pipeline.parameters.generate_snapshots >>
      CIRCLECI_TESTS_GENERATE_REVENUECAT_UI_SNAPSHOTS: << pipeline.parameters.generate_revenuecatui_snapshots >>
    working_directory: ~/purchases-ios
    shell: /bin/bash --login -o pipefail

We can keep the alias so we don't have to update all jobs now:

aliases:
  base-job: &base-job
    executor:
      name: macos-executor

Then you can have custom parameters for the job

 deploy-purchase-tester:
    executor:
      name: macos-executor
    parameters:
      dry_run:
        type: boolean
        default: false

I haven't tested it but the config passes CircleCI validation and it matches CircleCI's documentation

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ohh that's great, I'll give it a shot. Thanks!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated with this approach, looks soooo much better! I hope that it does work. If it does I'll do another follow-up to remove the old base job alias

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I ran into some issues with failing tests when mixing and matching this approach and the alias... And this approach is just better than the alias, so I went ahead and replaced it altogether

@aboedo aboedo requested review from tonidero and vegaro July 31, 2024 19:49
… can use the dry run parameter directly without a duplicate job
@aboedo aboedo force-pushed the andy/dry-run-parameter-cleanup-deploy-purchasetester branch from 4ede01c to 408b5e8 Compare August 6, 2024 20:37
@aboedo

aboedo commented Aug 6, 2024

Copy link
Copy Markdown
Member Author

@RCGitBot please test

Comment thread .circleci/config.yml
resource_class: macos.m1.medium.gen1
macos:
xcode: << parameters.xcode_version >>
executors:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

entirely replaces the base job alias with the executor

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Much better!

Comment thread .circleci/config.yml
Comment on lines -44 to -46
install_swiftlint:
type: boolean
default: true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was honestly a pretty deceiving one - you would have to re-define it as a param, but then also remember to pass it in, which was kinda weird (you'll see what I mean in other comments).
And it's not super useful, so I removed it so we can use it at the job level instead

Comment thread .circleci/config.yml
Comment on lines +398 to +400
executor:
name: macos-executor
xcode_version: '14.3.0'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

regular usage is just so much cleaner

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yea, I think it's not a bad idea to use aliases only sparingly, because of the inflexibility they often introduce.

Comment thread .circleci/config.yml
Comment on lines -435 to -437
install_swiftlint:
type: boolean
default: false

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

these jobs didn't actually install swiftlint, even if you pass in true here, since that happens if you call install dependencies, so you could have thought that it should work and gone crazy trying to figure it out

Comment thread .circleci/config.yml
Comment on lines -491 to +484
<<: *base-job
parameters:
xcode_version:
type: string
default: '14.3.0'
install_swiftlint:
type: boolean
default: false
executor:
name: macos-executor
xcode_version: '14.3.0'

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

again, this just looks nicer, and you don't have to redefine the parameter every time including the type

Comment thread .circleci/config.yml
Comment on lines -503 to +489
install_swiftlint: << parameters.install_swiftlint >>
install_swiftlint: false

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

here I just use the param directly, I feel like this is just much clearer and less error-prone since you don't have to pass in the param

Comment thread .circleci/config.yml
- run:
name: Submit Purchase Tester
command: bundle exec fastlane deploy_purchase_tester dry_run:true
command: bundle exec fastlane deploy_purchase_tester dry_run:<< parameters.dry_run >>

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

and this is the actual meat of the PR: being able to define a parameter at the job level easily and then use it

Comment thread .circleci/config.yml
Comment on lines -1422 to +1385
- deploy-purchase-tester-dry-run
- api-tests
- deploy-purchase-tester:
dry_run: true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

added the param and then moved it to the bottom so it looked a liiiitle nicer

@aboedo

aboedo commented Aug 6, 2024

Copy link
Copy Markdown
Member Author

@RCGitBot please test

@aboedo

aboedo commented Aug 6, 2024

Copy link
Copy Markdown
Member Author

oops in an earlier commit I didn't pass in the dry run param for deploy purchase tester so I did send out a purchase tester build to TF unintended 😅 Not exactly a problem since it's just an internal testing app

@aboedo

aboedo commented Aug 6, 2024

Copy link
Copy Markdown
Member Author

@RevenueCat/coresdk this is ready for another pass

@tonidero tonidero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very nice!!

@JayShortway JayShortway left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice improvement!

@aboedo aboedo merged commit af94fb1 into main Aug 7, 2024
@aboedo aboedo deleted the andy/dry-run-parameter-cleanup-deploy-purchasetester branch August 7, 2024 13:48
jamesrb1 pushed a commit that referenced this pull request Aug 7, 2024
Cleans up the deploy purchase tester job's treatment of `dry-run`: it's
now a parameter of the job instead of a separate job entirely.

This is based off of @tonidero and @vegaro's feedback in #4131
MarkVillacampa pushed a commit that referenced this pull request Aug 7, 2024
**This is an automatic release.**

### Bugfixes
* Fix Paywalls crash on iOS 18 beta (#4154) via Andy Boedo (@aboedo)
### Dependency Updates
* Bump danger from 9.4.3 to 9.5.0 (#4143) via dependabot[bot]
(@dependabot[bot])
* Bump nokogiri from 1.16.6 to 1.16.7 (#4129) via dependabot[bot]
(@dependabot[bot])
* Bump fastlane from 2.221.1 to 2.222.0 (#4130) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Update deployment targets for tests (#4145) via Andy Boedo (@aboedo)
* Deploy purchaserTester: clean up dry-run parameter (#4140) via Andy
Boedo (@aboedo)
* Clean up API Testers (#4141) via Andy Boedo (@aboedo)
* More project structure cleanup (#4131) via Andy Boedo (@aboedo)
* temporarily disables purchasetester deploy (#4133) via Andy Boedo
(@aboedo)
* Fix trigger all tests branch (#4135) via Andy Boedo (@aboedo)
* Clean up XCWorkspace and testing apps (#4111) via Andy Boedo (@aboedo)
* tests trigger: add target-branch parameter to trigger from the right
branch (#4121) via Andy Boedo (@aboedo)
* Re-added the RevenueCatUI tests job on every commit (#4113) via Andy
Boedo (@aboedo)
nyeu pushed a commit that referenced this pull request Oct 2, 2024
Cleans up the deploy purchase tester job's treatment of `dry-run`: it's
now a parameter of the job instead of a separate job entirely.

This is based off of @tonidero and @vegaro's feedback in #4131
nyeu pushed a commit that referenced this pull request Oct 2, 2024
**This is an automatic release.**

### Bugfixes
* Fix Paywalls crash on iOS 18 beta (#4154) via Andy Boedo (@aboedo)
### Dependency Updates
* Bump danger from 9.4.3 to 9.5.0 (#4143) via dependabot[bot]
(@dependabot[bot])
* Bump nokogiri from 1.16.6 to 1.16.7 (#4129) via dependabot[bot]
(@dependabot[bot])
* Bump fastlane from 2.221.1 to 2.222.0 (#4130) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* Update deployment targets for tests (#4145) via Andy Boedo (@aboedo)
* Deploy purchaserTester: clean up dry-run parameter (#4140) via Andy
Boedo (@aboedo)
* Clean up API Testers (#4141) via Andy Boedo (@aboedo)
* More project structure cleanup (#4131) via Andy Boedo (@aboedo)
* temporarily disables purchasetester deploy (#4133) via Andy Boedo
(@aboedo)
* Fix trigger all tests branch (#4135) via Andy Boedo (@aboedo)
* Clean up XCWorkspace and testing apps (#4111) via Andy Boedo (@aboedo)
* tests trigger: add target-branch parameter to trigger from the right
branch (#4121) via Andy Boedo (@aboedo)
* Re-added the RevenueCatUI tests job on every commit (#4113) via Andy
Boedo (@aboedo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants