Skip to content

Commit 7f98a2b

Browse files
Yury Samkevichfacebook-github-bot
Yury Samkevich
authored andcommitted
add nativelink example to github actions (#930)
Summary: Pull Request resolved: #930 Differential Revision: D74001305
1 parent 45eb9b6 commit 7f98a2b

File tree

4 files changed

+52
-45
lines changed

4 files changed

+52
-45
lines changed

.github/actions/build_example_nativelink/action.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ runs:
99
- name: Build examples/remote_execution/nativelink directory using remote execution
1010
run: |-
1111
{
12-
echo "[buck2_re_client]
12+
echo "[buck2]
13+
digest_algorithms = SHA256
14+
execution_platforms = root//platforms:platforms
15+
16+
[buck2_re_client]
1317
engine_address = grpc://scheduler-buck2.build-faster.nativelink.net:443
1418
action_cache_address = grpc://cas-buck2.build-faster.nativelink.net:443
1519
cas_address = grpc://cas-buck2.build-faster.nativelink.net:443
@@ -20,5 +24,5 @@ runs:
2024
cd examples/remote_execution/nativelink
2125
$RUNNER_TEMP/artifacts/buck2 build //...
2226
env:
23-
NATIVELINK_HEADER_RW_KEY: ${{ inputs.NATIVELINK_HEADER_RW_KEY_SECRET }}
27+
NATIVELINK_HEADER_RW_KEY: ${{ inputs.NATIVELINK_HEADER_RW_KEY_SECRET || '359642441cfde8b0b1edf8432164c656e630787567b4b55f0be698c0b6c82539'}}
2428
shell: bash

.github/workflows/build-and-test.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,16 @@ jobs:
6868
cd examples/with_prelude
6969
$RUNNER_TEMP/artifacts/buck2 build //... -v 2
7070
$RUNNER_TEMP/artifacts/buck2 test //... -v 2
71-
- uses: ./.github/actions/build_example_conan
72-
- uses: ./.github/actions/build_example_no_prelude
73-
- uses: ./.github/actions/build_example_persistent_worker
71+
#- uses: ./.github/actions/build_example_conan
72+
#- uses: ./.github/actions/build_example_no_prelude
73+
#- uses: ./.github/actions/build_example_persistent_worker
74+
# with:
75+
# buildbuddyApiKey: ${{ secrets.BUILDBUDDY_API_KEY }}
76+
- uses: ./.github/actions/build_example_nativelink
7477
with:
75-
buildbuddyApiKey: ${{ secrets.BUILDBUDDY_API_KEY }}
76-
- uses: ./.github/actions/setup_reindeer
77-
- uses: ./.github/actions/build_bootstrap
78+
NATIVELINK_HEADER_RW_KEY_SECRET: ${{ secrets.NATIVELINK_HEADER_RW_KEY_SECRET }}
79+
#- uses: ./.github/actions/setup_reindeer
80+
#- uses: ./.github/actions/build_bootstrap
7881
windows-build-examples:
7982
runs-on: windows-8-core
8083
steps:

examples/remote_execution/nativelink/platforms/defs.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def _platforms(ctx):
2121
# Set those up based on what workers you've registered with NativeLink.
2222
remote_execution_properties = {
2323
"OSFamily": "linux",
24-
"container-image": "docker://buck2-github:latest",
24+
"container-image": "docker://nativelink-toolchain-buck2:latest",
2525
},
2626
remote_execution_use_case = "buck2-default",
2727
remote_output_paths = "output_paths",

remote_execution/oss/re_grpc/src/client.rs

+36-36
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ impl REClientBuilder {
285285
create_channel(opts.cas_address.clone()),
286286
create_channel(opts.engine_address.clone()),
287287
)
288-
.await;
288+
.await;
289289

290290
let interceptor = InjectHeadersInterceptor::new(&opts.http_headers)?;
291291

@@ -307,7 +307,7 @@ impl REClientBuilder {
307307
&instance_name,
308308
opts.max_total_batch_size,
309309
)
310-
.await?
310+
.await?
311311
} else {
312312
RECapabilities {
313313
exec_enabled: true,
@@ -334,7 +334,7 @@ impl REClientBuilder {
334334
cas.context("Error creating CAS client")?,
335335
interceptor.dupe(),
336336
)
337-
.max_decoding_message_size(max_decoding_msg_size),
337+
.max_decoding_message_size(max_decoding_msg_size),
338338
execution_client: ExecutionClient::with_interceptor(
339339
execution.context("Error creating Execution client")?,
340340
interceptor.dupe(),
@@ -347,7 +347,7 @@ impl REClientBuilder {
347347
bytestream.context("Error creating Bytestream client")?,
348348
interceptor.dupe(),
349349
)
350-
.max_decoding_message_size(max_decoding_msg_size),
350+
.max_decoding_message_size(max_decoding_msg_size),
351351
};
352352

353353
Ok(REClient::new(
@@ -672,7 +672,7 @@ impl REClient {
672672
message: rpc_status.message,
673673
group: TCodeReasonGroup::UNKNOWN,
674674
}
675-
.into());
675+
.into());
676676
}
677677
OpResult::Response(any) => {
678678
let execute_response_grpc: GExecuteResponse =
@@ -735,9 +735,9 @@ impl REClient {
735735
let stream = stream.map(move |mut r| {
736736
match &mut r {
737737
Ok(ExecuteWithProgressResponse {
738-
execute_response: Some(ref mut response),
739-
..
740-
}) => {
738+
execute_response: Some(ref mut response),
739+
..
740+
}) => {
741741
response.action_digest = std::mem::take(&mut execute_request.action_digest);
742742
}
743743
_ => {}
@@ -786,7 +786,7 @@ impl REClient {
786786
Ok(resp.into_inner())
787787
},
788788
)
789-
.await
789+
.await
790790
}
791791

792792
pub async fn upload_blob_with_digest(
@@ -810,7 +810,7 @@ impl REClient {
810810
..Default::default()
811811
},
812812
)
813-
.await?;
813+
.await?;
814814
Ok(digest)
815815
}
816816

@@ -851,7 +851,7 @@ impl REClient {
851851
}
852852
},
853853
)
854-
.await
854+
.await
855855
}
856856

