Skip to content

Commit efac3e6

Browse files
authored
feat(terranova): support for bump (#126)
* feat(terranova): support for bump * fix * fix * fix
1 parent ad45276 commit efac3e6

File tree

10 files changed

+140
-2
lines changed

10 files changed

+140
-2
lines changed

.github/workflows/validate.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
uses: actions/create-github-app-token@v2
4242
# Only run e2e tests from the main branch as we need some credentials
4343
# that we don't want to risk leaking from pullrequest opened by random contributors
44-
if: github.ref == 'refs/heads/main' || ${{ inputs.run-e2e-tests }}
44+
if: github.ref == 'refs/heads/main' || ( github.event_name == 'workflow_dispatch' && inputs.run-e2e-tests == true )
4545
with:
4646
app-id: ${{ secrets.ELASTIC_OBSERVABILITY_APP_ID }}
4747
private-key: ${{ secrets.ELASTIC_OBSERVABILITY_APP_PEM }}
@@ -50,7 +50,7 @@ jobs:
5050
- name: e2e tests
5151
# Only run e2e tests from the main branch as we need some credentials
5252
# that we don't want to risk leaking from pullrequest opened by random contributors
53-
if: github.ref == 'refs/heads/main' || ${{ inputs.run-e2e-tests }}
53+
if: github.ref == 'refs/heads/main' || ( github.event_name == 'workflow_dispatch' && inputs.run-e2e-tests == true )
5454
run: make e2e-test
5555
env:
5656
GITHUB_TOKEN: ${{ steps.generate_testing_token.outputs.token }}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.87.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terranova 0.87.0

updatecli-compose.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ policies:
4444
values:
4545
- updatecli/policies/terraform/version/testdata/values.yaml
4646

47+
- name: Handle terranova update (e2e tests)
48+
policy: ghcr.io/elastic/oblt-updatecli-policies/terranova/version:latest
49+
values:
50+
- updatecli/policies/terranova/version/testdata/values.yaml
51+
4752
- name: Handle updatecli update (e2e tests)
4853
policy: ghcr.io/elastic/oblt-updatecli-policies/updatecli/version:latest
4954
values:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
3+
## 0.1.0
4+
5+
- Initial release
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
authors:
2+
- Victor Martinez <[email protected]>
3+
4+
url: "https://github.com/elastic/oblt-updatecli-policies/"
5+
changelog: "https://github.com/elastic/oblt-updatecli-policies/tree/main/updatecli/policies/terranova/version/CHANGELOG.md"
6+
documentation: "https://github.com/elastic/oblt-updatecli-policies/tree/main/updatecli/policies/terranova/version/README.md"
7+
source: "https://github.com/elastic/oblt-updatecli-policies/tree/main/updatecli/policies/terranova/version/"
8+
version: 0.1.0
9+
vendor: Elastic
10+
11+
licenses:
12+
- "Apache-2.0 license"
13+
14+
description: |
15+
terranova Version update policy
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# README
2+
3+
This policy will update the version of the [terranova](https://github.com/elastic/terranova/releases/)
4+
defined in a file. Also supports .tool-versions file (asdf-vm).
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
scm:
2+
enabled: true
3+
user: obltmachine
4+
owner: elastic
5+
repository: oblt-updatecli-policies
6+
username: obltmachine
7+
branch: main
8+
commitusingapi: true
9+
10+
path: tests/terranova/version/.terranova-version
11+
12+
pull_request:
13+
labels:
14+
- dependencies
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
# Copyright Elasticsearch B.V. and contributors
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# Helpers
6+
# {{ $GitHubUser := env ""}}
7+
# {{ $GitHubRepositoryList := env "GITHUB_REPOSITORY" | split "/"}}
8+
# {{ $GitHubPAT := env "GITHUB_TOKEN"}}
9+
# {{ $GitHubUsername := env "GITHUB_ACTOR"}}
10+
11+
name: '{{ .name }}'
12+
pipelineid: '{{ .pipelineid }}'
13+
14+
sources:
15+
version:
16+
name: Get latest terranova version from elastic/terranova
17+
kind: githubrelease
18+
spec:
19+
owner: elastic
20+
repository: terranova
21+
token: "{{ default $GitHubPAT .scm.token }}"
22+
username: "{{ default $GitHubUsername .scm.username }}"
23+
versionFilter:
24+
kind: latest
25+
transformers:
26+
- trimprefix: "v"
27+
28+
targets:
29+
version-file:
30+
name: 'deps(terranova): Bump terranova version to {{ source "version" }}'
31+
kind: file
32+
# {{ if or (.scm.enabled) (env "GITHUB_REPOSITORY") }}
33+
scmid: default
34+
# {{ end }}
35+
sourceid: version
36+
spec:
37+
file: '{{ .path }}'
38+
# {{ if hasSuffix ".tool-versions" .path }}
39+
matchpattern: '^terranova\s+v\d+\.\d+\.\d+'
40+
content: 'terranova {{ source `version` }}'
41+
# {{ else }}
42+
# |+ adds newline to the end of the file
43+
content: |+
44+
{{ source `version` }}
45+
# {{ end }}
46+
47+
# {{ if or (.scm.enabled) (env "GITHUB_REPOSITORY") }}
48+
scms:
49+
default:
50+
kind: "github"
51+
spec:
52+
# Priority set to the environment variable
53+
user: '{{ default $GitHubUser .scm.user}}'
54+
owner: '{{ default $GitHubRepositoryList._0 .scm.owner }}'
55+
repository: '{{ default $GitHubRepositoryList._1 .scm.repository}}'
56+
token: '{{ default $GitHubPAT .scm.token }}'
57+
username: '{{ default $GitHubUsername .scm.username }}'
58+
branch: '{{ .scm.branch }}'
59+
#{{ if .scm.commitusingapi }}
60+
commitusingapi: {{ .scm.commitusingapi }}
61+
# {{ end }}
62+
63+
actions:
64+
default:
65+
title: 'deps: Bump terranova version to {{ source "version" }}'
66+
kind: "github/pullrequest"
67+
spec:
68+
automerge: {{ .automerge }}
69+
labels:
70+
# {{ range .pull_request.labels }}
71+
- {{ . }}
72+
# {{ end }}
73+
scmid: "default"
74+
{{ end }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: 'deps: Bump terranova version'
2+
pipelineid: terranova/version
3+
automerge: false
4+
5+
path: .terranova-version
6+
7+
scm:
8+
enabled: false
9+
# user: v1v-bot
10+
# owner: v1v
11+
# repository: updatecli-demo
12+
# token: "xxx"
13+
# username: "v1v-bot"
14+
# branch: main
15+
# commitusingapi: false
16+
17+
pull_request:
18+
labels:
19+
- dependencies

0 commit comments

Comments
 (0)