8 Commits

Author SHA1 Message Date
5562bd3173 remove container 2023-11-23 14:52:37 -06:00
4fc4e646e7 Update variables 2023-11-23 14:50:35 -06:00
a229cc96b2 Update variables 2023-11-23 14:47:49 -06:00
22ab70e34a Update variables 2023-11-23 14:20:56 -06:00
94964dea8c update 2023-11-23 13:52:50 -06:00
48ea006ca7 Update variables 2023-11-23 13:32:36 -06:00
admin
048c69938a initial commit 2023-11-23 13:11:19 -06:00
c1d2bb7de2 update 2023-11-23 12:46:58 -06:00
7 changed files with 138 additions and 2 deletions

View File

@@ -1,5 +1,7 @@
include:
- project: 'developerdurp/yml'
ref: 'main'
file: 'pipelines/gitlab_generic_packages.yml'
- local: .variables.yml
file:
- 'pipelines/gitlab_generic_packages.yml'
#- 'pipelines/docker-build-generic.yml'
- local: .variables.yml

View File

@@ -0,0 +1,101 @@
step "plan-to-apply-a-terraform-template" {
name = "Terraform Plan"
action "terraform-plan" {
action_type = "Octopus.TerraformPlan"
environments = ["development"]
is_required = true
properties = {
Octopus.Action.GoogleCloud.ImpersonateServiceAccount = "False"
Octopus.Action.GoogleCloud.UseVMServiceAccount = "True"
Octopus.Action.Package.DownloadOnTentacle = "False"
Octopus.Action.Package.FeedId = "nexus-nuget"
Octopus.Action.Package.PackageId = "#{TF_PACKAGE}"
Octopus.Action.RunOnServer = "true"
Octopus.Action.Script.ScriptSource = "Package"
Octopus.Action.Terraform.AdditionalInitParams = "#{TF_INIT}"
Octopus.Action.Terraform.AllowPluginDownloads = "True"
Octopus.Action.Terraform.AzureAccount = "False"
Octopus.Action.Terraform.EnvVariables = "{\"TF_VAR_GITLAB_PROJECT_ID\":\"#{GITLAB_PROJECT_ID}\",\"TF_VAR_GITLAB_PROJECT_NAME\":\"#{GITLAB_PROJECT_NAME}\",\"TF_VAR_GITLAB_SHARED_RUNNER_ID\":\"#{GITLAB_SHARED_RUNNER_ID}\",\"TF_VAR_GITLAB_TOKEN\":\"#{GITLAB_TOKEN}\",\"TF_VAR_OCTOAPI\":\"#{OCTOAPI}\"}"
Octopus.Action.Terraform.GoogleCloudAccount = "False"
Octopus.Action.Terraform.ManagedAccount = "None"
Octopus.Action.Terraform.PlanJsonOutput = "False"
Octopus.Action.Terraform.RunAutomaticFileSubstitution = "True"
OctopusUseBundledTooling = "False"
}
worker_pool_variable = ""
container {
feed = "nexus"
image = "#{TF_Container}"
}
packages {
acquisition_location = "Server"
feed = "nexus-nuget"
package_id = "#{TF_PACKAGE}"
properties = {
SelectionMode = "immediate"
}
}
}
}
step "approve-plan" {
name = "Approve Plan"
action {
action_type = "Octopus.Manual"
environments = ["development"]
is_required = true
properties = {
Octopus.Action.Manual.BlockConcurrentDeployments = "False"
Octopus.Action.Manual.Instructions = <<-EOT
```
#{Octopus.Action[Terraform Plan].Output.TerraformPlanOutput}
```
EOT
}
}
}
step "terraform-apply" {
name = "Terraform Apply"
action {
action_type = "Octopus.TerraformApply"
properties = {
Octopus.Action.GoogleCloud.ImpersonateServiceAccount = "False"
Octopus.Action.GoogleCloud.UseVMServiceAccount = "True"
Octopus.Action.Package.DownloadOnTentacle = "False"
Octopus.Action.Package.FeedId = "nexus-nuget"
Octopus.Action.Package.PackageId = "#{TF_PACKAGE}"
Octopus.Action.RunOnServer = "true"
Octopus.Action.Script.ScriptSource = "Package"
Octopus.Action.Terraform.AdditionalInitParams = "#{TF_INIT}"
Octopus.Action.Terraform.AllowPluginDownloads = "True"
Octopus.Action.Terraform.AzureAccount = "False"
Octopus.Action.Terraform.EnvVariables = "{\"TF_VAR_GITLAB_PROJECT_ID\":\"#{GITLAB_PROJECT_ID}\",\"TF_VAR_GITLAB_PROJECT_NAME\":\"#{GITLAB_PROJECT_NAME}\",\"TF_VAR_GITLAB_SHARED_RUNNER_ID\":\"#{GITLAB_SHARED_RUNNER_ID}\",\"TF_VAR_GITLAB_TOKEN\":\"#{GITLAB_TOKEN}\",\"TF_VAR_OCTOAPI\":\"#{OCTOAPI}\"}"
Octopus.Action.Terraform.GoogleCloudAccount = "False"
Octopus.Action.Terraform.ManagedAccount = "None"
Octopus.Action.Terraform.PlanJsonOutput = "False"
Octopus.Action.Terraform.RunAutomaticFileSubstitution = "True"
OctopusUseBundledTooling = "False"
}
worker_pool_variable = ""
container {
feed = "nexus"
image = "#{TF_Container}"
}
packages {
acquisition_location = "Server"
feed = "nexus-nuget"
package_id = "#{TF_PACKAGE}"
properties = {
SelectionMode = "immediate"
}
}
}
}

