-
Notifications
You must be signed in to change notification settings - Fork 329
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
Deploy purchaserTester: clean up dry-run parameter #4140
Deploy purchaserTester: clean up dry-run parameter #4140
Conversation
.circleci/config.yml
Outdated
dry_run: | ||
type: boolean | ||
default: false | ||
environment: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
… can use the dry run parameter directly without a duplicate job
4ede01c
to
408b5e8
Compare
@RCGitBot please test |
aliases: | ||
base-job: &base-job | ||
resource_class: macos.m1.medium.gen1 | ||
macos: | ||
xcode: << parameters.xcode_version >> | ||
executors: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much better!
install_swiftlint: | ||
type: boolean | ||
default: true |
There was a problem hiding this comment.
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
executor: | ||
name: macos-executor | ||
xcode_version: '14.3.0' |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
install_swiftlint: | ||
type: boolean | ||
default: false |
There was a problem hiding this comment.
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
<<: *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' |
There was a problem hiding this comment.
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
install_swiftlint: << parameters.install_swiftlint >> | ||
install_swiftlint: false |
There was a problem hiding this comment.
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
@@ -1233,7 +1193,7 @@ jobs: | |||
- update-spm-installation-commit | |||
- 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 >> |
There was a problem hiding this comment.
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
- deploy-purchase-tester-dry-run | ||
- api-tests | ||
- deploy-purchase-tester: | ||
dry_run: true |
There was a problem hiding this comment.
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
@RCGitBot please test |
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 |
@RevenueCat/coresdk this is ready for another pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement!
**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)
**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)
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