|
8 | 8 | Start-Event "deploy-game" "build-unreal-gdk-example-project-:windows:" |
9 | 9 | # Use the shortened commit hash gathered during GDK plugin clone and the current date and time to distinguish the deployment |
10 | 10 | $date_and_time = Get-Date -Format "MMdd_HHmm" |
11 | | - $deployment_name = "exampleproject_${date_and_time}_$($gdk_commit_hash)" |
| 11 | + $deployment_name = "exampleproject$($env:STEP_NUMBER)_${date_and_time}_$($gdk_commit_hash)" |
12 | 12 | $assembly_name = "$($deployment_name)_asm" |
13 | 13 |
|
14 | 14 | pushd "spatial" |
@@ -66,96 +66,21 @@ pushd "spatial" |
66 | 66 | "--snapshot=$deployment_snapshot_path", ` |
67 | 67 | "--cluster_region=$deployment_cluster_region", ` |
68 | 68 | "--log_level=debug", ` |
69 | | - "--tags=ttl_1_hours" |
| 69 | + "--tags=ttl_1_hours", ` |
| 70 | + "--deployment_description=`"Engine commit: $($env:ENGINE_COMMIT_HASH)`"" ` |
70 | 71 | ) |
71 | 72 |
|
72 | 73 | if ($launch_deployment_process.ExitCode -ne 0) { |
73 | 74 | Write-Log "Failed to launch a Spatial cloud deployment. Error: $($launch_deployment_process.ExitCode)" |
74 | 75 | Throw "Deployment launch failed" |
75 | 76 | } |
| 77 | + |
| 78 | + buildkite-agent meta-data set "deployment-name-$($env:STEP_NUMBER)" "$deployment_name" |
| 79 | + buildkite-agent meta-data set "project-name" "$project_name" |
| 80 | + buildkite-agent meta-data set "gdk-commit-hash" "$gdk_commit_hash)" |
76 | 81 | } else { |
77 | 82 | Write-Log "Deployment will not be launched as you have passed in an argument specifying that it should not be (START_DEPLOYMENT=${launch_deployment}). Remove it to have your build launch a deployment." |
78 | 83 | } |
79 | | - |
80 | | - if ($env:BUILDKITE_BRANCH -eq "master" -or $env:BUILDKITE_SLACK_NOTIFY -eq "true") { |
81 | | - # Send a Slack notification with a link to the new deployment and to the build. |
82 | | - |
83 | | - # Build Slack text |
84 | | - if ($env:BUILDKITE_NIGHTLY_BUILD -eq "true") { |
85 | | - $slack_text = ":night_with_stars: Nightly build of *Example Project* succeeded." |
86 | | - } else { |
87 | | - $slack_text = "*Example Project* build by $env:BUILDKITE_BUILD_CREATOR succeeded." |
88 | | - } |
89 | | - |
90 | | - # Read Slack webhook secret from the vault and extract the Slack webhook URL from it. |
91 | | - $slack_webhook_secret = "$(imp-ci secrets read --environment=production --buildkite-org=improbable --secret-type=slack-webhook --secret-name=unreal-gdk-slack-web-hook)" |
92 | | - $slack_webhook_url = $slack_webhook_secret | ConvertFrom-Json | %{$_.url} |
93 | | - |
94 | | - $deployment_url = "https://console.improbable.io/projects/${project_name}/deployments/${deployment_name}/overview" |
95 | | - $gdk_commit_url = "https://github.com/spatialos/UnrealGDK/commit/${gdk_commit_hash}" |
96 | | - $project_commit_url = "https://github.com/spatialos/UnrealGDKExampleProject/commit/$env:BUILDKITE_COMMIT" |
97 | | - $build_url = "$env:BUILDKITE_BUILD_URL" |
98 | | - $json_message = [ordered]@{ |
99 | | - text = "$slack_text" |
100 | | - attachments= @( |
101 | | - @{ |
102 | | - fallback = "Find build here: $build_url and potential deployment here: $deployment_url" |
103 | | - color = "good" |
104 | | - fields = @( |
105 | | - @{ |
106 | | - title = "Build Message" |
107 | | - value = "$env:BUILDKITE_MESSAGE".Substring(0, [System.Math]::Min(64, "$env:BUILDKITE_MESSAGE".Length)) |
108 | | - short = "true" |
109 | | - } |
110 | | - @{ |
111 | | - title = "Example Project branch" |
112 | | - value = "$env:BUILDKITE_BRANCH" |
113 | | - short = "true" |
114 | | - } |
115 | | - @{ |
116 | | - title = "GDK branch" |
117 | | - value = "$gdk_branch_name" |
118 | | - short = "true" |
119 | | - } |
120 | | - ) |
121 | | - actions = @( |
122 | | - @{ |
123 | | - type = "button" |
124 | | - text = ":github: Project commit" |
125 | | - url = "$project_commit_url" |
126 | | - style = "primary" |
127 | | - } |
128 | | - @{ |
129 | | - type = "button" |
130 | | - text = ":github: GDK commit" |
131 | | - url = "$gdk_commit_url" |
132 | | - style = "primary" |
133 | | - } |
134 | | - @{ |
135 | | - type = "button" |
136 | | - text = ":buildkite: BK build" |
137 | | - url = "$build_url" |
138 | | - style = "primary" |
139 | | - } |
140 | | - ) |
141 | | - } |
142 | | - ) |
143 | | - } |
144 | | - |
145 | | - if ($launch_deployment -eq "true") { |
146 | | - $deployment_button = @{ |
147 | | - type = "button" |
148 | | - text = ":cloud: Deployment" |
149 | | - url = "$deployment_url" |
150 | | - style = "primary" |
151 | | - } |
152 | | - $json_message["attachments"][0]["actions"] += ($deployment_button) |
153 | | - } |
154 | | - |
155 | | - $json_request = $json_message | ConvertTo-Json -Depth 10 |
156 | | - |
157 | | - Invoke-WebRequest -UseBasicParsing "$slack_webhook_url" -ContentType "application/json" -Method POST -Body "$json_request" |
158 | | - } |
159 | 84 | Finish-Event "launch-deployment" "deploy-unreal-gdk-example-project-:windows:" |
160 | 85 |
|
161 | 86 | popd |
|
0 commit comments