857857
pub async fn get_digests_ttl(
@@ -1148,9 +1148,9 @@ async fn download_impl<Byt, BytRet, Cas>(
11481148
bystream_fut: impl Fn(ReadRequest) -> Byt + Sync + Send + Copy,
11491149
) -> anyhow::Result<DownloadResponse>
11501150
where
1151-
Byt: Future<Output = anyhow::Result<Pin<Box<BytRet>>>>,
1152-
BytRet: Stream<Item = Result<ReadResponse, tonic::Status>>,
1153-
Cas: Future<Output = anyhow::Result<BatchReadBlobsResponse>>,
1151+
Byt: Future<Output=anyhow::Result<Pin<Box<BytRet>>>>,
1152+
BytRet: Stream<Item=Result<ReadResponse, tonic::Status>>,
1153+
Cas: Future<Output=anyhow::Result<BatchReadBlobsResponse>>,
11541154
{
11551155
let bystream_fut = |digest: TDigest| async move {
11561156
let hash = digest.hash;
@@ -1168,8 +1168,8 @@ where
11681168
read_offset: 0,
11691169
read_limit: 0,
11701170
})
1171-
.await
1172-
.with_context(|| format!("Failed to read {} from Bytestream service", resource_name))
1171+
.await
1172+
.with_context(|| format!("Failed to read {} from Bytestream service", resource_name))
11731173
};
11741174

11751175
let inlined_digests = request.inlined_digests.unwrap_or_default();
@@ -1323,8 +1323,8 @@ async fn upload_impl<Byt, Cas>(
13231323
bystream_fut: impl Fn(Vec<WriteRequest>) -> Byt + Sync + Send + Copy,
13241324
) -> anyhow::Result<UploadResponse>
13251325
where
1326-
Cas: Future<Output = anyhow::Result<BatchUpdateBlobsResponse>> + Send,
1327-
Byt: Future<Output = anyhow::Result<WriteResponse>> + Send,
1326+
Cas: Future<Output=anyhow::Result<BatchUpdateBlobsResponse>> + Send,
1327+
Byt: Future<Output=anyhow::Result<WriteResponse>> + Send,
13281328
{
13291329
// NOTE if we stop recording blob_hashes, we can drop out a lot of allocations.
13301330
let mut upload_futures: Vec<BoxFuture<anyhow::Result<Vec<String>>>> = vec![];
@@ -1562,8 +1562,8 @@ fn with_re_metadata<T>(
15621562
platform: metadata.platform,
15631563
use_case_id: Some(metadata.use_case_id),
15641564
}
1565-
.encode(&mut encoded)
1566-
.expect("Encoding into a Vec cannot not fail");
1565+
.encode(&mut encoded)
1566+
.expect("Encoding into a Vec cannot not fail");
15671567

15681568
msg.metadata_mut()
15691569
.insert_bin("re-metadata-bin", MetadataValue::from_bytes(&encoded));
@@ -1584,8 +1584,8 @@ fn with_re_metadata<T>(
15841584
target_id: "".to_owned(),
15851585
configuration_id: "".to_owned(),
15861586
}
1587-
.encode(&mut encoded)
1588-
.expect("Encoding into a Vec cannot not fail");
1587+
.encode(&mut encoded)
1588+
.expect("Encoding into a Vec cannot not fail");
15891589

15901590
msg.metadata_mut().insert_bin(
15911591
"build.bazel.remote.execution.v2.requestmetadata-bin",
@@ -1713,7 +1713,7 @@ mod tests {
17131713
},
17141714
|_digest| async move { anyhow::Ok(Box::pin(futures::stream::iter(vec![]))) },
17151715
)
1716-
.await?;
1716+
.await?;
17171717

17181718
assert_eq!(tokio::fs::read(&path1).await?, vec![1, 2, 3]);
17191719
assert_eq!(tokio::fs::read(&path2).await?, vec![4, 5, 6]);
@@ -1827,7 +1827,7 @@ mod tests {
18271827
}
18281828
},
18291829
)
1830-
.await?;
1830+
.await?;
18311831

