The true strike cantrip can be cast as an action to grant yourself advantage on the first attack roll against the target on your next turn.
The Samurai fighter's Fighting Spirit feature description says (XGtE, p. 31):
As a bonus action on your turn, you can give yourself advantage on weapon attack rolls until the end of the current turn.
The Rapid Strike feature description says (emphasis mine):
If you take the Attack action on your turn and have advantage on an attack roll against one of the targets, you can forgo the advantage for that roll to make an additional weapon attack against that target, as part of the same action. You can do so no more than once per turn.
Say I have a level 20 Samurai fighter, and I've taken the Magic Initiate feat to learn the true strike cantrip. Can I cast true strike on turn 1, then on turn 2, use the Rapid Strike feature to turn it into 2 attacks, giving me 5 regular attacks + 4 more from Action Surge, then use my bonus action to use Fighting Spirit?
Are all 9 attacks all at advantage? The description of Rapid Strike says "if you take the Attack action on your turn". As it doesn't specify when on your turn you're doing it, is it allowed to then give the attack advantage again?