Merge pull request #351 from samalba/fix-writefile-error
Fix writefile error
This commit is contained in:
commit
b0f05e66a0
@ -831,8 +831,10 @@ func (p *Pipeline) WriteFile(ctx context.Context, op *compiler.Value, st llb.Sta
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
content = []byte(str)
|
content = []byte(str)
|
||||||
}
|
}
|
||||||
|
case cue.BottomKind:
|
||||||
|
err = fmt.Errorf("%s: WriteFile content is not set", op.Path().String())
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("unhandled data type in WriteFile: %s", kind)
|
err = fmt.Errorf("%s: unhandled data type in WriteFile: %s", op.Path().String(), kind)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return st, err
|
return st, err
|
||||||
|
@ -47,6 +47,8 @@ import (
|
|||||||
sql="CREATE DATABASE \"$(cat /inputs/name)\""
|
sql="CREATE DATABASE \"$(cat /inputs/name)\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cp /inputs/name /db_created
|
||||||
|
|
||||||
aws rds-data execute-statement \
|
aws rds-data execute-statement \
|
||||||
--resource-arn "$(cat /inputs/db_arn)" \
|
--resource-arn "$(cat /inputs/db_arn)" \
|
||||||
--secret-arn "$(cat /inputs/secret_arn)" \
|
--secret-arn "$(cat /inputs/secret_arn)" \
|
||||||
@ -56,11 +58,8 @@ import (
|
|||||||
|& tee /tmp/out
|
|& tee /tmp/out
|
||||||
exit_code=${PIPESTATUS[0]}
|
exit_code=${PIPESTATUS[0]}
|
||||||
if [ $exit_code -ne 0 ]; then
|
if [ $exit_code -ne 0 ]; then
|
||||||
cat /tmp/out
|
grep -q "database exists\|already exists" /tmp/out || exit $exit_code
|
||||||
grep -q "database exists\|already exists" /tmp/out
|
|
||||||
[ $? -ne 0 ] && exit $exit_code
|
|
||||||
fi
|
fi
|
||||||
cp /inputs/name /db_created
|
|
||||||
"""#
|
"""#
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,6 +112,8 @@ import (
|
|||||||
sql="CREATE USER \"$(cat /inputs/username)\" WITH PASSWORD '$(cat /inputs/password)'"
|
sql="CREATE USER \"$(cat /inputs/username)\" WITH PASSWORD '$(cat /inputs/password)'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cp /inputs/username /username
|
||||||
|
|
||||||
aws rds-data execute-statement \
|
aws rds-data execute-statement \
|
||||||
--resource-arn "$(cat /inputs/db_arn)" \
|
--resource-arn "$(cat /inputs/db_arn)" \
|
||||||
--secret-arn "$(cat /inputs/secret_arn)" \
|
--secret-arn "$(cat /inputs/secret_arn)" \
|
||||||
@ -122,11 +123,8 @@ import (
|
|||||||
|& tee tmp/out
|
|& tee tmp/out
|
||||||
exit_code=${PIPESTATUS[0]}
|
exit_code=${PIPESTATUS[0]}
|
||||||
if [ $exit_code -ne 0 ]; then
|
if [ $exit_code -ne 0 ]; then
|
||||||
cat tmp/out
|
grep -q "Operation CREATE USER failed for\|ERROR" tmp/out || exit $exit_code
|
||||||
grep -q "Operation CREATE USER failed for\|ERROR" tmp/out
|
|
||||||
[ $? -ne 0 ] && exit $exit_code
|
|
||||||
fi
|
fi
|
||||||
cp /inputs/username /username
|
|
||||||
|
|
||||||
sql="SET PASSWORD FOR '$(cat /inputs/username)'@'%' = PASSWORD('$(cat /inputs/password)')"
|
sql="SET PASSWORD FOR '$(cat /inputs/username)'@'%' = PASSWORD('$(cat /inputs/password)')"
|
||||||
if [ "$dbType" = postgres ]; then
|
if [ "$dbType" = postgres ]; then
|
||||||
|
Reference in New Issue
Block a user