Added global headers, queries and more control app creator
This commit is contained in:
@@ -3,8 +3,7 @@ import { makeStyles } from '@material-ui/styles';
|
|||||||
import {BrowserView, MobileView} from "react-device-detect";
|
import {BrowserView, MobileView} from "react-device-detect";
|
||||||
|
|
||||||
import {Paper, Typography, FormControlLabel, Button, Divider, Select, MenuItem, FormControl, Switch, Dialog, DialogTitle, DialogContent, DialogActions, TextField, Tooltip, Breadcrumbs, CircularProgress, Chip} from '@material-ui/core';
|
import {Paper, Typography, FormControlLabel, Button, Divider, Select, MenuItem, FormControl, Switch, Dialog, DialogTitle, DialogContent, DialogActions, TextField, Tooltip, Breadcrumbs, CircularProgress, Chip} from '@material-ui/core';
|
||||||
import {Add as AddIcon, CheckCircle as CheckCircleIcon, AttachFile as AttachFileIcon, Apps as AppsIcon, ErrorOutline as ErrorOutlineIcon} from '@material-ui/icons';
|
import {FileCopy as FileCopyIcon, Delete as DeleteIcon, Remove as RemoveIcon, Add as AddIcon, CheckCircle as CheckCircleIcon, AttachFile as AttachFileIcon, Apps as AppsIcon, ErrorOutline as ErrorOutlineIcon} from '@material-ui/icons';
|
||||||
|
|
||||||
|
|
||||||
import {Link} from 'react-router-dom';
|
import {Link} from 'react-router-dom';
|
||||||
import YAML from 'yaml'
|
import YAML from 'yaml'
|
||||||
@@ -198,7 +197,8 @@ const AppCreator = (props) => {
|
|||||||
const increaseAmount = 50
|
const increaseAmount = 50
|
||||||
const actionNonBodyRequest = ["GET", "HEAD", "DELETE", "CONNECT"]
|
const actionNonBodyRequest = ["GET", "HEAD", "DELETE", "CONNECT"]
|
||||||
const actionBodyRequest = ["POST", "PUT", "PATCH",]
|
const actionBodyRequest = ["POST", "PUT", "PATCH",]
|
||||||
const authenticationOptions = ["No authentication", "API key", "Bearer auth", "Basic auth", ]
|
//const authenticationOptions = ["No authentication", "API key", "Bearer auth", "Basic auth", "Oauth2"]
|
||||||
|
const authenticationOptions = ["No authentication", "API key", "Bearer auth", "Basic auth"]
|
||||||
const apikeySelection = ["Header", "Query",]
|
const apikeySelection = ["Header", "Query",]
|
||||||
|
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
@@ -233,9 +233,9 @@ const AppCreator = (props) => {
|
|||||||
const defaultAuth = {
|
const defaultAuth = {
|
||||||
"name": "",
|
"name": "",
|
||||||
"type": "header",
|
"type": "header",
|
||||||
"example": "hello",
|
"example": "",
|
||||||
}
|
}
|
||||||
const [extraAuth, setExtraAuth] = useState([defaultAuth])
|
const [extraAuth, setExtraAuth] = useState([])
|
||||||
|
|
||||||
//const [actions, setActions] = useState([{
|
//const [actions, setActions] = useState([{
|
||||||
// "name": "Get workflows",
|
// "name": "Get workflows",
|
||||||
@@ -898,6 +898,10 @@ const AppCreator = (props) => {
|
|||||||
setAuthenticationOption("Basic auth")
|
setAuthenticationOption("Basic auth")
|
||||||
setAuthenticationRequired(true)
|
setAuthenticationRequired(true)
|
||||||
break
|
break
|
||||||
|
} else if (value.scheme === "oauth2") {
|
||||||
|
setAuthenticationOption("Oauth2")
|
||||||
|
setAuthenticationRequired(true)
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1256,6 +1260,26 @@ const AppCreator = (props) => {
|
|||||||
"type": "http",
|
"type": "http",
|
||||||
"scheme": "basic",
|
"scheme": "basic",
|
||||||
}
|
}
|
||||||
|
} else if (authenticationOption === "Oauth2") {
|
||||||
|
data.components.securitySchemes["Oauth2"] = {
|
||||||
|
"type": "oauth2",
|
||||||
|
"flow": {
|
||||||
|
"authorizationCode": {
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setExtraAuth.length > 0) {
|
||||||
|
for (var key in extraAuth) {
|
||||||
|
const curauth = extraAuth[key]
|
||||||
|
data.components.securitySchemes[curauth.name] = {
|
||||||
|
"type": "apiKey",
|
||||||
|
"in": curauth.type,
|
||||||
|
"name": curauth.name,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(globalUrl+"/api/v1/verify_openapi", {
|
fetch(globalUrl+"/api/v1/verify_openapi", {
|
||||||
@@ -1420,13 +1444,24 @@ const AppCreator = (props) => {
|
|||||||
//console.log("Location: ", parameterLocation)
|
//console.log("Location: ", parameterLocation)
|
||||||
//console.log("Name: ", parameterName)
|
//console.log("Name: ", parameterName)
|
||||||
const extraKeys =
|
const extraKeys =
|
||||||
<div style={{marginTop: 25}}>
|
<div style={{marginTop: 50}}>
|
||||||
|
<Typography variant="body1">Extra headers or queries</Typography>
|
||||||
|
{extraAuth.length === 0 ?
|
||||||
|
<Button color="primary" style={{maxWidth: 50, }} variant="contained" onClick={() => {
|
||||||
|
console.log("ADD NEW!")
|
||||||
|
extraAuth.push(defaultAuth)
|
||||||
|
setExtraAuth(extraAuth)
|
||||||
|
setUpdate(Math.random())
|
||||||
|
}}>
|
||||||
|
<AddIcon style={{}}/>
|
||||||
|
</Button>
|
||||||
|
: <span style={{width: 50, }}/>}
|
||||||
{extraAuth.map((value, index) => {
|
{extraAuth.map((value, index) => {
|
||||||
return (
|
return (
|
||||||
<span style={{display: "flex"}}>
|
<span style={{display: "flex", height: 50, marginTop: 5, }}>
|
||||||
<TextField
|
<TextField
|
||||||
required
|
required
|
||||||
style={{height: 50, flex: 2, backgroundColor: inputColor, marginRight: 5, }}
|
style={{height: 50, flex: 2, marginTop: 0, marginBottom: 0, backgroundColor: inputColor, marginRight: 5, }}
|
||||||
fullWidth={true}
|
fullWidth={true}
|
||||||
placeholder="Name"
|
placeholder="Name"
|
||||||
id="standard-required"
|
id="standard-required"
|
||||||
@@ -1438,9 +1473,9 @@ const AppCreator = (props) => {
|
|||||||
setExtraAuth(extraAuth)
|
setExtraAuth(extraAuth)
|
||||||
}}
|
}}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
//classes: {
|
classes: {
|
||||||
// notchedOutline: classes.notchedOutline,
|
notchedOutline: classes.notchedOutline,
|
||||||
//},
|
},
|
||||||
style:{
|
style:{
|
||||||
color: "white",
|
color: "white",
|
||||||
minHeight: 50,
|
minHeight: 50,
|
||||||
@@ -1452,9 +1487,9 @@ const AppCreator = (props) => {
|
|||||||
/>
|
/>
|
||||||
<TextField
|
<TextField
|
||||||
required
|
required
|
||||||
style={{height: 50, flex: 2, backgroundColor: inputColor, marginRight: 5,}}
|
style={{height: 50, marginTop: 0, marginBottom: 0, flex: 2, backgroundColor: inputColor, marginRight: 5,}}
|
||||||
fullWidth={true}
|
fullWidth={true}
|
||||||
placeholder="Field Name (not token)"
|
placeholder="Example - input an example for the user"
|
||||||
type="name"
|
type="name"
|
||||||
id="standard-required"
|
id="standard-required"
|
||||||
margin="normal"
|
margin="normal"
|
||||||
@@ -1477,9 +1512,8 @@ const AppCreator = (props) => {
|
|||||||
<Select
|
<Select
|
||||||
fullWidth
|
fullWidth
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
//console.log(e.target.value)
|
|
||||||
//setParameterLocation(e.target.value)
|
|
||||||
extraAuth[index].type = e.target.value
|
extraAuth[index].type = e.target.value
|
||||||
|
setUpdate(Math.random())
|
||||||
setExtraAuth(extraAuth)
|
setExtraAuth(extraAuth)
|
||||||
}}
|
}}
|
||||||
value={extraAuth[index].type}
|
value={extraAuth[index].type}
|
||||||
@@ -1496,21 +1530,39 @@ const AppCreator = (props) => {
|
|||||||
Query
|
Query
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Select>
|
</Select>
|
||||||
{index === extraAuth.length-1 ?
|
<div style={{display: "flex", width: 100, }}>
|
||||||
<Button color="primary" style={{maxWidth: 50, }} variant="contained" onClick={() => {
|
{index === extraAuth.length-1 ?
|
||||||
console.log("ADD NEW!")
|
<Button color="primary" style={{}} variant="outlined" onClick={() => {
|
||||||
extraAuth.push(defaultAuth)
|
extraAuth.push(defaultAuth)
|
||||||
setExtraAuth(extraAuth)
|
setExtraAuth(extraAuth)
|
||||||
setUpdate(Math.random())
|
setUpdate(Math.random())
|
||||||
}}>
|
}}>
|
||||||
<AddIcon style={{}}/>
|
<AddIcon style={{}}/>
|
||||||
</Button>
|
</Button>
|
||||||
: <span style={{width: 50, }}/>}
|
: <span style={{}}/>}
|
||||||
|
<Button color="primary" style={{}} variant="outlined" onClick={() => {
|
||||||
|
const tmpAuth = extraAuth.filter(item => item.type === value.type && item.name !== value.name)
|
||||||
|
setExtraAuth(tmpAuth)
|
||||||
|
console.log(tmpAuth)
|
||||||
|
setUpdate(Math.random())
|
||||||
|
}}>
|
||||||
|
<RemoveIcon style={{}}/>
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
const oauth2Auth = authenticationOption === "Oauth2" ?
|
||||||
|
<div style={{color: "white", marginTop: 20, }}>
|
||||||
|
<Typography variant="body1">Oauth2 authentication</Typography>
|
||||||
|
<Typography variant="body2" color="textSecondary">
|
||||||
|
Add the URL to redirect to
|
||||||
|
</Typography>
|
||||||
|
</div>
|
||||||
|
: null
|
||||||
|
|
||||||
const apiKey = authenticationOption === "API key" ?
|
const apiKey = authenticationOption === "API key" ?
|
||||||
<div style={{color: "white", marginTop: 20, }}>
|
<div style={{color: "white", marginTop: 20, }}>
|
||||||
<Typography variant="body1">API key authentication</Typography>
|
<Typography variant="body1">API key authentication</Typography>
|
||||||
@@ -1682,12 +1734,12 @@ const AppCreator = (props) => {
|
|||||||
<div style={{color: "#f85a3e", cursor: "pointer", marginRight: 15, }} onClick={() => {
|
<div style={{color: "#f85a3e", cursor: "pointer", marginRight: 15, }} onClick={() => {
|
||||||
duplicateAction(index)
|
duplicateAction(index)
|
||||||
}}>
|
}}>
|
||||||
Duplicate
|
<FileCopyIcon color="secondary"/>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title="Delete action" placement="bottom" style={{minWidth: 60}} >
|
<Tooltip title="Delete action" placement="bottom" style={{minWidth: 60}} >
|
||||||
<div style={{color: "#f85a3e", cursor: "pointer"}} onClick={() => {deleteAction(index)}}>
|
<div style={{color: "#f85a3e", cursor: "pointer"}} onClick={() => {deleteAction(index)}}>
|
||||||
Delete
|
<DeleteIcon color="secondary"/>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Paper>
|
</Paper>
|
||||||
@@ -1777,9 +1829,6 @@ const AppCreator = (props) => {
|
|||||||
</span>}
|
</span>}
|
||||||
key={currentAction}
|
key={currentAction}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
classes: {
|
|
||||||
notchedOutline: classes.notchedOutline,
|
|
||||||
},
|
|
||||||
style:{
|
style:{
|
||||||
color: "white",
|
color: "white",
|
||||||
},
|
},
|
||||||
@@ -2015,9 +2064,6 @@ const AppCreator = (props) => {
|
|||||||
defaultValue={currentAction["description"]}
|
defaultValue={currentAction["description"]}
|
||||||
onChange={e => setActionField("description", e.target.value)}
|
onChange={e => setActionField("description", e.target.value)}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
classes: {
|
|
||||||
notchedOutline: classes.notchedOutline,
|
|
||||||
},
|
|
||||||
style:{
|
style:{
|
||||||
color: "white",
|
color: "white",
|
||||||
},
|
},
|
||||||
@@ -2220,9 +2266,6 @@ const AppCreator = (props) => {
|
|||||||
onChange={e => setActionField("headers", e.target.value)}
|
onChange={e => setActionField("headers", e.target.value)}
|
||||||
helperText={<span style={{color:"white", marginBottom: "2px",}}>Headers that are part of the request. Default: EMPTY</span>}
|
helperText={<span style={{color:"white", marginBottom: "2px",}}>Headers that are part of the request. Default: EMPTY</span>}
|
||||||
InputProps={{
|
InputProps={{
|
||||||
classes: {
|
|
||||||
notchedOutline: classes.notchedOutline,
|
|
||||||
},
|
|
||||||
style:{
|
style:{
|
||||||
color: "white",
|
color: "white",
|
||||||
},
|
},
|
||||||
@@ -2726,6 +2769,7 @@ const AppCreator = (props) => {
|
|||||||
{basicAuth}
|
{basicAuth}
|
||||||
{bearerAuth}
|
{bearerAuth}
|
||||||
{apiKey}
|
{apiKey}
|
||||||
|
{oauth2Auth}
|
||||||
{extraKeys}
|
{extraKeys}
|
||||||
|
|
||||||
{/*authenticationOption === "No authentication" ? null :
|
{/*authenticationOption === "No authentication" ? null :
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
NAME=shuffle-worker
|
NAME=shuffle-worker
|
||||||
VERSION=0.8.90
|
VERSION=0.8.92
|
||||||
|
|
||||||
echo "Running docker build with $NAME:$VERSION"
|
echo "Running docker build with $NAME:$VERSION"
|
||||||
#CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin .
|
#CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin .
|
||||||
|
|||||||
@@ -974,31 +974,31 @@ func handleExecutionResult(workflowExecution shuffle.WorkflowExecution) {
|
|||||||
err = deployApp(dockercli, images[0], identifier, env, workflowExecution)
|
err = deployApp(dockercli, images[0], identifier, env, workflowExecution)
|
||||||
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
||||||
if strings.Contains(err.Error(), "exited prematurely") {
|
if strings.Contains(err.Error(), "exited prematurely") {
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
image = images[2]
|
image = images[2]
|
||||||
err = deployApp(dockercli, image, identifier, env, workflowExecution)
|
err = deployApp(dockercli, image, identifier, env, workflowExecution)
|
||||||
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
||||||
if strings.Contains(err.Error(), "exited prematurely") {
|
if strings.Contains(err.Error(), "exited prematurely") {
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
log.Printf("[WARNING] Failed CLEANUP execution. Downloading image remotely.")
|
log.Printf("[WARNING] Failed CLEANUP execution. Downloading image remotely.")
|
||||||
reader, err := dockercli.ImagePull(context.Background(), image, pullOptions)
|
reader, err := dockercli.ImagePull(context.Background(), image, pullOptions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed getting %s. Couldn't be find locally, AND is missing.", image)
|
log.Printf("[ERROR] Failed getting %s. Couldn't be find locally, AND is missing.", image)
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildBuf := new(strings.Builder)
|
buildBuf := new(strings.Builder)
|
||||||
_, err = io.Copy(buildBuf, reader)
|
_, err = io.Copy(buildBuf, reader)
|
||||||
if err != nil && !strings.Contains(fmt.Sprintf("Docker error: %s", err.Error()), "Conflict. The container name") {
|
if err != nil && !strings.Contains(fmt.Sprintf("%s", err.Error()), "Conflict. The container name") {
|
||||||
log.Printf("[ERROR] Error in IO copy: %s", err)
|
log.Printf("[ERROR] Error in IO copy: %s", err)
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
} else {
|
} else {
|
||||||
if strings.Contains(buildBuf.String(), "errorDetail") {
|
if strings.Contains(buildBuf.String(), "errorDetail") {
|
||||||
log.Printf("[ERROR] Docker build:\n%s\nERROR ABOVE: Trying to pull tags from: %s", buildBuf.String(), image)
|
log.Printf("[ERROR] Docker build:\n%s\nERROR ABOVE: Trying to pull tags from: %s", buildBuf.String(), image)
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("[INFO] Successfully downloaded %s", image)
|
log.Printf("[INFO] Successfully downloaded %s", image)
|
||||||
@@ -1009,13 +1009,13 @@ func handleExecutionResult(workflowExecution shuffle.WorkflowExecution) {
|
|||||||
|
|
||||||
log.Printf("[ERROR] Failed deploying image for the FOURTH time. Aborting if the image doesn't exist")
|
log.Printf("[ERROR] Failed deploying image for the FOURTH time. Aborting if the image doesn't exist")
|
||||||
if strings.Contains(err.Error(), "exited prematurely") {
|
if strings.Contains(err.Error(), "exited prematurely") {
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(err.Error(), "No such image") {
|
if strings.Contains(err.Error(), "No such image") {
|
||||||
//log.Printf("[WARNING] Failed deploying %s from image %s: %s", identifier, image, err)
|
//log.Printf("[WARNING] Failed deploying %s from image %s: %s", identifier, image, err)
|
||||||
log.Printf("[ERROR] Image doesn't exist. Shutting down")
|
log.Printf("[ERROR] Image doesn't exist. Shutting down")
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1025,7 +1025,7 @@ func handleExecutionResult(workflowExecution shuffle.WorkflowExecution) {
|
|||||||
err = deployApp(dockercli, images[0], identifier, env, workflowExecution)
|
err = deployApp(dockercli, images[0], identifier, env, workflowExecution)
|
||||||
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
||||||
if strings.Contains(err.Error(), "exited prematurely") {
|
if strings.Contains(err.Error(), "exited prematurely") {
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Trying to replace with lowercase to deploy again. This seems to work with Dockerhub well.
|
// Trying to replace with lowercase to deploy again. This seems to work with Dockerhub well.
|
||||||
@@ -1034,32 +1034,32 @@ func handleExecutionResult(workflowExecution shuffle.WorkflowExecution) {
|
|||||||
err = deployApp(dockercli, image, identifier, env, workflowExecution)
|
err = deployApp(dockercli, image, identifier, env, workflowExecution)
|
||||||
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
||||||
if strings.Contains(err.Error(), "exited prematurely") {
|
if strings.Contains(err.Error(), "exited prematurely") {
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
image = images[2]
|
image = images[2]
|
||||||
err = deployApp(dockercli, image, identifier, env, workflowExecution)
|
err = deployApp(dockercli, image, identifier, env, workflowExecution)
|
||||||
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
||||||
if strings.Contains(err.Error(), "exited prematurely") {
|
if strings.Contains(err.Error(), "exited prematurely") {
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("[WARNING] Failed deploying image THREE TIMES. Attempting to download the latter as last resort.")
|
log.Printf("[WARNING] Failed deploying image THREE TIMES. Attempting to download the latter as last resort.")
|
||||||
reader, err := dockercli.ImagePull(context.Background(), image, pullOptions)
|
reader, err := dockercli.ImagePull(context.Background(), image, pullOptions)
|
||||||
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
||||||
log.Printf("[ERROR] Failed getting %s. The couldn't be find locally, AND is missing.", image)
|
log.Printf("[ERROR] Failed getting %s. The couldn't be find locally, AND is missing.", image)
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildBuf := new(strings.Builder)
|
buildBuf := new(strings.Builder)
|
||||||
_, err = io.Copy(buildBuf, reader)
|
_, err = io.Copy(buildBuf, reader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Error in IO copy: %s", err)
|
log.Printf("[ERROR] Error in IO copy: %s", err)
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
} else {
|
} else {
|
||||||
if strings.Contains(buildBuf.String(), "errorDetail") {
|
if strings.Contains(buildBuf.String(), "errorDetail") {
|
||||||
log.Printf("[ERROR] Docker build:\n%s\nERROR ABOVE: Trying to pull tags from: %s", buildBuf.String(), image)
|
log.Printf("[ERROR] Docker build:\n%s\nERROR ABOVE: Trying to pull tags from: %s", buildBuf.String(), image)
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("[INFO] Successfully downloaded %s", image)
|
log.Printf("[INFO] Successfully downloaded %s", image)
|
||||||
@@ -1069,13 +1069,13 @@ func handleExecutionResult(workflowExecution shuffle.WorkflowExecution) {
|
|||||||
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
if err != nil && !strings.Contains(err.Error(), "Conflict. The container name") {
|
||||||
log.Printf("[ERROR] Failed deploying image for the FOURTH time. Aborting if the image doesn't exist")
|
log.Printf("[ERROR] Failed deploying image for the FOURTH time. Aborting if the image doesn't exist")
|
||||||
if strings.Contains(err.Error(), "exited prematurely") {
|
if strings.Contains(err.Error(), "exited prematurely") {
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(err.Error(), "No such image") {
|
if strings.Contains(err.Error(), "No such image") {
|
||||||
//log.Printf("[WARNING] Failed deploying %s from image %s: %s", identifier, image, err)
|
//log.Printf("[WARNING] Failed deploying %s from image %s: %s", identifier, image, err)
|
||||||
log.Printf("[ERROR] Image doesn't exist. Shutting down")
|
log.Printf("[ERROR] Image doesn't exist. Shutting down")
|
||||||
shutdown(workflowExecution, action.ID, fmt.Sprintf("Docker error: %s", err.Error()), true)
|
shutdown(workflowExecution, action.ID, fmt.Sprintf("%s", err.Error()), true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user