Skip to content

Commit 1236901

Browse files
committed
Better Orb error cred givebacks
1 parent dedc18b commit 1236901

File tree

6 files changed

+41
-17
lines changed

6 files changed

+41
-17
lines changed

README.md

+9
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,12 @@ We welcome [issues](https://github.com/game-ci/unity-orb/issues) to and [pull re
3030
5. Now ensure the version tag selected is semantically accurate based on the changes included.
3131
6. Click _"Publish Release"_.
3232
- This will push a new tag and trigger your publishing pipeline on CircleCI.
33+
34+
### Manual Deploy
35+
If you want a private orb for your build env. The following steps allow you to do so. These are adapted from the CircleCI
36+
[Manual Orb Authoring Process](https://circleci.com/docs/orb-author-validate-publish/#publish-your-orb)
37+
1. `circleci namespace create <name> --org-id <your-organization-id>`
38+
2. `circleci orb create <my-namespace>/<my-orb-name> --private`
39+
3. `circleci orb pack src > unity-orb.yml`
40+
4. `circleci orb publish unity-orb.yml <my-namespace>/<my-orb-name>@dev:first`
41+
5. `circleci orb publish promote <my-namespace>/<my-orb-name>@dev:first patch`

src/scripts/linux/git-credential.sh src/scripts/linux/set-gitcredential.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ else
1919
fi
2020

2121
echo "---------- git config --list -------------"
22-
git config --list
22+
git --no-pager config --list
2323

2424
echo "---------- git config --list --show-origin -------------"
25-
git config --list --show-origin
25+
git --no-pager config --list --show-origin

src/scripts/macos/set-gitcredential.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ else
1919
fi
2020

2121
echo "---------- git config --list -------------"
22-
git config --list
22+
git --no-pager config --list
2323

2424
echo "---------- git config --list --show-origin -------------"
25-
git config --list --show-origin
25+
git --no-pager config --list --show-origin

src/scripts/set-gitcredential.sh

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ detect-os
1212

1313
# Expand environment name variable parameters.
1414
readonly git_private_token="${!PARAM_GIT_PRIVATE_TOKEN}"
15-
readonly CONTAINER_NAME="${CIRCLE_PROJECT_REPONAME}-${CIRCLE_BUILD_NUM}"
1615

1716
if [ "$PLATFORM" = "linux" ]; then eval "$SCRIPT_GIT_CREDENTIAL_LINUX";
1817
elif [ "$PLATFORM" = "macos" ]; then eval "$SCRIPT_GIT_CREDENTIAL_MACOS";

src/scripts/windows/return-license.sh

+26-10
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,35 @@
33
# shellcheck disable=SC2154
44

55
trap_exit() {
6-
local exit_status="$?"
7-
8-
if [ "$exit_status" -ne 0 ]; then
9-
printf '%s\n' 'The script did not complete successfully.'
10-
11-
printf '%s\n' "Removing the container \"$CONTAINER_NAME\"."
12-
docker rm -f "$CONTAINER_NAME" &> /dev/null || true
13-
14-
exit "$exit_status"
15-
fi
6+
local exit_status="$?"
7+
8+
if [ "$exit_status" -ne 0 ]; then
9+
printf '%s\n' 'The script did not complete successfully.'
10+
11+
printf '%s\n' "Removing the container \"$CONTAINER_NAME\"."
12+
docker rm -f "$CONTAINER_NAME" &> /dev/null || true
13+
14+
exit "$exit_status"
15+
fi
1616
}
1717
trap trap_exit EXIT
1818

19+
running_builds=$(docker ps --filter "Name=$CONTAINER_NAME" --format "{{.ID}}")
20+
if [ -z "$running_builds" ]; then
21+
# The build failed before and it killed the host
22+
# Startup so we can return the license
23+
docker run -dit \
24+
--name "$CONTAINER_NAME" \
25+
--env PROJECT_PATH="C:/unity_project" \
26+
--env UNITY_USERNAME="$unity_username" \
27+
--env UNITY_PASSWORD="$unity_password" \
28+
--volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \
29+
--volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \
30+
--volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio" \
31+
"unityci/editor:windows-${GAMECI_EDITOR_VERSION}-${GAMECI_TARGET_PLATFORM}-2" \
32+
powershell
33+
fi
34+
1935
set -x
2036
# Return license
2137
docker exec "$CONTAINER_NAME" powershell '& "C:\Program Files\Unity\Hub\Editor\*\Editor\Unity.exe" -returnlicense -batchmode -quit -nographics -username $Env:UNITY_USERNAME -password $Env:UNITY_PASSWORD -logfile | Out-Host'

src/scripts/windows/set-gitcredential.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ else
4747
fi
4848

4949
echo "---------- git config --list -------------"
50-
docker exec "$CONTAINER_NAME" "git config --list"
50+
docker exec "$CONTAINER_NAME" "git --no-pager config --list"
5151

5252
echo "---------- git config --list --show-origin -------------"
53-
docker exec "$CONTAINER_NAME" "git config --list --show-origin"
53+
docker exec "$CONTAINER_NAME" "git --no-pager config --list --show-origin"

0 commit comments

Comments
 (0)