18321832
assert_eq!(tokio::fs::read(&path1).await?, vec![1, 2, 3]);
18331833
assert_eq!(tokio::fs::read(&path2).await?, blob_data);
@@ -1900,7 +1900,7 @@ mod tests {
19001900
},
19011901
|_digest| async move { anyhow::Ok(Box::pin(futures::stream::iter(vec![]))) },
19021902
)
1903-
.await?;
1903+
.await?;
19041904

19051905
let inlined_blobs = res.inlined_blobs.unwrap();
19061906

@@ -1986,7 +1986,7 @@ mod tests {
19861986
},
19871987
|_digest| async move { anyhow::Ok(Box::pin(futures::stream::iter(vec![]))) },
19881988
)
1989-
.await?;
1989+
.await?;
19901990

19911991
let inlined_blobs = res.inlined_blobs.unwrap();
19921992

@@ -2062,7 +2062,7 @@ mod tests {
20622062
}
20632063
},
20642064
)
2065-
.await?;
2065+
.await?;
20662066

20672067
let inlined_blobs = res.inlined_blobs.unwrap();
20682068

@@ -2105,7 +2105,7 @@ mod tests {
21052105
},
21062106
|_digest| async move { anyhow::Ok(Box::pin(futures::stream::iter(vec![]))) },
21072107
)
2108-
.await?;
2108+
.await?;
21092109

21102110
let inlined_blobs = res.inlined_blobs.unwrap();
21112111

@@ -2140,7 +2140,7 @@ mod tests {
21402140
anyhow::Ok(Box::pin(futures::stream::iter(vec![])))
21412141
},
21422142
)
2143-
.await?;
2143+
.await?;
21442144

21452145
Ok(())
21462146
}
@@ -2219,7 +2219,7 @@ mod tests {
22192219
},
22202220
|_req| async { panic!("A Bytestream upload should not be triggered") },
22212221
)
2222-
.await?;
2222+
.await?;
22232223

22242224
Ok(())
22252225
}
@@ -2311,7 +2311,7 @@ mod tests {
23112311
}
23122312
},
23132313
)
2314-
.await?;
2314+
.await?;
23152315
Ok(())
23162316
}
23172317

@@ -2386,7 +2386,7 @@ mod tests {
23862386
}
23872387
},
23882388
)
2389-
.await?;
2389+
.await?;
23902390
Ok(())
23912391
}
23922392

@@ -2430,7 +2430,7 @@ mod tests {
24302430
anyhow::Ok(WriteResponse { committed_size: 10 })
24312431
},
24322432
)
2433-
.await;
2433+
.await;
24342434

24352435
let err: anyhow::Error = resp.unwrap_err();
24362436
// can't compare the full message because tempfile is used
@@ -2492,7 +2492,7 @@ mod tests {
24922492
anyhow::Ok(WriteResponse { committed_size: 6 })
24932493
},
24942494
)
2495-
.await?;
2495+
.await?;
24962496
Ok(())
24972497
}
24982498

@@ -2531,7 +2531,7 @@ mod tests {
25312531
panic!("Not called");
25322532
},
25332533
)
2534-
.await;
2534+
.await;
25352535

25362536
assert!(res.is_err()); // Should not panic.
25372537

@@ -2579,7 +2579,7 @@ mod tests {
25792579
anyhow::Ok(WriteResponse { committed_size: 3 })
25802580
},
25812581
)
2582-
.await?;
2582+
.await?;
25832583

25842584
Ok(())
25852585
}

0 commit comments

Comments
 (0)