From a6504c2c42eeb175a2d0f48937d2fa245be9d1f4 Mon Sep 17 00:00:00 2001 From: Hunter Long Date: Tue, 15 Dec 2020 01:48:19 -0800 Subject: [PATCH] github actions refactor, removed cache API endpoints from postman --- .github/workflows/development.yml | 8 +- .github/workflows/master.yml | 8 +- dev/postman.json | 362 ++++++++++++++++-------------- 3 files changed, 203 insertions(+), 175 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index ecc9844c..2553984c 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -459,8 +459,14 @@ jobs: run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v3 + uses: docker/setup-buildx-action@v1 + id: buildx + with: + install: true - name: Docker Login env: diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 088443da..c7ca3ce4 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -459,8 +459,14 @@ jobs: run: echo "VERSION=$(cat version.txt)" >> $GITHUB_ENV shell: bash + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v3 + uses: docker/setup-buildx-action@v1 + id: buildx + with: + install: true - name: Docker Login env: diff --git a/dev/postman.json b/dev/postman.json index f21fd2b1..4aaf42be 100644 --- a/dev/postman.json +++ b/dev/postman.json @@ -343,6 +343,146 @@ } ] }, + { + "name": "View Configuration", + "event": [ + { + "listen": "test", + "script": { + "id": "557dd7ef-fa5a-4f3d-98b3-4bca5e3ce154", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api/settings/configs", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "settings", + "configs" + ] + }, + "description": "This endpoint will return the config.yml configuration without database credentials." + }, + "response": [ + { + "name": "View Configuration", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{endpoint}}/api/settings/configs", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "settings", + "configs" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "plain", + "header": [ + { + "key": "Date", + "value": "Fri, 18 Sep 2020 03:41:34 GMT" + }, + { + "key": "Content-Length", + "value": "256" + }, + { + "key": "Content-Type", + "value": "text/plain; charset=utf-8" + }, + { + "key": "Connection", + "value": "close" + } + ], + "cookie": [], + "body": "api_secret: demoapisecret123\nlanguage: en\nallow_reports: true\nlocation: /root/go/src/github.com/statping/statping\ndisable_http: false\ndemo_mode: false\ndisable_logs: false\nuse_assets: false\nsample_data: true\nuse_cdn: false\ndisable_colors: false\n" + } + ] + }, + { + "name": "Update Configuration", + "event": [ + { + "listen": "test", + "script": { + "id": "5074172f-5689-4471-aced-50b0a0b6b2b4", + "exec": [ + "pm.test(\"Response is ok\", function () {", + " pm.response.to.have.status(200);", + "});" + ], + "type": "text/javascript" + } + } + ], + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "auth": { + "type": "bearer", + "bearer": [ + { + "key": "token", + "value": "{{api_key}}", + "type": "string" + } + ] + }, + "method": "GET", + "header": [], + "body": { + "mode": "raw", + "raw": "api_secret: demoapisecret123\nlanguage: en\nallow_reports: true\nlocation: /root/go/src/github.com/statping/statping\ndisable_http: false\ndemo_mode: false\ndisable_logs: false\nuse_assets: false\nsample_data: true\nuse_cdn: false\ndisable_colors: false\n", + "options": { + "raw": {} + } + }, + "url": { + "raw": "{{endpoint}}/api/settings/configs", + "host": [ + "{{endpoint}}" + ], + "path": [ + "api", + "settings", + "configs" + ] + }, + "description": "This endpoint will update the config.yml configuration." + }, + "response": [] + }, { "name": "Logs Last Line", "event": [ @@ -567,166 +707,6 @@ } ] }, - { - "name": "Clear Cache", - "event": [ - { - "listen": "test", - "script": { - "id": "dbabc164-5030-441d-90f7-b29c7fe794df", - "exec": [ - "pm.test(\"Response is ok\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{api_key}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{endpoint}}/api/clear_cache", - "host": [ - "{{endpoint}}" - ], - "path": [ - "api", - "clear_cache" - ] - }, - "description": "This endpoint will clear all the cache files in your Statping instance. This includes chart data and service views." - }, - "response": [ - { - "name": "Clear Cache", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{endpoint}}/api/clear_cache", - "host": [ - "{{endpoint}}" - ], - "path": [ - "api", - "clear_cache" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Length", - "value": "21" - }, - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Date", - "value": "Sat, 02 May 2020 01:06:43 GMT" - } - ], - "cookie": [], - "body": "{\n \"status\": \"success\"\n}" - } - ] - }, - { - "name": "List Cache", - "event": [ - { - "listen": "test", - "script": { - "id": "992ce59d-3cce-43f1-9c3d-895c55a3e0a1", - "exec": [ - "pm.test(\"Response is ok\", function () {", - " pm.response.to.have.status(200);", - "});" - ], - "type": "text/javascript" - } - } - ], - "request": { - "auth": { - "type": "bearer", - "bearer": [ - { - "key": "token", - "value": "{{api_key}}", - "type": "string" - } - ] - }, - "method": "GET", - "header": [], - "url": { - "raw": "{{endpoint}}/api/cache", - "host": [ - "{{endpoint}}" - ], - "path": [ - "api", - "cache" - ] - }, - "description": "This endpoint will return all cached API endpoints." - }, - "response": [ - { - "name": "List Cache", - "originalRequest": { - "method": "GET", - "header": [], - "url": { - "raw": "{{endpoint}}/api/cache", - "host": [ - "{{endpoint}}" - ], - "path": [ - "api", - "cache" - ] - } - }, - "status": "OK", - "code": 200, - "_postman_previewlanguage": "json", - "header": [ - { - "key": "Content-Length", - "value": "1631" - }, - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "Date", - "value": "Sat, 02 May 2020 01:06:32 GMT" - } - ], - "cookie": [], - "body": "[\n {\n \"url\": \"/api/services/1/failure_data?start=1585789587&end=1588381587&group=24h&fill=true\",\n \"expiration\": \"2020-05-02T01:06:57.511702322Z\",\n \"size\": 1541\n },\n {\n \"url\": \"/api/services/1/hits_data?start=1588127787&end=1588381587&group=5m&fill=false\",\n \"expiration\": \"2020-05-02T01:06:57.808458203Z\",\n \"size\": 45223\n },\n {\n \"url\": \"/api/services/2/hits_data?start=1588127787&end=1588381587&group=5m&fill=false\",\n \"expiration\": \"2020-05-02T01:06:57.873815975Z\",\n \"size\": 45224\n },\n {\n \"url\": \"/api/services/3/hits_data?start=1588127787&end=1588381587&group=5m&fill=false\",\n \"expiration\": \"2020-05-02T01:06:57.909984136Z\",\n \"size\": 45088\n },\n {\n \"url\": \"/api/services/2/failure_data?start=1585789587&end=1588381587&group=24h&fill=true\",\n \"expiration\": \"2020-05-02T01:06:57.48592429Z\",\n \"size\": 1538\n },\n {\n \"url\": \"/api/services/4/failure_data?start=1585789587&end=1588381587&group=24h&fill=true\",\n \"expiration\": \"2020-05-02T01:06:57.493425593Z\",\n \"size\": 1538\n },\n {\n \"url\": \"/api/services/3/failure_data?start=1585789587&end=1588381587&group=24h&fill=true\",\n \"expiration\": \"2020-05-02T01:06:57.493554858Z\",\n \"size\": 1538\n },\n {\n \"url\": \"/api/services/5/failure_data?start=1585789587&end=1588381587&group=24h&fill=true\",\n \"expiration\": \"2020-05-02T01:06:57.511424891Z\",\n \"size\": 1538\n },\n {\n \"url\": \"/api/services/5/hits_data?start=1588127788&end=1588381588&group=5m&fill=false\",\n \"expiration\": \"2020-05-02T01:06:58.377413844Z\",\n \"size\": 45193\n },\n {\n \"url\": \"/api/services/4/hits_data?start=1588127788&end=1588381588&group=5m&fill=false\",\n \"expiration\": \"2020-05-02T01:06:58.380229692Z\",\n \"size\": 45198\n }\n]" - } - ] - }, { "name": "Shields.io Badge", "event": [ @@ -1801,7 +1781,10 @@ ], "body": { "mode": "raw", - "raw": "{\n \"name\": \"New Service\",\n \"domain\": \"https://statping.com\",\n \"expected\": \"\",\n \"expected_status\": 200,\n \"check_interval\": 30,\n \"type\": \"http\",\n \"method\": \"GET\",\n \"post_data\": \"\",\n \"port\": 0,\n \"timeout\": 30,\n \"order_id\": 0\n}" + "raw": "{\n \"name\": \"New Service\",\n \"domain\": \"https://statping.com\",\n \"expected\": \"\",\n \"expected_status\": 200,\n \"check_interval\": 30,\n \"type\": \"http\",\n \"method\": \"GET\",\n \"post_data\": \"\",\n \"port\": 0,\n \"timeout\": 30,\n \"order_id\": 0\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/services", @@ -2069,7 +2052,10 @@ "header": [], "body": { "mode": "raw", - "raw": "" + "raw": "", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/services/{{service_id}}/failures", @@ -2492,7 +2478,10 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"message\": \"Website is loading very slowly, looking into this.\",\n\t\"type\": \"Investigating\"\n}" + "raw": "{\n\t\"message\": \"Website is loading very slowly, looking into this.\",\n\t\"type\": \"Investigating\"\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/incidents/2/updates", @@ -2654,7 +2643,10 @@ ], "body": { "mode": "raw", - "raw": "{\n\t\"title\": \"Updated Downtime\",\n\t\"description\": \"This is an update for an incident\"\n}" + "raw": "{\n\t\"title\": \"Updated Downtime\",\n\t\"description\": \"This is an update for an incident\"\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/incidents/1", @@ -3105,7 +3097,10 @@ ], "body": { "mode": "raw", - "raw": "{\n \"name\": \"New Group\",\n \"public\": true\n}" + "raw": "{\n \"name\": \"New Group\",\n \"public\": true\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/groups", @@ -3261,7 +3256,10 @@ "header": [], "body": { "mode": "raw", - "raw": "" + "raw": "", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/groups/{{group_id}}", @@ -3541,7 +3539,10 @@ "value": "{{token}}", "type": "text" } - ] + ], + "options": { + "urlencoded": {} + } }, "url": { "raw": "{{endpoint}}/api/users/token", @@ -3787,7 +3788,10 @@ ], "body": { "mode": "raw", - "raw": "{\n \"username\": \"adminuser2\",\n \"email\": \"info@adminemail.com\",\n \"password\": \"passsword123\",\n \"admin\": true\n}" + "raw": "{\n \"username\": \"adminuser2\",\n \"email\": \"info@adminemail.com\",\n \"password\": \"passsword123\",\n \"admin\": true\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/users", @@ -3990,7 +3994,10 @@ ], "body": { "mode": "raw", - "raw": "{\n \"username\": \"adminupdated\",\n \"email\": \"info@email.com\",\n \"password\": \"password12345\",\n \"admin\": true\n}" + "raw": "{\n \"username\": \"adminupdated\",\n \"email\": \"info@email.com\",\n \"password\": \"password12345\",\n \"admin\": true\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/users/{{user_id}}", @@ -4514,7 +4521,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"method\": \"success\",\n \"notifier\": {\n \"enabled\": false,\n \"limits\": 60,\n \"method\": \"slack\",\n \"host\": \"https://webhooksurl.slack.com/***\",\n \"success_data\": \"{\\n \\\"blocks\\\": [{\\n \\\"type\\\": \\\"section\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"The service {{.Service.Name}} is back online.\\\"\\n }\\n }, {\\n \\\"type\\\": \\\"actions\\\",\\n \\\"elements\\\": [{\\n \\\"type\\\": \\\"button\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"View Service\\\",\\n \\\"emoji\\\": true\\n },\\n \\\"style\\\": \\\"primary\\\",\\n \\\"url\\\": \\\"{{.Core.Domain}}/service/{{.Service.Id}}\\\"\\n }, {\\n \\\"type\\\": \\\"button\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"Go to Statping\\\",\\n \\\"emoji\\\": true\\n },\\n \\\"url\\\": \\\"{{.Core.Domain}}\\\"\\n }]\\n }]\\n}\",\n \"failure_data\": \"{\\n \\\"blocks\\\": [{\\n \\\"type\\\": \\\"section\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\":warning: The service {{.Service.Name}} is currently offline! :warning:\\\"\\n }\\n }, {\\n \\\"type\\\": \\\"divider\\\"\\n }, {\\n \\\"type\\\": \\\"section\\\",\\n \\\"fields\\\": [{\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*Service:*\\\\n{{.Service.Name}}\\\"\\n }, {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*URL:*\\\\n{{.Service.Domain}}\\\"\\n }, {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*Status Code:*\\\\n{{.Service.LastStatusCode}}\\\"\\n }, {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*When:*\\\\n{{.Failure.CreatedAt}}\\\"\\n }, {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*Downtime:*\\\\n{{.Service.Downtime.Human}}\\\"\\n }, {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"*Error:*\\\\n{{.Failure.Issue}}\\\"\\n }]\\n }, {\\n \\\"type\\\": \\\"divider\\\"\\n }, {\\n \\\"type\\\": \\\"actions\\\",\\n \\\"elements\\\": [{\\n \\\"type\\\": \\\"button\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"View Offline Service\\\",\\n \\\"emoji\\\": true\\n },\\n \\\"style\\\": \\\"danger\\\",\\n \\\"url\\\": \\\"{{.Core.Domain}}/service/{{.Service.Id}}\\\"\\n }, {\\n \\\"type\\\": \\\"button\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"Go to Statping\\\",\\n \\\"emoji\\\": true\\n },\\n \\\"url\\\": \\\"{{.Core.Domain}}\\\"\\n }]\\n }]\\n}\"\n }\n}", + "raw": "{\n \"method\": \"success\",\n \"notifier\": {\n \"enabled\": false,\n \"limits\": 60,\n \"method\": \"slack\",\n \"host\": \"https://hooks.slack.com/services/TTJ1B49DP/XBNU09O9M/9uI2123SUnYBuGcxLopZomz9H\",\n \"success_data\": \"{\\n \\\"blocks\\\": [{\\n \\\"type\\\": \\\"section\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"The service {{.Service.Name}} is back online.\\\"\\n }\\n }, {\\n \\\"type\\\": \\\"actions\\\",\\n \\\"elements\\\": [{\\n \\\"type\\\": \\\"button\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"View Service\\\",\\n \\\"emoji\\\": true\\n },\\n \\\"style\\\": \\\"primary\\\",\\n \\\"url\\\": \\\"{{.Core.Domain}}/service/{{.Service.Id}}\\\"\\n }, {\\n \\\"type\\\": \\\"button\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"Go to Statping\\\",\\n \\\"emoji\\\": true\\n },\\n \\\"url\\\": \\\"{{.Core.Domain}}\\\"\\n }]\\n }]\\n}\",\n \"failure_data\": \"{\\n \\\"blocks\\\": [{\\n \\\"type\\\": \\\"section\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\":warning: The service {{.Service.Name}} is currently offline! :warning:\\\"\\n }\\n }, {\\n \\\"type\\\": \\\"divider\\\"\\n }, {\\n \\\"type\\\": \\\"section\\\",\\n \\\"fields\\\": [{\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*Service:*\\\\n{{.Service.Name}}\\\"\\n }, {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*URL:*\\\\n{{.Service.Domain}}\\\"\\n }, {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*Status Code:*\\\\n{{.Service.LastStatusCode}}\\\"\\n }, {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*When:*\\\\n{{.Failure.CreatedAt}}\\\"\\n }, {\\n \\\"type\\\": \\\"mrkdwn\\\",\\n \\\"text\\\": \\\"*Downtime:*\\\\n{{.Service.Downtime.Human}}\\\"\\n }, {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"*Error:*\\\\n{{.Failure.Issue}}\\\"\\n }]\\n }, {\\n \\\"type\\\": \\\"divider\\\"\\n }, {\\n \\\"type\\\": \\\"actions\\\",\\n \\\"elements\\\": [{\\n \\\"type\\\": \\\"button\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"View Offline Service\\\",\\n \\\"emoji\\\": true\\n },\\n \\\"style\\\": \\\"danger\\\",\\n \\\"url\\\": \\\"{{.Core.Domain}}/service/{{.Service.Id}}\\\"\\n }, {\\n \\\"type\\\": \\\"button\\\",\\n \\\"text\\\": {\\n \\\"type\\\": \\\"plain_text\\\",\\n \\\"text\\\": \\\"Go to Statping\\\",\\n \\\"emoji\\\": true\\n },\\n \\\"url\\\": \\\"{{.Core.Domain}}\\\"\\n }]\\n }]\\n}\"\n }\n}", "options": { "raw": {} } @@ -4798,7 +4805,10 @@ ], "body": { "mode": "raw", - "raw": "{\n \"title\": \"API Message\",\n \"description\": \"This is an example a upcoming message for a service!\",\n \"start_on\": \"2022-11-17T03:28:16.323797-08:00\",\n \"end_on\": \"2022-11-17T05:13:16.323798-08:00\",\n \"service\": 1,\n \"notify_users\": true,\n \"notify_method\": \"email\",\n \"notify_before\": 6,\n \"notify_before_scale\": \"hour\"\n}" + "raw": "{\n \"title\": \"API Message\",\n \"description\": \"This is an example a upcoming message for a service!\",\n \"start_on\": \"2022-11-17T03:28:16.323797-08:00\",\n \"end_on\": \"2022-11-17T05:13:16.323798-08:00\",\n \"service\": 1,\n \"notify_users\": true,\n \"notify_method\": \"email\",\n \"notify_before\": 6,\n \"notify_before_scale\": \"hour\"\n}", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/messages", @@ -5077,7 +5087,10 @@ "header": [], "body": { "mode": "raw", - "raw": "" + "raw": "", + "options": { + "raw": {} + } }, "url": { "raw": "{{endpoint}}/api/messages/{{message_id}}", @@ -6114,7 +6127,10 @@ "value": "0", "type": "text" } - ] + ], + "options": { + "formdata": {} + } }, "url": { "raw": "{{endpoint}}/oauth/slack",