Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

Commit

Permalink
GitHub status (#20)
Browse files Browse the repository at this point in the history
* Add github status resource type
  • Loading branch information
ShauliSolomovich authored Feb 3, 2021
1 parent 491cbd1 commit 29f78c0
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 7 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ This allows the user to more easily generate type-safe Concourse CI pipelines, t
* Github List Repos - [`coralogix/eng-concourse-resource-github-list-repos`](https://github.com/coralogix/eng-concourse-resource-github-list-repos)
* Github PR - [`telia-oss/github-pr-resource`](https://github.com/telia-oss/github-pr-resource)
* Github Release - [`concourse/github-release-resource`](https://github.com/concourse/github-release-resource)
* Github Status - [`colstrom/concourse-github-status`](https://github.com/colstrom/concourse-github-status)
* Git Multibranch - [`cloudfoundry-community/git-multibranch-resource`](https://github.com/cloudfoundry-community/git-multibranch-resource)
* Helm 3 - [`Typositoire/concourse-helm3-resource`](https://github.com/Typositoire/concourse-helm3-resource)
* Kops - [`coralogix/eng-concourse-resource-kops`](https://github.com/coralogix/eng-concourse-resource-kops)
Expand All @@ -32,11 +33,11 @@ For stability, users are encouraged to import from a tagged release, not from th
You should generally import `domain.dhall`, which includes `Resource`, `ResourceType`, `Step`, `Task`, `Job`, `Group`, `Pipeline`, and `VarSource`, and merge it with the resource types that you need. For example,
```dhall
let Concourse =
https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.10.0/domain.dhall sha256:036b9de47a7f54d4ed21b87c50987fb8a318c62524d7f6317d3ec98bbe9c784c
https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.11.0/domain.dhall sha256:036b9de47a7f54d4ed21b87c50987fb8a318c62524d7f6317d3ec98bbe9c784c
{ RegistryImage =
https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.10.0/resource-types/RegistryImage.dhall sha256:2ca4df79f82f54275f919d759344a6478749f7d0f32bddbc0389877ede11da03
https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.11.0/resource-types/RegistryImage.dhall sha256:2ca4df79f82f54275f919d759344a6478749f7d0f32bddbc0389877ede11da03
, Git =
https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.10.0/resource-types/Git.dhall sha256:830b9d7d0e9e0992ee2473f78e05838a86be3e13c7bcf5df661b8829dbc3d558
https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.11.0/resource-types/Git.dhall sha256:830b9d7d0e9e0992ee2473f78e05838a86be3e13c7bcf5df661b8829dbc3d558
}

in Concourse
Expand Down Expand Up @@ -64,16 +65,16 @@ This introduces a question - what should the type of the `source` field be? Main
This repository allows the user to construct the type of `Resource` and of `ResourceType` based on a union that the downstream user constructs, consisting only of the resource types which the downstream user actually uses in their pipeline. This solves both the code-reusage problem, and keeps the implementation performant. For example:

```dhall
let Git = https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.10.0/resource-types/Git.dhall sha256:830b9d7d0e9e0992ee2473f78e05838a86be3e13c7bcf5df661b8829dbc3d558
let Git = https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.11.0/resource-types/Git.dhall sha256:830b9d7d0e9e0992ee2473f78e05838a86be3e13c7bcf5df661b8829dbc3d558

let S3 = https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.10.0/resource-types/S3.dhall sha256:b49ec06747630f6d6951fde4f04f7bbffab7cee1a9ef299464314ad049422d04
let S3 = https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.11.0/resource-types/S3.dhall sha256:b49ec06747630f6d6951fde4f04f7bbffab7cee1a9ef299464314ad049422d04

let Source = < Git : Git.Source.Type | S3 : S3.Source.Type >

let Version = < Git : Git.Version.Type | S3 : S3.Version.Type >

let Resource =
let import = https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.10.0/Resource.dhall sha256:206f784b14f3fb78809bafffbde955fbc177ca0427c8fe9cf4a983a8aaf463c1
let import = https://raw.githubusercontent.com/coralogix/dhall-concourse/v0.11.0/Resource.dhall sha256:206f784b14f3fb78809bafffbde955fbc177ca0427c8fe9cf4a983a8aaf463c1

in import { Source, Version }

Expand Down
2 changes: 1 addition & 1 deletion package.dhall
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ resource-types =
./resource-types/package.dhall sha256:fc1d84e1b7901ca2b90b3dd11e8688a09a8490427ecbe226694d91f74823005c
./resource-types/package.dhall sha256:130fd5ab6ba3ec7458889d5f0ea733a9f70aade5916cc62ab9ebf3c806e9c670
? ./resource-types/package.dhall
}
( ./domain.dhall sha256:036b9de47a7f54d4ed21b87c50987fb8a318c62524d7f6317d3ec98bbe9c784c
Expand Down
54 changes: 54 additions & 0 deletions resource-types/GithubStatus.dhall
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{ meta = { name = "github-status", repository = "resource/github-status" }
, Version = { Type = { `context@sha` : Text }, default = {=} }
, Params =
{ Get =
{ Type = { path : Text, context : Optional Text }
, default.context = None Text
}
, Put =
let StatusObject =
{ Type =
{ state : Text
, context : Optional Text
, description : Optional Text
, target_url : Optional Text
}
, default =
{ context = None Text
, description = None Text
, target_url = None Text
}
}

let Statuses =
{ Type = { path : Text, statuses : List StatusObject.Type }
, default = {=}
, StatusObject
}

let Status =
{ Type = { path : Text } StatusObject.Type
, default = StatusObject.default
}

let Put =
let Put = < Status : Status.Type | Statuses : Statuses.Type >

in { Type = Put
, Status = λ(status : Status.Type) Put.Status status
, Statuses = λ(statuses : Statuses.Type) Put.Statuses statuses
, Options = { Status, Statuses }
}

let test =
Put.Status Put.Options.Status::{ path = "test", state = "successs" }

in Put
}
, Source =
let Source = { Type = { repo : Text, access_token : Text }, default = {=} }

let test = Source::{ repo = "test", access_token = "my-token" }

in Source
}
3 changes: 3 additions & 0 deletions resource-types/package.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
, GithubRelease =
./GithubRelease.dhall sha256:1b782f3c5b49ccce426bb3364add8290aa83e267da5af95b5493ba2038f5ab36
? ./GithubRelease.dhall
, GithubStatus =
./GithubStatus.dhall sha256:386931b4d5af36df90523b09e4f99b2da1eb172a713860c72d1d253b07545b6f
? ./GithubStatus.dhall
, Helm3 =
./Helm3.dhall sha256:b105c98ee64027bc50deaea0951da2a8b235a43a5af3e9f4720bd2a57bda5474
? ./Helm3.dhall
Expand Down

0 comments on commit 29f78c0

Please sign in to comment.