-
Notifications
You must be signed in to change notification settings - Fork 0
/
local_tests.sh
executable file
·196 lines (134 loc) · 3.51 KB
/
local_tests.sh
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#!/bin/bash
# Copyright (c) Outscale SAS
#
# SPDX-License-Identifier: BSD-3-Clause
export OSC_PASSWORD='ashita wa dochida'
export OSC_LOGIN=joe
export OMI_ID="ami-90067666"
export OSC_SECRET_KEY=0000001111112222223333334444445555555666
export OSC_ACCESS_KEY=11112211111110000000
export OSC_USING_RICOCHET="oui"
export ROOT=$PWD
function pulumi_up_dowm() {
set -eE
trap "echo [$MSG_BASE $1 pulumi up FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi up --yes
echo "[$MSG_BASE $1 pulumi up OK]"
trap "echo [$MSG_BASE python $1 down FAIL]" ERR
PATH=$PATH:$GOPATH/bin pulumi down --yes
echo "[$MSG_BASE $1 pulumi down OK]"
set -e
}
function pulumi_setup_local() {
echo "pulumi set all stuffs"
pulumi config set outscale:secretKeyId $OSC_SECRET_KEY
pulumi config set outscale:accessKeyId $OSC_ACCESS_KEY
pulumi config set outscale:region "eu-west-2"
pulumi config set outscale:insecure true
pulumi config set outscale:endpoints '[{"api": "127.0.0.1:3000"}]'
}
if [ "$#" -eq 0 ]; then
if [ ! -d "osc-ricochet-2" ]; then
git clone https://github.com/outscale/osc-ricochet-2
fi
cd osc-ricochet-2
pkill ricochet
cargo build --profile 'sdks'
./mk_cert.sh
cargo run --profile 'sdks' -- ./ricochet-ssl.json &> /dev/null &
cd ..
sleep 5
fi
set -e
export GOPATH=$PWD
if [ "$#" -eq 0 ]; then
export PATH=$PATH:$HOME/.pulumi/bin
fi
# a strong password is important
export PULUMI_CONFIG_PASSPHRASE=wololo
MSG_BASE="Test"
PULUMICTL_VERSION=v0.0.32
if [ "$#" -eq 0 ]; then
cd $HOME/.pulumi/bin
wget https://github.com/pulumi/pulumictl/releases/download/$PULUMICTL_VERSION/pulumictl-${PULUMICTL_VERSION}-linux-amd64.tar.gz
tar -xvf pulumictl-${PULUMICTL_VERSION}-linux-amd64.tar.gz
cd -
fi
echo "BUILD provider and build_python"
make provider build_python build_nodejs build_dotnet
echo "pulumi login --local"
pulumi login --local
echo "cd examples/yaml"
cd examples/yaml
set +e
echo "pulumi stack init staging"
pulumi stack init staging
pulumi stack select staging
set -e
pulumi_setup_local
pulumi_up_dowm "yaml"
echo "../dotnet/"
cd ../dotnet/
cd user/
# without that I have dependencies errors.
rm -rvf ~/.nuget
set +e
echo "pulumi stack init staging"
pulumi stack init staging
pulumi stack select staging
set -e
dotnet nuget add source $ROOT/sdk/dotnet/bin/Debug/
pulumi_setup_local
pulumi_up_dowm "dotnet"
cd .. # user dotnet out
echo "../python/"
cd ../python/
# because I use outscale-pulumi as go path, I can use it here too
cd user/
python -m venv venv
source venv/bin/activate
pip install setuptools
pip install pulumi_cloudinit
pip install $GOPATH/sdk/python/
set +e
echo "pulumi stack init staging"
pulumi stack init staging
pulumi stack select staging
set -e
pulumi_setup_local
pip freeze
pulumi_up_dowm "python user"
deactivate
cd ../hello/
python -m venv venv
source venv/bin/activate
pip install setuptools
pip install pulumi_cloudinit
pip install $GOPATH/sdk/python/
set +e
echo "pulumi stack init staging"
pulumi stack init staging
pulumi stack select staging
set -e
pulumi_setup_local
pip freeze
pulumi_up_dowm "python hello"
echo "../../ts/user/"
cd ../../ts/user/
set +e
echo "pulumi stack init staging"
pulumi stack init staging
pulumi stack select staging
set -e
npm install $GOPATH/sdk/nodejs/bin
pulumi_setup_local
pulumi_up_dowm "ty/js user"
echo "../../go/vm/"
cd ../../go/vm/
set +e
echo "pulumi stack init staging"
pulumi stack init staging
pulumi stack select staging
set -e
pulumi_setup_local
pulumi_up_dowm "go/vm"