Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] ci: Add github build #30

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ common:debs-ci --config=ci
common:debs-ci --//debs:excludes=//debs:excludes.txt
common:debs-ci --//debs:token=//debs:token.txt

common:debs-publish --//debs:debs-publish=//debs:import

common:publish-ci --config=debs-ci
common:publish-ci --//tools/tarball:target=//:html
common:publish-ci --//tools/tarball:overwrite=//tools/tarball:true
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build

permissions:
contents: read

on:
pull_request:
push:
branches:
- main

concurrency:
group: >-
${{ github.event.inputs.head_ref || github.run_id }}


jobs:
build:
runs-on: ubuntu-latest-8-cores
if: ${{ github.repository_owner == 'envoyproxy' }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- run: |
mkdir ./debs/import
gsutil -mq rsync -r gs://envoy-apt-cache/debs ./debs/import/
ls -alh debs/import/

- run: |
sudo mkdir /opt/build
sudo chown runner:docker /opt/build
echo ${{ github.token }} > debs/token.txt
./build-repository.sh
du -ch /opt/build
du -ch ~/.cache
env:
CONTEXT: deploy-preview
GITHUB_TOKEN: ${{ github.token }}
9 changes: 7 additions & 2 deletions build-repository.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ UNDERLINE="\e[4m"
NORMAL="\e[0m"

EXCLUDE_FILE=debs/excludes.txt
DEBS_ROOT=/opt/build/cache/repository
DEBS_ROOT="${DEBS_ROOT:-/opt/build/cache/repository}"
OUTPUT_DIR="${OUTPUT_DIR:-/opt/build/repo/html}"
SIGNING_KEY_PASSPHRASE="${SIGNING_KEY_PASSPHRASE:-Hackme}"


Expand Down Expand Up @@ -103,8 +104,12 @@ main () {
fi
bazel run \
"${bazel_args[@]}" \
--config=debug-bazel \
--config=debs-publish \
--sandbox_writable_path=/opt/build \
--sandbox_writable_path=/home/runner/.gnupg/ \
//tools/tarball:unpack \
/opt/build/repo/html
$OUTPUT_DIR
}

if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
Expand Down
20 changes: 16 additions & 4 deletions debs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,26 @@ fetch_debs(
excludes = ":excludes",
)

filegroup(
name = "import",
srcs = glob(["import/v*/*"]),
)

PUBLISH_ENV = {
"APTLY_BIN": "$(location @aptly)",
"MAINTAINER_KEY": "$(location //:envoy-maintainers-public.key)",
"APTLY_CONF": "$(location //:aptly-config)",
"DEBS": "$(location :debs)",
"DEBS": "$(locations :debs-publish)",
"DEBS_ROOT": "$${APT_ROOT}/repository",
"SIGNING_TOKEN": "$(location :signing-token)",
}

label_flag(
name = "debs-publish",
build_setting_default = ":debs",
visibility = ["//visibility:public"],
)

sh_binary(
name = "publish",
srcs = ["publish.sh"],
Expand All @@ -159,7 +170,7 @@ sh_binary(
"@aptly",
"//:aptly-config",
"//:envoy-maintainers-public.key",
":debs",
":debs-publish",
":signing-token",
],
visibility = ["//visibility:public"],
Expand All @@ -169,9 +180,10 @@ HTML_BUILD_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="$(locations :debs-publish)"
export DEBS_ROOT="$${APT_ROOT}/repository"
export SIGNING_TOKEN="$(location :signing-token)"
ls -alh /opt/build
$(location :publish)
tar hcf $@ -C $${APT_ROOT}/html .
"""
Expand All @@ -187,7 +199,7 @@ genrule(
"@aptly",
"//:aptly-config",
"//:envoy-maintainers-public.key",
":debs",
":debs-publish",
":publish",
":signing-token",
],
Expand Down
4 changes: 4 additions & 0 deletions debs/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ if [[ -z "$SIGNING_KEY" ]]; then
exit 1
fi

if [[ -n "$DEBS" ]]; then
DEBS="$(dirname $(dirname $(echo ${DEBS} | cut -d' ' -f1)))"
fi

_aptly () {
"${APTLY[@]}" -- "${@}"
Expand All @@ -41,6 +44,7 @@ create_dirs () {

unpack_debs () {
if [[ -d "$DEBS" ]]; then
DEBS_ROOT=$DEBS
return 0
elif [[ -s "$DEBS" ]]; then
tar xf "$DEBS" -C "$DEBS_ROOT"
Expand Down
1 change: 1 addition & 0 deletions netlify-should-run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exit 1
1 change: 1 addition & 0 deletions netlify.toml
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[build]
publish = "html"
command = "./build-repository.sh"
ignore = "./netlify-should-run.sh"

[build.environment]
BAZELISK_HOME="/opt/build/cache/bazelisk"
Loading