File tree Expand file tree Collapse file tree 3 files changed +64
-3
lines changed
Expand file tree Collapse file tree 3 files changed +64
-3
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ master ]
6+ pull_request :
7+ branches : [ master ]
8+
9+ workflow_dispatch :
10+
11+ jobs :
12+ test-python38 :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v2
16+ - name : " Install s2i"
17+ run : |
18+ wget -c https://github.com/openshift/source-to-image/releases/download/v1.3.0/source-to-image-v1.3.0-eed2850f-linux-amd64.tar.gz -O - | tar -xz
19+ sudo cp s2i /usr/local/bin
20+ - name : Run the test script
21+ run : make test -C python38-slim/
Original file line number Diff line number Diff line change 1+ name : Release docker image
2+
3+ on :
4+ release :
5+ types : [published]
6+
7+ jobs :
8+
9+ build :
10+ name : Build and run daeploy Manager
11+ runs-on : ubuntu-latest
12+ steps :
13+ - name : Checkout code
14+ uses : actions/checkout@v2
15+
16+ - name : Login to DockerHub
17+ uses : docker/login-action@v1
18+ with :
19+ username : ${{ secrets.DAEPLOY_DOCKER_USERNAME }}
20+ password : ${{ secrets.DAEPLOY_DOCKER_PASSWORD }}
21+
22+ - name : Docker build and push
23+ run : |
24+ docker build -t daeploy/s2i-python:3.8-slim-${{ github.event.release.tag_name }} -t daeploy/s2i-python:latest ./python38-slim
25+ docker push --all-tags daeploy/s2i-python
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ cid_file=$($MKTEMP_EXEC -u)
3232s2i_args=" --pull-policy=never --loglevel=2"
3333
3434# Port the image exposes service to be tested
35- test_port=8080
35+ test_port=8000
3636
3737image_exists () {
3838 docker inspect $1 & > /dev/null
@@ -110,15 +110,29 @@ test_usage() {
110110 s2i usage ${s2i_args} ${IMAGE_NAME} & > /dev/null
111111}
112112
113+ http_call () {
114+ local url=" $1 "
115+ curl -X ' POST' \
116+ " $url " \
117+ -w %{http_code} \
118+ -s \
119+ -o /dev/null \
120+ -H ' accept: application/json' \
121+ -H ' Content-Type: application/json' \
122+ -d ' {
123+ "name": "Snorre Sturlasson"
124+ }'
125+ }
126+
113127test_connection () {
114128 echo " Testing HTTP connection (http://$( container_ip) :$( container_port) )"
115129 local max_attempts=10
116130 local sleep_time=1
117131 local attempt=1
118132 local result=1
119133 while [ $attempt -le $max_attempts ]; do
120- echo " Sending GET request to http://$( container_ip) :$( container_port) /"
121- response_code=$( curl -s -w %{http_code} -o /dev/null http://$( container_ip) :$( container_port) /)
134+ echo " Sending POST request http://$( container_ip) :$( container_port) /hello "
135+ response_code=$( http_call http://$( container_ip) :$( container_port) /hello )
122136 status=$?
123137 if [ $status -eq 0 ]; then
124138 if [ $response_code -eq 200 ]; then
@@ -152,3 +166,4 @@ test_connection
152166check_result $?
153167
154168cleanup
169+ echo " Test successful"
You can’t perform that action at this time.
0 commit comments