Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
executable file
·
67 lines (57 loc) · 2.12 KB

File metadata and controls

executable file
·
67 lines (57 loc) · 2.12 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
# This script builds the Docker image tagged cli:test and cli:$CLI_VERSION-test and pushes them to docker hub
# If CLI Version and/or SDK Version are not provided, it will check TestPyPI for the latest dev versions and use that after asking the user for confirmation
CLI_VERSION=$1
SDK_VERSION=$2
get_latest_version() {
package=$1
curl -s https://test.pypi.org/pypi/$package/json | python -c "
import sys, json
data = json.load(sys.stdin)
versions = list(data.get('releases', {}).keys())
versions.sort(key=lambda x: (
x.split('.dev')[0],
int(x.split('.dev')[1]) if '.dev' in x else 0
))
print(versions[-1] if versions else '')
"
}
if [ -z "$CLI_VERSION" ]; then
echo "No CLI version specified, checking TestPyPI for latest version..."
CLI_VERSION=$(get_latest_version "socketsecurity")
echo "Latest CLI version on TestPyPI is: $CLI_VERSION"
fi
if [ -z "$SDK_VERSION" ]; then
echo "No SDK version specified, checking TestPyPI for latest version..."
SDK_VERSION=$(get_latest_version "socketdev")
echo "Latest SDK version on TestPyPI is: $SDK_VERSION"
fi
echo -n "Deploy with CLI=$CLI_VERSION and SDK=$SDK_VERSION? (y/n): "
read answer
case $answer in
[Yy]* ) ;;
* ) echo "Aborted."; exit;;
esac
echo "Building and pushing Docker image..."
docker build --no-cache \
--build-arg CLI_VERSION=$CLI_VERSION \
--build-arg SDK_VERSION=$SDK_VERSION \
--build-arg PIP_INDEX_URL=https://test.pypi.org/simple \
--build-arg PIP_EXTRA_INDEX_URL=https://pypi.org/simple \
--platform linux/amd64,linux/arm64 \
-t socketdev/cli:$CLI_VERSION-test . \
&& docker build --no-cache \
--build-arg CLI_VERSION=$CLI_VERSION \
--build-arg SDK_VERSION=$SDK_VERSION \
--build-arg PIP_INDEX_URL=https://test.pypi.org/simple \
--build-arg PIP_EXTRA_INDEX_URL=https://pypi.org/simple \
--platform linux/amd64,linux/arm64 \
-t socketdev/cli:test . \
&& docker push socketdev/cli:$CLI_VERSION-test \
&& docker push socketdev/cli:test
if [ $? -eq 0 ]; then
echo "Successfully deployed version $CLI_VERSION"
else
echo "Failed to deploy version $CLI_VERSION"
exit 1
fi
Morty Proxy This is a proxified and sanitized view of the page, visit original site.