-
Notifications
You must be signed in to change notification settings - Fork 0
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
beam 1215 - upload to ECR #2363
base: main
Are you sure you want to change the base?
Conversation
Have a WebGL build, friend. 9e7dd732df88396c51e6f957b3f78bc6de59e08d |
Have a WebGL build, friend. 6b0a5f36f2fffc0d265eb2209a4ffdf9d8aab821 |
Have a WebGL build, friend. eaaea73f08543a19ecdb76e1a1cd96a505d2576b |
Have a WebGL build, friend. 67395f107318d9787aa818c137f1d0210f6efb68 |
} | ||
if (!string.IsNullOrEmpty(args.authHeader)) | ||
{ | ||
request = request.WithHeader("Authorization", "Bearer 5d938ebe-9cbd-41d6-b077-d8dd89b99819"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aaaah oh no what have I done.
namespace Beamable.Server | ||
{ | ||
public class BeamableLoggerDebug : IDebug |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add at least #pragma warning disable 1591
for that class?
// public static class Doodad | ||
// { | ||
// [MenuItem("UPLOAD/TESTSTUFF")] | ||
// public static async void TestTheThing() | ||
// { | ||
// var api = BeamEditorContext.Default; | ||
// await api.InitializePromise; | ||
// | ||
// var _client = new HttpClient(); | ||
// var cid = api.Requester.Cid; | ||
// var pid = api.Requester.Pid; | ||
// _client.DefaultRequestHeaders.Add("x-ks-clientid", cid); | ||
// _client.DefaultRequestHeaders.Add("x-ks-projectid", pid); | ||
// _client.DefaultRequestHeaders.Add("x-ks-token", api.Requester.Token.Token); | ||
// var serviceUniqueName = "ee6e048a0b6017c4990f13f9d07f9e";//GetHash($"{cid}_{api.ProductionRealm.Pid}_swagger2").Substring(0, 30); | ||
// | ||
// Debug.Log("UNIQUE SERVICE NAME " + serviceUniqueName); | ||
// var _uploadBaseUri = $"https://vwe9gi1uxg.execute-api.us-west-2.amazonaws.com/dev/v2/{serviceUniqueName}"; | ||
// | ||
// var manifest = | ||
// "[{\"Config\":\"0028ad28bb75ccb988689b6e5903f2d965d0de3ae5c5572fbc457f8e4542bd1e.json\",\"RepoTags\":null,\"Layers\":[\"1288696addccc4013c5bcf61c1b6c38128a7214a0942976792918b51912d90f7/layer.tar\",\"23747de4211504b6a1554ded518d7abb1e42049460a8eace93cc274553d8e4ea/layer.tar\",\"96c4e657586f01e8c1e113952dbfadddc0036cc8c9f2cc4209233ae2ea4d16cc/layer.tar\",\"a36c795243d77178545508b4f9695c17824d9264bfa9acf4e2e747362ce6260f/layer.tar\",\"80d277b9f6fabe21f1b8432519a55534ba496344ef18c9f5186f368cbb2b49cb/layer.tar\"]}]"; | ||
// | ||
// var encodedManifest = Base64Encode(manifest); | ||
// // var hardcodedBase64 = | ||
// // "W3siQ29uZmlnIjoiMDAyOGFkMjhiYjc1Y2NiOTg4Njg5YjZlNTkwM2YyZDk2NWQwZGUzYWU1YzU1NzJmYmM0NTdmOGU0NTQyYmQxZS5qc29uIiwiUmVwb1RhZ3MiOm51bGwsIkxheWVycyI6WyIxMjg4Njk2YWRkY2NjNDAxM2M1YmNmNjFjMWI2YzM4MTI4YTcyMTRhMDk0Mjk3Njc5MjkxOGI1MTkxMmQ5MGY3L2xheWVyLnRhciIsIjIzNzQ3ZGU0MjExNTA0YjZhMTU1NGRlZDUxOGQ3YWJiMWU0MjA0OTQ2MGE4ZWFjZTkzY2MyNzQ1NTNkOGU0ZWEvbGF5ZXIudGFyIiwiOTZjNGU2NTc1ODZmMDFlOGMxZTExMzk1MmRiZmFkZGRjMDAzNmNjOGM5ZjJjYzQyMDkyMzNhZTJlYTRkMTZjYy9sYXllci50YXIiLCJhMzZjNzk1MjQzZDc3MTc4NTQ1NTA4YjRmOTY5NWMxNzgyNGQ5MjY0YmZhOWFjZjRlMmU3NDczNjJjZTYyNjBmL2xheWVyLnRhciIsIjgwZDI3N2I5ZjZmYWJlMjFmMWI4NDMyNTE5YTU1NTM0YmE0OTYzNDRlZjE4YzlmNTE4NmYzNjhjYmIyYjQ5Y2IvbGF5ZXIudGFyIl19XQo="; | ||
// //var bytes = UTF8Encoding.ASCII.GetBytes(manifest); | ||
// // Debug.Log("BYTE SIZE IS " + bytes.Length);// | ||
// var commitToRegistryResponse = await _client.PostAsync($"{_uploadBaseUri}/submitLayersToECR?imageTag=latest", new StringContent(manifest)); | ||
// | ||
// try | ||
// { | ||
// commitToRegistryResponse.EnsureSuccessStatusCode(); | ||
// } | ||
// catch (HttpRequestException httpError) | ||
// { | ||
// throw new HttpRequestException($"Commiting image to registry failed with: {httpError}"); | ||
// } | ||
// } | ||
// | ||
// public static string Base64Encode(string plainText) | ||
// { | ||
// var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); | ||
// return System.Convert.ToBase64String(plainTextBytes); | ||
// } | ||
// | ||
// private readonly static MD5 _md5 = MD5.Create(); | ||
// | ||
// static string GetHash(string input) | ||
// { | ||
// byte[] data = _md5.ComputeHash(Encoding.UTF8.GetBytes(input)); | ||
// var sBuilder = new StringBuilder(); | ||
// for (int i = 0; i < data.Length; i++) | ||
// { | ||
// sBuilder.Append(data[i].ToString("x2")); | ||
// } | ||
// return sBuilder.ToString(); | ||
// } | ||
// | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// public static class Doodad | |
// { | |
// [MenuItem("UPLOAD/TESTSTUFF")] | |
// public static async void TestTheThing() | |
// { | |
// var api = BeamEditorContext.Default; | |
// await api.InitializePromise; | |
// | |
// var _client = new HttpClient(); | |
// var cid = api.Requester.Cid; | |
// var pid = api.Requester.Pid; | |
// _client.DefaultRequestHeaders.Add("x-ks-clientid", cid); | |
// _client.DefaultRequestHeaders.Add("x-ks-projectid", pid); | |
// _client.DefaultRequestHeaders.Add("x-ks-token", api.Requester.Token.Token); | |
// var serviceUniqueName = "ee6e048a0b6017c4990f13f9d07f9e";//GetHash($"{cid}_{api.ProductionRealm.Pid}_swagger2").Substring(0, 30); | |
// | |
// Debug.Log("UNIQUE SERVICE NAME " + serviceUniqueName); | |
// var _uploadBaseUri = $"https://vwe9gi1uxg.execute-api.us-west-2.amazonaws.com/dev/v2/{serviceUniqueName}"; | |
// | |
// var manifest = | |
// "[{\"Config\":\"0028ad28bb75ccb988689b6e5903f2d965d0de3ae5c5572fbc457f8e4542bd1e.json\",\"RepoTags\":null,\"Layers\":[\"1288696addccc4013c5bcf61c1b6c38128a7214a0942976792918b51912d90f7/layer.tar\",\"23747de4211504b6a1554ded518d7abb1e42049460a8eace93cc274553d8e4ea/layer.tar\",\"96c4e657586f01e8c1e113952dbfadddc0036cc8c9f2cc4209233ae2ea4d16cc/layer.tar\",\"a36c795243d77178545508b4f9695c17824d9264bfa9acf4e2e747362ce6260f/layer.tar\",\"80d277b9f6fabe21f1b8432519a55534ba496344ef18c9f5186f368cbb2b49cb/layer.tar\"]}]"; | |
// | |
// var encodedManifest = Base64Encode(manifest); | |
// // var hardcodedBase64 = | |
// // "W3siQ29uZmlnIjoiMDAyOGFkMjhiYjc1Y2NiOTg4Njg5YjZlNTkwM2YyZDk2NWQwZGUzYWU1YzU1NzJmYmM0NTdmOGU0NTQyYmQxZS5qc29uIiwiUmVwb1RhZ3MiOm51bGwsIkxheWVycyI6WyIxMjg4Njk2YWRkY2NjNDAxM2M1YmNmNjFjMWI2YzM4MTI4YTcyMTRhMDk0Mjk3Njc5MjkxOGI1MTkxMmQ5MGY3L2xheWVyLnRhciIsIjIzNzQ3ZGU0MjExNTA0YjZhMTU1NGRlZDUxOGQ3YWJiMWU0MjA0OTQ2MGE4ZWFjZTkzY2MyNzQ1NTNkOGU0ZWEvbGF5ZXIudGFyIiwiOTZjNGU2NTc1ODZmMDFlOGMxZTExMzk1MmRiZmFkZGRjMDAzNmNjOGM5ZjJjYzQyMDkyMzNhZTJlYTRkMTZjYy9sYXllci50YXIiLCJhMzZjNzk1MjQzZDc3MTc4NTQ1NTA4YjRmOTY5NWMxNzgyNGQ5MjY0YmZhOWFjZjRlMmU3NDczNjJjZTYyNjBmL2xheWVyLnRhciIsIjgwZDI3N2I5ZjZmYWJlMjFmMWI4NDMyNTE5YTU1NTM0YmE0OTYzNDRlZjE4YzlmNTE4NmYzNjhjYmIyYjQ5Y2IvbGF5ZXIudGFyIl19XQo="; | |
// //var bytes = UTF8Encoding.ASCII.GetBytes(manifest); | |
// // Debug.Log("BYTE SIZE IS " + bytes.Length);// | |
// var commitToRegistryResponse = await _client.PostAsync($"{_uploadBaseUri}/submitLayersToECR?imageTag=latest", new StringContent(manifest)); | |
// | |
// try | |
// { | |
// commitToRegistryResponse.EnsureSuccessStatusCode(); | |
// } | |
// catch (HttpRequestException httpError) | |
// { | |
// throw new HttpRequestException($"Commiting image to registry failed with: {httpError}"); | |
// } | |
// } | |
// | |
// public static string Base64Encode(string plainText) | |
// { | |
// var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText); | |
// return System.Convert.ToBase64String(plainTextBytes); | |
// } | |
// | |
// private readonly static MD5 _md5 = MD5.Create(); | |
// | |
// static string GetHash(string input) | |
// { | |
// byte[] data = _md5.ComputeHash(Encoding.UTF8.GetBytes(input)); | |
// var sBuilder = new StringBuilder(); | |
// for (int i = 0; i < data.Length; i++) | |
// { | |
// sBuilder.Append(data[i].ToString("x2")); | |
// } | |
// return sBuilder.ToString(); | |
// } | |
// | |
// } |
// private async Task<bool> GetLayer(string layer) | ||
// { | ||
// var response = await _client.GetAsync($"{_uploadBaseUri}/doesLayerExist?digest={layer}"); | ||
// | ||
// switch (response.StatusCode) | ||
// { | ||
// case HttpStatusCode.NotFound: | ||
// return false; // a valid error code meaning the layer does not exist. | ||
// case HttpStatusCode.OK: | ||
// return true; // the body does not need to be serialized, because any 200 implies success. | ||
// default: | ||
// response.EnsureSuccessStatusCode(); | ||
// return false; | ||
// } | ||
// | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// private async Task<bool> GetLayer(string layer) | |
// { | |
// var response = await _client.GetAsync($"{_uploadBaseUri}/doesLayerExist?digest={layer}"); | |
// | |
// switch (response.StatusCode) | |
// { | |
// case HttpStatusCode.NotFound: | |
// return false; // a valid error code meaning the layer does not exist. | |
// case HttpStatusCode.OK: | |
// return true; // the body does not need to be serialized, because any 200 implies success. | |
// default: | |
// response.EnsureSuccessStatusCode(); | |
// return false; | |
// } | |
// | |
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for the most part, some questions 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐗
We'll have to wait until the backend changes go live before we can push this. |
Have a WebGL build, friend. 3d2988b20ae76320a7a65b68175a978b230cff00 |
Have a WebGL build, friend. 05a3228cc6167741719165383d3adac05d27bf2c |
Have a WebGL build, friend. 173581079c1868518b741dd7fc6896ba9c38a335 |
# Conflicts: # cli/cli/Commands/Services/ServicesDeployCommand.cs # client/Packages/com.beamable.server/CHANGELOG.md
Have a WebGL build, friend. 8c1b07a59e34d2c9bb6f2852671b65d52acce493 |
Lightbeam link |
Lightbeam link |
Lightbeam link |
Ticket
https://disruptorbeam.atlassian.net/browse/BEAM-1215
Brief Description
Moved the upload code into a common directory so it could be shared between Unity and CLI, and used the upload code from the JIRA sample snippet, with some modifications.
Also added a few flags to the beam profile nbomber command that are semi unrelated
Checklist
/wiki/BEAM-1234.md
? You need to provide a docs file.Notes
When you are merging a feature branch into
main
, please squash merge and make sure the final commit contains any relevent JIRA ticket number. If you are merging frommain
tostaging
, orstaging
toproduction
, please use a regular merge commit.