Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
uses: actions/create-github-app-token@v2
# Only run e2e tests from the main branch as we need some credentials
# that we don't want to risk leaking from pullrequest opened by random contributors
if: github.ref == 'refs/heads/main' || ${{ inputs.run-e2e-tests }}
if: github.ref == 'refs/heads/main' || ( github.event_name == 'workflow_dispatch' && inputs.run-e2e-tests == true )
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

regression, so I had to fix it otherwise it's always true

Tested manually https://github.com/elastic/oblt-updatecli-policies/actions/runs/18312529977/job/52144350325

with:
app-id: ${{ secrets.ELASTIC_OBSERVABILITY_APP_ID }}
private-key: ${{ secrets.ELASTIC_OBSERVABILITY_APP_PEM }}
Expand All @@ -50,7 +50,7 @@ jobs:
- name: e2e tests
# Only run e2e tests from the main branch as we need some credentials
# that we don't want to risk leaking from pullrequest opened by random contributors
if: github.ref == 'refs/heads/main' || ${{ inputs.run-e2e-tests }}
if: github.ref == 'refs/heads/main' || ( github.event_name == 'workflow_dispatch' && inputs.run-e2e-tests == true )
run: make e2e-test
env:
GITHUB_TOKEN: ${{ steps.generate_testing_token.outputs.token }}
Expand Down
1 change: 1 addition & 0 deletions tests/terranova/version/.terranova-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.87.0
1 change: 1 addition & 0 deletions tests/terranova/version/.tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terranova 0.87.0
5 changes: 5 additions & 0 deletions updatecli-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ policies:
values:
- updatecli/policies/terraform/version/testdata/values.yaml

- name: Handle terranova update (e2e tests)
policy: ghcr.io/elastic/oblt-updatecli-policies/terranova/version:latest
values:
- updatecli/policies/terranova/version/testdata/values.yaml

- name: Handle updatecli update (e2e tests)
policy: ghcr.io/elastic/oblt-updatecli-policies/updatecli/version:latest
values:
Expand Down
5 changes: 5 additions & 0 deletions updatecli/policies/terranova/version/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 0.1.0

- Initial release
15 changes: 15 additions & 0 deletions updatecli/policies/terranova/version/Policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
authors:
- Victor Martinez <VictorMartinezRubio@gmail.com>

url: "https://github.com/elastic/oblt-updatecli-policies/"
changelog: "https://github.com/elastic/oblt-updatecli-policies/tree/main/updatecli/policies/terranova/version/CHANGELOG.md"
documentation: "https://github.com/elastic/oblt-updatecli-policies/tree/main/updatecli/policies/terranova/version/README.md"
source: "https://github.com/elastic/oblt-updatecli-policies/tree/main/updatecli/policies/terranova/version/"
version: 0.1.0
vendor: Elastic

licenses:
- "Apache-2.0 license"

description: |
terranova Version update policy
4 changes: 4 additions & 0 deletions updatecli/policies/terranova/version/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# README

This policy will update the version of the [terranova](https://github.com/elastic/terranova/releases/)
defined in a file. Also supports .tool-versions file (asdf-vm).
14 changes: 14 additions & 0 deletions updatecli/policies/terranova/version/testdata/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
scm:
enabled: true
user: obltmachine
owner: elastic
repository: oblt-updatecli-policies
username: obltmachine
branch: main
commitusingapi: true

path: tests/terranova/version/.terranova-version

pull_request:
labels:
- dependencies
74 changes: 74 additions & 0 deletions updatecli/policies/terranova/version/updatecli.d/default.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
# Copyright Elasticsearch B.V. and contributors
# SPDX-License-Identifier: Apache-2.0
#
# Helpers
# {{ $GitHubUser := env ""}}
# {{ $GitHubRepositoryList := env "GITHUB_REPOSITORY" | split "/"}}
# {{ $GitHubPAT := env "GITHUB_TOKEN"}}
# {{ $GitHubUsername := env "GITHUB_ACTOR"}}

name: '{{ .name }}'
pipelineid: '{{ .pipelineid }}'

sources:
version:
name: Get latest terranova version from elastic/terranova
kind: githubrelease
spec:
owner: elastic
repository: terranova
token: "{{ default $GitHubPAT .scm.token }}"
username: "{{ default $GitHubUsername .scm.username }}"
versionFilter:
kind: latest
transformers:
- trimprefix: "v"

targets:
version-file:
name: 'deps(terranova): Bump terranova version to {{ source "version" }}'
kind: file
# {{ if or (.scm.enabled) (env "GITHUB_REPOSITORY") }}
scmid: default
# {{ end }}
sourceid: version
spec:
file: '{{ .path }}'
# {{ if hasSuffix ".tool-versions" .path }}
matchpattern: '^terranova\s+v\d+\.\d+\.\d+'
content: 'terranova {{ source `version` }}'
# {{ else }}
# |+ adds newline to the end of the file
content: |+
{{ source `version` }}
# {{ end }}

# {{ if or (.scm.enabled) (env "GITHUB_REPOSITORY") }}
scms:
default:
kind: "github"
spec:
# Priority set to the environment variable
user: '{{ default $GitHubUser .scm.user}}'
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
repository: '{{ default $GitHubRepositoryList._1 .scm.repository}}'
token: '{{ default $GitHubPAT .scm.token }}'
username: '{{ default $GitHubUsername .scm.username }}'
branch: '{{ .scm.branch }}'
#{{ if .scm.commitusingapi }}
commitusingapi: {{ .scm.commitusingapi }}
# {{ end }}

actions:
default:
title: 'deps: Bump terranova version to {{ source "version" }}'
kind: "github/pullrequest"
spec:
automerge: {{ .automerge }}
labels:
# {{ range .pull_request.labels }}
- {{ . }}
# {{ end }}
scmid: "default"
{{ end }}
19 changes: 19 additions & 0 deletions updatecli/policies/terranova/version/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: 'deps: Bump terranova version'
pipelineid: terranova/version
automerge: false

path: .terranova-version

scm:
enabled: false
# user: v1v-bot
# owner: v1v
# repository: updatecli-demo
# token: "xxx"
# username: "v1v-bot"
# branch: main
# commitusingapi: false

pull_request:
labels:
- dependencies
Loading