pub struct RepositoryConfig {
pub branch: String,
pub source: SourceConfig,
pub hooks: Vec<HookConfig>,
pub committers: Vec<CommitterConfig>,
}Expand description
repository.json: files and git as an entry point (spec 3.5 §7.8.2, A-I24).
{
"branch": "main",
"source": { "git": "../juniper-content", "fetch": "origin" },
"hooks": [
{ "name": "github", "forge": "github", "secret": "env:JUNIPER_GITHUB_WEBHOOK_SECRET" },
{ "name": "studio", "forge": "signed", "secret": "env:JUNIPER_STUDIO_WHSEC" }
],
"committers": [
{ "id": "wanjiru", "account": "github:wanjiru-k" },
{ "id": "newsdesk", "key": "studio" }
]
}§Example
use adk_website::repository::RepositoryConfig;
let config: RepositoryConfig = serde_json::from_str(r#"{
"source": { "http": "https://raw.githubusercontent.com/{repository}/{commit}/{path}" },
"hooks": [{ "name": "github", "forge": "github", "secret": "env:SECRET" }],
"committers": [{ "id": "wanjiru", "account": "github:wanjiru-k" }]
}"#).unwrap();
assert_eq!(config.branch, "main");
assert!(config.validate().is_ok());Fields§
§branch: StringThe branch whose pushes propose releases; main by default.
source: SourceConfigWhere the pushed commit’s files are read.
hooks: Vec<HookConfig>The signed webhooks.
committers: Vec<CommitterConfig>The authorised committers; anyone else’s push becomes a signal.
Implementations§
Source§impl RepositoryConfig
impl RepositoryConfig
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Checks the hooks, the committers and the source.
§Errors
A hook name that is not a path segment or is listed twice; a committer listed twice,
with both or neither of account and key, an account on a hook that is not a
forge’s, a key that is not a signed hook or is held by two committers; a source
with both or neither of git and http.
Sourcepub fn committer(
&self,
hook: &HookConfig,
push: &PushEvent,
) -> Option<&CommitterConfig>
pub fn committer( &self, hook: &HookConfig, push: &PushEvent, ) -> Option<&CommitterConfig>
The committer of push on hook: the listed account that pushed on a forge’s hook,
the key’s holder on a signed one.
Trait Implementations§
Source§impl Clone for RepositoryConfig
impl Clone for RepositoryConfig
Source§impl Debug for RepositoryConfig
impl Debug for RepositoryConfig
Source§impl<'de> Deserialize<'de> for RepositoryConfig
impl<'de> Deserialize<'de> for RepositoryConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RepositoryConfig
Source§impl PartialEq for RepositoryConfig
impl PartialEq for RepositoryConfig
Source§impl Serialize for RepositoryConfig
impl Serialize for RepositoryConfig
impl StructuralPartialEq for RepositoryConfig
Auto Trait Implementations§
impl Forget for RepositoryConfig
impl Freeze for RepositoryConfigwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<HookConfig>: Freeze,
PhantomData<CommitterConfig>: Freeze,
impl Move for RepositoryConfig
impl RefUnwindSafe for RepositoryConfig
impl Send for RepositoryConfigwhere
RawVecInner: Send,
impl Sync for RepositoryConfigwhere
RawVecInner: Sync,
impl Unpin for RepositoryConfig
impl UnsafeUnpin for RepositoryConfigwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<HookConfig>: UnsafeUnpin,
PhantomData<CommitterConfig>: UnsafeUnpin,
impl UnwindSafe for RepositoryConfigwhere
RawVecInner: UnwindSafe,
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more