From 0d77ca30f2037c2e4e331e545060654d1f040b7f Mon Sep 17 00:00:00 2001 From: Matt Richardson Date: Thu, 5 Nov 2026 05:58:33 +0000 Subject: [PATCH] Convert teamcity-build-stats-scraper to Octopus config-as-code --- .octopus/deployment_process.ocl | 54 ++++++++++++++++++++++++++++++++ .octopus/deployment_settings.ocl | 5 +++ .octopus/schema_version.ocl | 1 + .octopus/variables.ocl | 13 ++++++++ 4 files changed, 73 insertions(+) create mode 100644 .octopus/deployment_process.ocl create mode 100644 .octopus/deployment_settings.ocl create mode 100644 .octopus/schema_version.ocl create mode 100644 .octopus/variables.ocl diff --git a/.octopus/deployment_process.ocl b/.octopus/deployment_process.ocl new file mode 100644 index 0000000..f279263 --- /dev/null +++ b/.octopus/deployment_process.ocl @@ -0,0 +1,54 @@ +step "push-docker-image-tagged-as-version" { + name = "Push Docker image tagged as version" + + action { + excluded_environments = ["feed-internal"] + properties = { + DockerPush.Source.Docker.Image.Name = "#{Source.Docker.Image.FullName}" + DockerPush.Source.Docker.Registry.Hostname = "#{Source.Docker.Registry.Hostname}" + DockerPush.Source.Docker.Registry.Password = "#{Source.Docker.Registry.Password}" + DockerPush.Source.Docker.Registry.Username = "#{Source.Docker.Registry.Username}" + DockerPush.Target.Docker.Image.Name = "#{Target.Docker.Image.Name}:#{Octopus.Release.Number}" + DockerPush.Target.Docker.Registry.Hostname = "#{Target.Docker.Registry.Hostname}" + DockerPush.Target.Docker.Registry.Password = "#{Target.Docker.Registry.Password}" + DockerPush.Target.Docker.Registry.Username = "#{Target.Docker.Registry.Username}" + Octopus.Action.Template.Id = "ActionTemplates-1566" + Octopus.Action.Template.Version = "14" + } + worker_pool = "hosted-ubuntu" + + container { + feed = "docker-packages-octopushq-com" + image = "octopusdeploy/tool-containers/tool-skopeo-cli" + } + } +} + +step "push-docker-image-tagged-as-latest" { + condition = "Variable" + name = "Push Docker image tagged as latest" + properties = { + Octopus.Step.ConditionVariableExpression = "#{if IsPreRelease}false#{else}true#{/if}" + } + + action { + properties = { + DockerPush.Source.Docker.Image.Name = "#{Source.Docker.Image.FullName}" + DockerPush.Source.Docker.Registry.Hostname = "#{Source.Docker.Registry.Hostname}" + DockerPush.Source.Docker.Registry.Password = "#{Source.Docker.Registry.Password}" + DockerPush.Source.Docker.Registry.Username = "#{Source.Docker.Registry.Username}" + DockerPush.Target.Docker.Image.Name = "#{Target.Docker.Image.Name}:latest" + DockerPush.Target.Docker.Registry.Hostname = "#{Target.Docker.Registry.Hostname}" + DockerPush.Target.Docker.Registry.Password = "#{Target.Docker.Registry.Password}" + DockerPush.Target.Docker.Registry.Username = "#{Target.Docker.Registry.Username}" + Octopus.Action.Template.Id = "ActionTemplates-1566" + Octopus.Action.Template.Version = "14" + } + worker_pool = "hosted-ubuntu" + + container { + feed = "docker-packages-octopushq-com" + image = "octopusdeploy/tool-containers/tool-skopeo-cli" + } + } +} \ No newline at end of file diff --git a/.octopus/deployment_settings.ocl b/.octopus/deployment_settings.ocl new file mode 100644 index 0000000..c78322d --- /dev/null +++ b/.octopus/deployment_settings.ocl @@ -0,0 +1,5 @@ +connectivity_policy {} + +versioning_strategy { + template = "#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}" +} \ No newline at end of file diff --git a/.octopus/schema_version.ocl b/.octopus/schema_version.ocl new file mode 100644 index 0000000..a4668c7 --- /dev/null +++ b/.octopus/schema_version.ocl @@ -0,0 +1 @@ +version = 17 \ No newline at end of file diff --git a/.octopus/variables.ocl b/.octopus/variables.ocl new file mode 100644 index 0000000..700231d --- /dev/null +++ b/.octopus/variables.ocl @@ -0,0 +1,13 @@ +variable "IsPreRelease" { + value "#{Octopus.Release.Number | contains -}" {} +} + +variable "Source.Docker.Image.FullName" { + value "#{Source.Docker.Registry.Hostname}/octopusdeploy/#{Octopus.Project.Name}:#{Octopus.Release.Number}" {} +} + +variable "Target.Docker.Image.Name" { + value "#{Target.Docker.Registry.Hostname}/octopusdeploy/#{Octopus.Project.Name}" { + environment = ["feed-internal"] + } +} \ No newline at end of file