-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ryan Northey <[email protected]>
- Loading branch information
Showing
8 changed files
with
188 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
rootDir: /opt/build/cache/aptly | ||
FileSystemPublishEndpoints: | ||
public: | ||
rootDir: /opt/build/repo/repository | ||
rootDir: /opt/build/cache/html | ||
linkMethod: symlink |
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 |
---|---|---|
|
@@ -91,3 +91,27 @@ jq( | |
.[0] * .[1] | ||
""", | ||
) | ||
|
||
genrule( | ||
name = "html", | ||
outs = ["tar.gz"], | ||
cmd = """ | ||
export APTLY_BIN="$(location @aptly)" | ||
export MAINTAINER_KEY="$(location //:envoy-maintainers-public.key)" | ||
export APTLY_CONF="$(location //:aptly-config)" | ||
export DEBS="$(location //debs)" | ||
export DEBS_ROOT_DEFAULT="/opt/build/cache/repository" | ||
export SIGNING_KEY_DEFAULT="[email protected]" | ||
export SIGNING_TOKEN="$(location //debs:signing-token)" | ||
$(location //debs:publish) | ||
tar hcf $@ -C /opt/build/cache/html . | ||
""", | ||
tools = [ | ||
"@aptly", | ||
"//:aptly-config", | ||
"//:envoy-maintainers-public.key", | ||
"//debs", | ||
"//debs:publish", | ||
"//debs:signing-token", | ||
] | ||
) |
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 |
---|---|---|
|
@@ -8,6 +8,7 @@ NORMAL="\e[0m" | |
|
||
EXCLUDE_FILE=debs/custom-excludes.txt | ||
DEBS_ROOT=/opt/build/cache/repository | ||
SIGNING_KEY_PASSPHRASE="${SIGNING_KEY_PASSPHRASE:-HACKME}" | ||
|
||
bold () { | ||
echo -n "${BOLD}${*}${NORMAL}" | ||
|
@@ -34,6 +35,55 @@ create_excludes () { | |
fi | ||
} | ||
|
||
import_public_key | ||
create_excludes | ||
bazel run --config=debs-ci //debs:publish | ||
generate_private_key () { | ||
echo -e "$(underline $(bold "Import private signing key (apt): repository signing"))" | ||
gpg --batch --pinentry-mode loopback --passphrase "" --gen-key <<EOF | ||
%echo Generating a basic OpenPGP key | ||
Key-Type: 1 | ||
Key-Length: 4096 | ||
Subkey-Type: 1 | ||
Subkey-Length: 4096 | ||
Name-Real: Envoy CI | ||
Name-Email: [email protected] | ||
Expire-Date: 0 | ||
Passphrase: ${SIGNING_KEY_PASSPHRASE} | ||
%commit | ||
%echo done | ||
EOF | ||
} | ||
|
||
import_private_key () { | ||
echo -e "$(underline $(bold "Import private signing key: maintainers"))" | ||
echo "${SIGNING_KEY_0}${SIGNING_KEY_1}${SIGNING_KEY_2}${SIGNING_KEY_3}" | base64 -d > signing.key | ||
gpg --batch --pinentry-mode loopback --import signing.key || { | ||
rm -rf signing.key | ||
echo "Key import failed" >&2 | ||
exit 1 | ||
} | ||
rm -rf signing.key | ||
} | ||
|
||
create_excludes () { | ||
if [[ -e "${DEBS_ROOT}" ]]; then | ||
ls "${DEBS_ROOT}" \ | ||
| (grep -E '^v[0-9]+\.[0-9]+\.[0-9]+' || echo '') \ | ||
| sort -u > debs/custom-excludes.txt | ||
else | ||
touch debs/custom-excludes.txt | ||
fi | ||
} | ||
|
||
build () { | ||
import_public_key | ||
create_excludes | ||
echo "${SIGNING_KEY_PASSPHRASE}" > debs/signing-token.txt | ||
if [[ "$CONTEXT" == "deploy-preview" ]]; then | ||
import_private_key | ||
# generate_private_key | ||
else | ||
import_private_key | ||
fi | ||
bazel run --config=publish-ci //tools/tarball:unpack /opt/build/repo/html | ||
} | ||
|
||
build |
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ MAINTAINER = "Envoy maintainers <[email protected]>" | |
exports_files([ | ||
"custom-excludes.txt", | ||
"token.txt", | ||
"signing-token.txt", | ||
]) | ||
|
||
jq( | ||
|
@@ -114,11 +115,19 @@ genrule( | |
label_flag( | ||
name = "excludes", | ||
build_setting_default = ":empty", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
label_flag( | ||
name = "token", | ||
build_setting_default = ":empty", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
label_flag( | ||
name = "signing-token", | ||
build_setting_default = ":empty", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
genrule( | ||
|
@@ -141,6 +150,7 @@ genrule( | |
":excludes", | ||
":token", | ||
], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
sh_binary( | ||
|
@@ -152,11 +162,15 @@ sh_binary( | |
"APTLY_CONF": "$(location //:aptly-config)", | ||
"DEBS": "$(location :debs)", | ||
"DEBS_ROOT_DEFAULT": "/opt/build/cache/repository", | ||
"SIGNING_KEY_DEFAULT": "[email protected]", | ||
"SIGNING_TOKEN": "$(location :signing-token)", | ||
}, | ||
data = [ | ||
"@aptly", | ||
"//:aptly-config", | ||
"//:envoy-maintainers-public.key", | ||
":debs" | ||
":debs", | ||
":signing-token", | ||
], | ||
visibility = ["//visibility:public"], | ||
) |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[build] | ||
publish = "repository" | ||
publish = "html" | ||
command = "./build-repository.sh" | ||
|
||
[build.environment] | ||
|
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