This repository has been archived by the owner on Feb 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support loading commit metadata (#87)
- Loading branch information
Alexander Matyushentsev
authored
May 10, 2020
1 parent
bc5ab4b
commit 4275eb9
Showing
24 changed files
with
439 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
## Functions | ||
|
||
Both templates and triggers have access to the set of functions. | ||
|
||
Trigger example: | ||
|
||
```yaml | ||
name: app-operation-stuck | ||
condition: time.Now().Sub(time.Parse(app.status.operationState.startedAt)).Minutes() >= 5 | ||
template: my-template | ||
``` | ||
Template example: | ||
```yaml | ||
name: my-template | ||
title: Application {{.app.metadata.name}} sync status is {{.app.status.sync.status}} | ||
body: "Author: {{(call .repo.GetCommitMetadata .app.status.sync.revision).Author}}" | ||
``` | ||
### **time** | ||
Time related functions. | ||
<hr> | ||
**`time.Now() Time`** | ||
|
||
Executes function built-in Golang [time.Now](https://golang.org/pkg/time/#Now) function. | ||
Returns an instance of Golang [Time](https://golang.org/pkg/time/#Time). | ||
|
||
<hr> | ||
**`time.Parse(val string) Time`** | ||
|
||
Parses specified string using RFC3339 layout. Returns an instance of Golang [Time](https://golang.org/pkg/time/#Time). | ||
|
||
### **repo** | ||
Functions that provide additional information about Application source repository. | ||
<hr> | ||
**`repo.RepoURLToHTTPS(url string) string`** | ||
|
||
Transforms given GIT URL into HTTPs format. | ||
|
||
<hr> | ||
**`repo.FullNameByRepoURL(url string) string`** | ||
|
||
Returns repository URL full name `(<owner>/<repoName>)`. Currently supports only Github, Gitlab and Bitbucket. | ||
|
||
<hr> | ||
**`repo.GetCommitMetadata(sha string) CommitMetadata`** | ||
|
||
Returns commit metadata. The commit must belong to the application source repository. `CommitMetadata` fields: | ||
|
||
* `Message string` commit message | ||
* `Author string` - commit author | ||
* `Date time.Time` - commit creation date | ||
* `Tags []string` - Associated tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.