Skip to content

Commit

Permalink
Merge pull request #1360 from guardian/aa/rm-teamcity
Browse files Browse the repository at this point in the history
Remove TeamCity
  • Loading branch information
akash1810 authored Dec 18, 2023
2 parents 4566492 + b10afaf commit 99eb293
Show file tree
Hide file tree
Showing 14 changed files with 4 additions and 295 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

AMIgo is an application for baking AMIs (Amazon Machine Images).
For information on how to use Amigo baked AMIs with Riffraff check [here](./docs/riffraff-integration.md).
This project is built in [teamcity](https://teamcity.gutools.co.uk/buildConfiguration/Tools_Amigo).
This project is built with GitHub Actions.

## Terminology

Expand Down
10 changes: 2 additions & 8 deletions app/housekeeping/MarkOldUnusedBakesForDeletion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,10 @@ object MarkOldUnusedBakesForDeletion {
duration.getStandardDays > MAX_AGE
}

// Exclude TeamCity Agent AMIs, which have been incorrectly assumed to be unused in the past. This happens
// because TeamCity Agents are typically terminated overnight and are not linked to a launch configuration.
val oldBakesExcludingTeamCityAgents = oldBakes.filterNot { bake =>
bake.recipe.id.value.startsWith("teamcity-agent")
}

val recipeUsage = getRecipeUsage(oldBakesExcludingTeamCityAgents)
val recipeUsage = getRecipeUsage(oldBakes)
val usedBakes = recipeUsage.bakeUsage.map(_.bake).distinct.toSet

oldBakesExcludingTeamCityAgents -- usedBakes
oldBakes -- usedBakes
}
}

Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ lazy val root = (project in file("."))
lazy val buildInfo = BuildInfo(baseDirectory.value)

// so this next one is constant to avoid it always recompiling on dev machines.
// we only really care about build time on teamcity, when a constant based on when
// we only really care about build time in CI, when a constant based on when
// it was loaded is just fine
lazy val buildTime: String = DateTimeFormatter.ISO_OFFSET_DATE_TIME
.format(ZonedDateTime.now(ZoneId.of("UTC")))
Expand Down
3 changes: 0 additions & 3 deletions roles/teamcity-agent/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions roles/teamcity-agent/defaults/main.yml

This file was deleted.

10 changes: 0 additions & 10 deletions roles/teamcity-agent/files/awsconfig_cleanup.sh

This file was deleted.

3 changes: 0 additions & 3 deletions roles/teamcity-agent/files/install_vars

This file was deleted.

22 changes: 0 additions & 22 deletions roles/teamcity-agent/files/teamcityagent.service

This file was deleted.

21 changes: 0 additions & 21 deletions roles/teamcity-agent/meta/main.yml

This file was deleted.

166 changes: 0 additions & 166 deletions roles/teamcity-agent/tasks/main.yml

This file was deleted.

6 changes: 0 additions & 6 deletions roles/teamcity-ivy-cache/README.md

This file was deleted.

4 changes: 0 additions & 4 deletions roles/teamcity-ivy-cache/files/sync-ivy-cache

This file was deleted.

28 changes: 0 additions & 28 deletions roles/teamcity-ivy-cache/tasks/main.yml

This file was deleted.

20 changes: 0 additions & 20 deletions test/housekeeping/MarkOldUnusedBakesForDeletionSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -147,24 +147,4 @@ class MarkOldUnusedBakesForDeletionSpec extends AnyFlatSpec with Matchers {
markedBakes.size shouldEqual 1
markedBakes.map(_.bakeId) shouldEqual Set(BakeId(RecipeId("recipe-1"), 1))
}

it should "not include TeamCity agent AMIs, even if they are old" in {
val housekeepingDate = new DateTime(2018, 7, 12, 0, 0, 0, DateTimeZone.UTC)
val recipeIds = Set(RecipeId("teamcity-agent-focal"))
val oldTeamCityAgent = fixtureBake(
fixtureRecipe("teamcity-agent-focal", oldDate),
Some(AmiId("ami-1")),
oldDate
)
def getBakesWithTeamCityAgent(recipeId: RecipeId): Iterable[Bake] =
Iterable(oldTeamCityAgent)
val markedBakes = MarkOldUnusedBakesForDeletion.getOldUnusedBakes(
recipeIds,
housekeepingDate,
getBakesWithTeamCityAgent,
getEmptyRecipeUsage
)

markedBakes.size shouldEqual 0
}
}

0 comments on commit 99eb293

Please sign in to comment.