Fix job for cleaning envs (#3958)
This commit is contained in:
parent
ce1854b2ca
commit
153ea5b77b
1 changed files with 5 additions and 3 deletions
8
.github/workflows/cleanEnvironments.js
vendored
8
.github/workflows/cleanEnvironments.js
vendored
|
@ -3,6 +3,8 @@ const fetch = require("node-fetch");
|
||||||
|
|
||||||
const program = new Command();
|
const program = new Command();
|
||||||
|
|
||||||
|
const pathToCloudAPI = "https://staging-cloud.saleor.io/platform/api/";
|
||||||
|
|
||||||
program
|
program
|
||||||
.name("cleanEnvironments")
|
.name("cleanEnvironments")
|
||||||
.description("Clean environments")
|
.description("Clean environments")
|
||||||
|
@ -31,7 +33,7 @@ async function getEnvironmentsForReleaseTesting(token) {
|
||||||
|
|
||||||
async function getEnvironments(token) {
|
async function getEnvironments(token) {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://staging-cloud.saleor.io/api/organizations/saleor/environments/`,
|
`${pathToCloudAPI}organizations/saleor/environments/`,
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -46,7 +48,7 @@ async function getEnvironments(token) {
|
||||||
|
|
||||||
async function cleanEnvironment(environment, snapshot, token) {
|
async function cleanEnvironment(environment, snapshot, token) {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://staging-cloud.saleor.io/api/organizations/saleor/environments/${environment.key}/restore/`,
|
`${pathToCloudAPI}organizations/saleor/environments/${environment.key}/restore/`,
|
||||||
{
|
{
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
body: JSON.stringify({ restore_from: snapshot }),
|
body: JSON.stringify({ restore_from: snapshot }),
|
||||||
|
@ -82,7 +84,7 @@ async function waitUntilTaskInProgress(taskId, environment) {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const response = await fetch(
|
const response = await fetch(
|
||||||
`https://staging-cloud.saleor.io/api/service/task-status/${taskId}/`,
|
`${pathToCloudAPI}service/task-status/${taskId}/`,
|
||||||
{
|
{
|
||||||
method: "GET",
|
method: "GET",
|
||||||
headers: {
|
headers: {
|
||||||
|
|
Loading…
Reference in a new issue