Skip to content
This repository has been archived by the owner on Feb 15, 2020. It is now read-only.

Add PUBLIC_PIPELINE_REPOS var #4

Merged
merged 4 commits into from Jul 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 9 additions & 1 deletion index.js
Expand Up @@ -70,6 +70,12 @@ const envconst = {
automatically granted CI access
*/
CI_USER_WHITELIST: '', // comma separated, no spaces

/*
List of github repos (full_name format; e.g. `org/repo`) that use
public Buildkite pipelines
*/
PUBLIC_PIPELINE_REPOS: '', // comma separated, no spaces
};

for (const v in envconst) {
Expand All @@ -79,6 +85,7 @@ for (const v in envconst) {
}
}

const PUBLIC_PIPELINE_REPOS = new Set(envconst.PUBLIC_PIPELINE_REPOS.split(','));
const githubClient = github.client(envconst.GITHUB_TOKEN);
const buildkiteClient = createBuildKiteClient({
accessToken: envconst.BUILDKITE_TOKEN
Expand Down Expand Up @@ -359,12 +366,13 @@ async function onGithubStatusUpdate(payload) {
context,
description,
name,
repository,
sha,
state,
target_url,
} = payload;

if (isBuildkitePublicLogUrl(target_url)) {
if (!PUBLIC_PIPELINE_REPOS.has(repository.full_name) && isBuildkitePublicLogUrl(target_url)) {
// Overwrite the buildkite status url with the public log equivalent
const new_target_url = envconst.PUBLIC_URL_ROOT + '/buildkite_public_log?' + target_url;
log.info('updating to', new_target_url);
Expand Down
3 changes: 1 addition & 2 deletions scripts/postinstall.sh
Expand Up @@ -19,8 +19,7 @@ for patch in $(cd patch/; find . -name \*.patch); do
done

if [[ ! -r public_html/terminal.css ]]; then
wget -O public_html/terminal.css \
https://raw.githubusercontent.com/buildkite/terminal/v3.1.0/assets/terminal.css
curl https://raw.githubusercontent.com/buildkite/terminal/v3.1.0/assets/terminal.css -o public_html/terminal.css
fi

exit 0