Skip to content

Commit 0cbe62a

Browse files
Merge branch 'main' of https://github.com/EngFlow/example
2 parents 422e14c + d6f3530 commit 0cbe62a

File tree

10 files changed

+85
-9
lines changed

10 files changed

+85
-9
lines changed

.github/workflows/main.yml

+26
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,29 @@ jobs:
102102
OS: linux
103103
REMOTE_EXECUTION: ${{ matrix.remote_execution }}
104104
run: python3 infra/test-all.py
105+
106+
buck2-test:
107+
runs-on:
108+
- self-hosted
109+
- "os=linux"
110+
- "arch=x64"
111+
- "engflow-container-image=docker://645088952840.dkr.ecr.eu-west-1.amazonaws.com/engflow-ci/debian11-dind-x64@sha256:a0f386162b6498b9220a33f33f158fd175d2873ddd6ed30ca67aa33915850e1e"
112+
- "engflow-pool=ci_sysbox_x64"
113+
- "engflow-runtime=sysbox-runc"
114+
- "engflow-runner-id=${{ github.repository_id }}_buck2-test_${{ github.run_id }}_${{ github.run_number }}_${{ github.run_attempt }}"
115+
timeout-minutes: 10
116+
117+
steps:
118+
- uses: actions/checkout@v4
119+
120+
- name: Set up Buck2 binary
121+
shell: bash
122+
run: infra/setup-buck2.sh
123+
124+
- name: Set up authentication
125+
shell: bash
126+
run: infra/auth-buck2.sh
127+
128+
- name: Build and test
129+
shell: bash
130+
run: infra/test-buck2.sh

buck2/cpp/.buckconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ digest_algorithms = SHA256
4141
engine_address = <CLUSTER_NAME>.cluster.engflow.com
4242
action_cache_address = <CLUSTER_NAME>.cluster.engflow.com
4343
cas_address = <CLUSTER_NAME>.cluster.engflow.com
44-
http_headers = x-engflow-auth-method:jwt-v0,x-engflow-auth-token:LONG_JWT_STRING
44+
http_headers = <AUTH_HTTP_HEADERS>
4545

4646
[build]
4747
execution_platforms = root//platforms:remote_platform