View File

@@ -0,0 +1,7 @@
connectivity_policy {
allow_deployments_to_no_targets = true
}
versioning_strategy {
template = "#{Octopus.Version.LastMajor}.#{Octopus.Version.LastMinor}.#{Octopus.Version.NextPatch}"
}

View File

@@ -0,0 +1 @@
version = 6

11
.octopus/variables.ocl Normal file
View File

@@ -0,0 +1,11 @@
variable "TF_INIT" {
value "-backend-config=\"address=https://gitlab.com/api/v4/projects/#{GITLAB_PROJECT_ID}/terraform/state/gitlab\" -backend-config=\"lock_address=https://gitlab.com/api/v4/projects/#{GITLAB_PROJECT_ID}/terraform/state/gitlab/lock\" -backend-config=\"unlock_address=https://gitlab.com/api/v4/projects/#{GITLAB_PROJECT_ID}/terraform/state/gitlab/lock\" -backend-config=\"username=developerdurp\" -backend-config=\"password=#{GITLAB_TOKEN}\" -backend-config=\"lock_method=POST\" -backend-config=\"unlock_method=DELETE\" -backend-config=\"retry_wait_min=5\"" {}
}
variable "TF_PACKAGE" {
value "TERRAFORM.GITLAB.PROJECTS" {}
}
variable "TF_CONTAINER" {
value "developerdurp/octopus-packages" {}
}

View File

@@ -20,6 +20,8 @@ resource "gitlab_project" "project" {
squash_option = "default_on"
ci_config_path = ".gitlab/.gitlab-ci.yml"
shared_runners_enabled = false
visibility_level = "public"
ci_forward_deployment_enabled = true
}
resource "gitlab_branch_protection" "master" {
@@ -42,3 +44,11 @@ resource "gitlab_project_runner_enablement" "k3s" {
project = gitlab_project.project.id
runner_id = var.GITLAB_SHARED_RUNNER_ID
}
resource "gitlab_project_variable" "OCTOAPI" {
project = gitlab_project.project.id
key = "OCTOAPI"
value = var.OCTOAPI
protected = false
masked = true
}

View File

@@ -13,3 +13,7 @@ variable "GITLAB_PROJECT_NAME" {
variable "GITLAB_SHARED_RUNNER_ID" {
type = number
}
variable "OCTOAPI" {
type = string
}