Preheat oven to 400 degrees Fahrenheit.
Place the tomatoes, sliced onion, serrano or habanero peppers, garlic cloves with skin on, and pineapple on a parchment-lined sheet pan. If desired, lightly spray pineapple and vegetables with olive oil spray.
Roast in a 400-degree oven for about 30 minutes, turning as needed until the edges darken and the onions are tender.
Remove the sheet pan from the oven. Peel and discard the skins from the garlic. Place all the roasted ingredients in a blender and blend until well combined.
Add the chopped cilantro to the blender and pulse a few times to incorporate. Season with Kosher salt and pour into a jar to refrigerate until ready to serve.
Keep refrigerated for up to one week.