Esempio n. 1
0
        public virtual async Task PutCommitStatus(PutCommitStatusRequest request)
        {
            if (request.ServiceName == null ||
                request.EnvironmentName == null ||
                request.GithubOwner == null ||
                request.GithubRepo == null ||
                request.GithubRef == null)
            {
                return;
            }

            var encryptedGithubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN");
            var commitStatusClient   = await commitStatusClientFactory.Create(encryptedGithubToken);

            await commitStatusClient.Create(request.GithubOwner, request.GithubRepo, request.GithubRef, new NewCommitStatus
            {
                State       = request.CommitState,
                TargetUrl   = GetSsoUrl(request),
                Description = $"{request.ServiceName} Deployment {GetStatusDescription(request.CommitState)}",
                Context     = $"{request.ServiceName} - {request.EnvironmentName} ({request.ProjectName})"
            });
        }
Esempio n. 2
0
        private static string GetSsoUrl(PutCommitStatusRequest request)
        {
            var destination = Uri.EscapeUriString(request.DetailsUrl);

            return($"https://sso.brigh.id/start/{request.EnvironmentName.ToLower()}?destination={destination}");
        }