Skip to content

Commit

Permalink
chore(updatecli) track terraform providers with native updatecli reso…
Browse files Browse the repository at this point in the history
…urce (#479)

Since `updatecli`
[v0.60.0](https://github.com/updatecli/updatecli/releases/tag/v0.60.0),
there are a new native resource available to track terraform providers
from the hashicorp registry to the terraform lock files.

This PR fixes the broken updatecli builds of this repository and
switches to native terraform resources which includes:

- One manifest per provider is added
- Removed the "all in one" updater and the former script
- No need to use a custom hashicorp agent image to execute updatecli as
it's native in updatecli now (no docker, no terraform required)

Signed-off-by: Damien Duportal <damien.duportal@gmail.com>
  • Loading branch information
dduportal authored Sep 23, 2023
1 parent a29412d commit 2846615
Show file tree
Hide file tree
Showing 9 changed files with 284 additions and 93 deletions.
5 changes: 2 additions & 3 deletions Jenkinsfile_k8s
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ parallel(
)
},
'updatecli': {
def updatecliImage = 'jenkinsciinfra/hashicorp-tools:latest'
updatecli(action: 'diff', updatecliDockerImage: updatecliImage)
updatecli(action: 'diff')
if (env.BRANCH_IS_PRIMARY) {
updatecli(action: 'apply', cronTriggerExpression: '@daily', updatecliDockerImage: updatecliImage)
updatecli(action: 'apply', cronTriggerExpression: '@daily')
}
},
)
52 changes: 0 additions & 52 deletions updatecli/scripts/terraform-get-upgraded-lockfile.sh

This file was deleted.

38 changes: 0 additions & 38 deletions updatecli/updatecli.d/terraform-providers.yaml

This file was deleted.

47 changes: 47 additions & 0 deletions updatecli/updatecli.d/terraform-providers/azuread.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Bump Terraform `azuread` provider version"

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
lastVersion:
name: Get latest version of the `azuread` provider
kind: terraform/registry
spec:
type: provider
namespace: hashicorp
name: azuread

targets:
updateTerraformLockFile:
name: Update Terraform lock file
kind: terraform/lock
sourceid: lastVersion
spec:
file: .terraform.lock.hcl
provider: hashicorp/azuread
platforms:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
scmid: default

actions:
default:
kind: github/pullrequest
scmid: default
spec:
title: Bump Terraform `azuread` provider version to {{ source "lastVersion" }}
labels:
- terraform-providers
- hashicorp/azuread
47 changes: 47 additions & 0 deletions updatecli/updatecli.d/terraform-providers/azurerm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Bump Terraform `azurerm` provider version"

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
lastVersion:
name: Get latest version of the `azurerm` provider
kind: terraform/registry
spec:
type: provider
namespace: hashicorp
name: azurerm

targets:
updateTerraformLockFile:
name: Update Terraform lock file
kind: terraform/lock
sourceid: lastVersion
spec:
file: .terraform.lock.hcl
provider: hashicorp/azurerm
platforms:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
scmid: default

actions:
default:
kind: github/pullrequest
scmid: default
spec:
title: Bump Terraform `azurerm` provider version to {{ source "lastVersion" }}
labels:
- terraform-providers
- hashicorp/azurerm
47 changes: 47 additions & 0 deletions updatecli/updatecli.d/terraform-providers/kubernetes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Bump Terraform `kubernetes` provider version"

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
lastVersion:
name: Get latest version of the `kubernetes` provider
kind: terraform/registry
spec:
type: provider
namespace: hashicorp
name: kubernetes

targets:
updateTerraformLockFile:
name: Update Terraform lock file
kind: terraform/lock
sourceid: lastVersion
spec:
file: .terraform.lock.hcl
provider: hashicorp/kubernetes
platforms:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
scmid: default

actions:
default:
kind: github/pullrequest
scmid: default
spec:
title: Bump Terraform `kubernetes` provider version to {{ source "lastVersion" }}
labels:
- terraform-providers
- hashicorp/kubernetes
47 changes: 47 additions & 0 deletions updatecli/updatecli.d/terraform-providers/local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Bump Terraform `local` provider version"

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
lastVersion:
name: Get latest version of the `local` provider
kind: terraform/registry
spec:
type: provider
namespace: hashicorp
name: local

targets:
updateTerraformLockFile:
name: Update Terraform lock file
kind: terraform/lock
sourceid: lastVersion
spec:
file: .terraform.lock.hcl
provider: hashicorp/local
platforms:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
scmid: default

actions:
default:
kind: github/pullrequest
scmid: default
spec:
title: Bump Terraform `local` provider version to {{ source "lastVersion" }}
labels:
- terraform-providers
- hashicorp/local
47 changes: 47 additions & 0 deletions updatecli/updatecli.d/terraform-providers/postgresql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Bump Terraform `postgresql` provider version"

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
lastVersion:
name: Get latest version of the `postgresql` provider
kind: terraform/registry
spec:
type: provider
namespace: cyrilgdn
name: postgresql

targets:
updateTerraformLockFile:
name: Update Terraform lock file
kind: terraform/lock
sourceid: lastVersion
spec:
file: .terraform.lock.hcl
provider: cyrilgdn/postgresql
platforms:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
scmid: default

actions:
default:
kind: github/pullrequest
scmid: default
spec:
title: Bump Terraform `cyrilgdn/postgresql` provider version to {{ source "lastVersion" }}
labels:
- terraform-providers
- cyrilgdn/postgresql
47 changes: 47 additions & 0 deletions updatecli/updatecli.d/terraform-providers/random.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Bump Terraform `random` provider version"

scms:
default:
kind: github
spec:
user: "{{ .github.user }}"
email: "{{ .github.email }}"
owner: "{{ .github.owner }}"
repository: "{{ .github.repository }}"
token: "{{ requiredEnv .github.token }}"
username: "{{ .github.username }}"
branch: "{{ .github.branch }}"

sources:
lastVersion:
name: Get latest version of the `random` provider
kind: terraform/registry
spec:
type: provider
namespace: hashicorp
name: random

targets:
updateTerraformLockFile:
name: Update Terraform lock file
kind: terraform/lock
sourceid: lastVersion
spec:
file: .terraform.lock.hcl
provider: hashicorp/random
platforms:
- linux_amd64
- linux_arm64
- darwin_amd64
- darwin_arm64
scmid: default

actions:
default:
kind: github/pullrequest
scmid: default
spec:
title: Bump Terraform `random` provider version to {{ source "lastVersion" }}
labels:
- terraform-providers
- hashicorp/random

0 comments on commit 2846615

Please sign in to comment.