The ordinance, enacted yesterday, states:
Each [contract] Awarding Authority shall require that a Person fully disclose prior to entering into a Contract, all of its and its Subsidiaries' contracts with or Sponsorships of the NRA.
The disclosure required under this section shall continue throughout the term of the Contract, thereby obligating a Person to update its disclosure each time the Person or its Subsidiary contracts with or enters into a Sponsorship with the NRA.
And it makes clear that it is motivated by the NRA's political advocacy, as you can see from the recitals at the start of the ordinance (e.g., "the NRA leadership, with the financial support of its dues paying members, continues to lobby against gun safety regulations").
But the Supreme Court has made clear that the First Amendment generally bans (see O'Hare Truck Service, Inc. v. City of Northlake (1997)) the government from "retaliat[ing] against a contractor, or a regular provider of services, for the exercise of rights of political association"—precisely what the ordinance implicitly threatens.
And the Court has also made clear that compulsory disclosures of political association is also presumptively unconstitutional, precisely because they deter such association, see Shelton v. Tucker (1960), a case requiring such disclosures of schoolteachers:
Even if there were no disclosure to the general public, the pressure upon a teacher to avoid any ties which might displease those who control his professional destiny would be constant and heavy. Public exposure, bringing with it the possibility of public pressures upon school boards to discharge teachers who belong to unpopular or minority organizations, would simply operate to widen and aggravate the impairment of constitutional liberty.
That case involved government employees, but the logic of O'Hare, which applied government employee First Amendment precedents to government contractors, makes clear that it applies to government contractors, too.
So the ordinance violates the First Amendment just because of its disclosure requirement alone. And it also invites First Amendment discrimination lawsuits by individual contractors who are denied contracts after they disclose that they deal with the NRA, just as an employer's asking applicants to disclose their religion would invite religious discrimination lawsuits by applicants who aren't hired (and even in the absence of specific regulations barring such question).
Naturally, the same would be true if a city asked companies whether they do business with or sponsor the NAACP, the ACLU, or any other group because of the group's political advocacy. But note that this principle applies only when the disfavored groups are selected because of what they say or what laws they support; the analysis would be different if an ordinance focuses on nonspeech actions. Asking companies where they have any contracts for building a border wall, for instance, would not violate the First Amendment, because such building isn't protected by the First Amendment. (Some such queries might in some situations violate other rules, such as those related to federal preemption, but that's a separate matter.)