buck2/cpp/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ following:
3535
engine_address = <CLUSTER_NAME>.cluster.engflow.com
3636
action_cache_address = <CLUSTER_NAME>.cluster.engflow.com
3737
cas_address = <CLUSTER_NAME>.cluster.engflow.com
38-
http_headers = x-engflow-auth-method:jwt-v0,x-engflow-auth-token:LONG_JWT_STRING
38+
http_headers = <AUTH_HTTP_HEADERS>
3939
```
4040

41-
To obtain the value of `LONG_JWT_STRING`, log into https://<CLUSTER_NAME>.cluster.engflow.com/gettingstarted and use the value of `x-engflow-auth-token` in section `Method 2: JWT`.
41+
To obtain the value of `<AUTH_HTTP_HEADERS>`, log into https://<CLUSTER_NAME>.cluster.engflow.com/gettingstarted and obtain the value of `x-engflow-auth-token` in section `Method 2: JWT`, take note of this value. Then set `AUTH_HTTP_HEADERS` with the value `x-engflow-auth-method:jwt-v0,x-engflow-auth-token:<JWT_TOKEN_FROM_GETTINGSTARTED_PAGE>.
42+
43+
Note for CI runs, the auth method used is [Github Tokens](https://docs.engflow.com/re/config/authentication.html#github-tokens).
4244

4345
### Usage instructions
4446

buck2/golang/.buckconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ digest_algorithms = SHA256
2323
engine_address = <CLUSTER_NAME>.cluster.engflow.com
2424
action_cache_address = <CLUSTER_NAME>.cluster.engflow.com
2525
cas_address = <CLUSTER_NAME>.cluster.engflow.com
26-
http_headers = x-engflow-auth-method:jwt-v0,x-engflow-auth-token:LONG_JWT_STRING
26+
http_headers = <AUTH_HTTP_HEADERS>
2727

2828
[build]
2929
execution_platforms = root//platforms:remote_platform

buck2/golang/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ following:
4646
engine_address = <CLUSTER_NAME>.cluster.engflow.com
4747
action_cache_address = <CLUSTER_NAME>.cluster.engflow.com
4848
cas_address = <CLUSTER_NAME>.cluster.engflow.com
49-
http_headers = x-engflow-auth-method:jwt-v0,x-engflow-auth-token:LONG_JWT_STRING
49+
http_headers = <AUTH_HTTP_HEADERS>
5050
```
5151

52-
To obtain the value of `LONG_JWT_STRING`, log into https://<CLUSTER_NAME>.cluster.engflow.com/gettingstarted and use the value of `x-engflow-auth-token` in section `Method 2: JWT`.
52+
To obtain the value of `<AUTH_HTTP_HEADERS>`, log into https://<CLUSTER_NAME>.cluster.engflow.com/gettingstarted and obtain the value of `x-engflow-auth-token` in section `Method 2: JWT`, take note of this value. Then set `AUTH_HTTP_HEADERS` with the value `x-engflow-auth-method:jwt-v0,x-engflow-auth-token:<JWT_TOKEN_FROM_GETTINGSTARTED_PAGE>.
53+
54+
Note for CI runs, the auth method used is [Github Tokens](https://docs.engflow.com/re/config/authentication.html#github-tokens).

buck2/python/.buckconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ digest_algorithms = SHA256
2323
engine_address = <CLUSTER_NAME>.cluster.engflow.com
2424
action_cache_address = <CLUSTER_NAME>.cluster.engflow.com
2525
cas_address = <CLUSTER_NAME>.cluster.engflow.com
26-
http_headers = x-engflow-auth-method:jwt-v0,x-engflow-auth-token:LONG_JWT_STRING
26+
http_headers = <AUTH_HTTP_HEADERS>
2727

2828
[build]
2929
execution_platforms = root//platforms:remote_platform

buck2/python/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ following:
4949
engine_address = <CLUSTER_NAME>.cluster.engflow.com
5050
action_cache_address = <CLUSTER_NAME>.cluster.engflow.com
5151
cas_address = <CLUSTER_NAME>.cluster.engflow.com
52-
http_headers = x-engflow-auth-method:jwt-v0,x-engflow-auth-token:LONG_JWT_STRING
52+
http_headers = <AUTH_HTTP_HEADERS>
5353
```
5454

55-
To obtain the value of `LONG_JWT_STRING`, log into https://<CLUSTER_NAME>.cluster.engflow.com/gettingstarted and use the value of `x-engflow-auth-token` in section `Method 2: JWT`.
55+
To obtain the value of `<AUTH_HTTP_HEADERS>`, log into https://<CLUSTER_NAME>.cluster.engflow.com/gettingstarted and obtain the value of `x-engflow-auth-token` in section `Method 2: JWT`, take note of this value. Then set `AUTH_HTTP_HEADERS` with the value `x-engflow-auth-method:jwt-v0,x-engflow-auth-token:<JWT_TOKEN_FROM_GETTINGSTARTED_PAGE>.
56+
57+
Note for CI runs, the auth method used is [Github Tokens](https://docs.engflow.com/re/config/authentication.html#github-tokens).

infra/auth-buck2.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
set -xe
3+
4+
# Modify the buck2/**/.buckconfig files to set the test cluster to opal.
5+
find ./ -type f -name '.buckconfig' -exec sed -i 's/<CLUSTER_NAME>/opal/g' {} \;
6+
7+
# Modify the buck2/**/.buckconfig files to set the "Authorization=Bearer $GITHUB_TOKEN" in the http_headers.
8+
find ./ -type f -name '.buckconfig' -exec sed -i 's/<AUTH_HTTP_HEADERS>/Authorization:Bearer $GITHUB_TOKEN/g' {} \;
9+

infra/setup-buck2.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
set -xe
3+
4+
# Get the Buck2 binary.
5+
curl -L -O https://github.com/facebook/buck2/releases/download/latest/buck2-x86_64-unknown-linux-musl.zst
6+
7+
# Unpack the binary.
8+
unzstd buck2-x86_64-unknown-linux-musl.zst
9+
10+
# Change its name and make it executable.
11+
mv buck2-x86_64-unknown-linux-musl buck2-exe
12+
chmod +x buck2-exe

infra/test-buck2.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
set -xe
3+
shopt -s expand_aliases
4+
5+
alias buck2="$(realpath buck2-exe)"
6+
7+
# Run cpp example
8+
cd buck2/cpp
9+
buck2 build //:cpp_lib
10+
buck2 test //:cpp_test
11+
cd ..
12+
13+
# Run python example
14+
cd python
15+
buck2 build //main:check_main
16+
buck2 test //hello:hello_unittest_test
17+
cd ..
18+
19+
# Run go example
20+
cd golang
21+
buck2 build //go:hello
22+
buck2 test //go/greeting:greeting_test
23+
cd ..

0 commit comments

Comments
 (0)