Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Baudouin Feildel
aurtomatic
Commits
122c446c
Commit
122c446c
authored
Aug 13, 2019
by
Baudouin Feildel
Browse files
Handle error for all external script call
parent
ce67ba34
Pipeline
#730
failed with stages
in 16 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
build.sh
View file @
122c446c
...
...
@@ -17,13 +17,13 @@ invoke_pacman()
download_package
()
{
CURRENT_ACTION
=
"Download https://aur.archlinux.org/cgit/aur.git/snapshot/
$1
.tar.gz"
curl
--location
"https://aur.archlinux.org/cgit/aur.git/snapshot/
$1
.tar.gz"
>
"
$1
.tar.gz"
curl
--location
"https://aur.archlinux.org/cgit/aur.git/snapshot/
$1
.tar.gz"
>
"
$1
.tar.gz"
||
log_error
}
extract_package
()
{
CURRENT_ACTION
=
"Extract
$1
.tar.gz in
$PWD
"
tar
-xf
"
$1
.tar.gz"
tar
-xf
"
$1
.tar.gz"
||
log_error
}
package_get_makedepends
()
...
...
@@ -44,13 +44,13 @@ package_get_depends()
install_package
()
{
CURRENT_ACTION
=
"Install package from disk"
invoke_pacman
-U
--noconfirm
"
$WORKDIR
/
$1
/"
*
.pkg.tar.xz
invoke_pacman
-U
--noconfirm
"
$WORKDIR
/
$1
/"
*
.pkg.tar.xz
||
log_error
}
save_package
()
{
CURRENT_ACTION
=
"Save package as artifact"
cp
"
$WORKDIR
/
$1
/"
*
.pkg.tar.xz
"
$SRCDIR
/packages"
cp
"
$WORKDIR
/
$1
/"
*
.pkg.tar.xz
"
$SRCDIR
/packages"
||
log_error
add_to_digest
"Save OK"
}
...
...
@@ -61,14 +61,14 @@ save_package_from_cache()
if
[[
!
-f
current-repo/current
]]
then
pushd
"
$SRCDIR
"
>
/dev/null
"
$SRCDIR
/generate-current-status.sh"
"
${
REPOSITORY_URL
}
"
"
${
REPOSITORY_NAME
}
"
"
$SRCDIR
/generate-current-status.sh"
"
${
REPOSITORY_URL
}
"
"
${
REPOSITORY_NAME
}
"
||
log_error
popd
>
/dev/null
fi
local
filename
=
$(
grep
-P
"^
$1
\t
"
"
$SRCDIR
/current-repo/current"
|
cut
-f
3
)
pushd
"
$SRCDIR
/packages"
>
/dev/null
curl
-O
"
${
REPOSITORY_URL
}
/
$filename
"
curl
-O
"
${
REPOSITORY_URL
}
/
$filename
"
||
log_error
popd
>
/dev/null
add_to_digest
"
$CURRENT_ACTION
OK"
...
...
@@ -114,19 +114,19 @@ recipe_deps()
export
SRCDIR
export
REPOSITORY_NAME
export
REPOSITORY_URL
"
$SRCDIR
/recipes/apply.sh"
"
$1
"
deps
"
$SRCDIR
/recipes/apply.sh"
"
$1
"
deps
||
log_error
}
recipe_pre
()
{
CURRENT_ACTION
=
"hook=pre"
"
$SRCDIR
/recipes/apply.sh"
"
$1
"
pre
"
$SRCDIR
/recipes/apply.sh"
"
$1
"
pre
||
log_error
}
recipe_post
()
{
CURRENT_ACTION
=
"hook=post"
"
$SRCDIR
/recipes/apply.sh"
"
$1
"
post
"
$SRCDIR
/recipes/apply.sh"
"
$1
"
post
||
log_error
}
build_package
()
...
...
@@ -175,14 +175,13 @@ build_package()
echo
-e
"
${
TITLE_FMT
}
==> Call makepkg...
${
NO_FMT
}
"
CURRENT_ACTION
=
"makepkg
$pkg
"
makepkg
makepkg
||
log_error
recipe_post
"
$pkg
"
add_to_digest
"Build OK"
popd
>
/dev/null
popd
>
/dev/null
add_to_digest
"Build OK"
}
get_current_version
()
...
...
@@ -191,7 +190,7 @@ get_current_version()
if
[[
!
-f
current-repo/current
]]
then
pushd
"
$SRCDIR
"
>
/dev/null
"
$SRCDIR
/generate-current-status.sh"
"
${
REPOSITORY_URL
}
"
"
${
REPOSITORY_NAME
}
"
"
$SRCDIR
/generate-current-status.sh"
"
${
REPOSITORY_URL
}
"
"
${
REPOSITORY_NAME
}
"
||
log_error
popd
>
/dev/null
fi
...
...
@@ -241,7 +240,7 @@ DIGEST="$1"
DIGEST_FILE
=
"
$SRCDIR
/digest/package.
$1
.txt"
add_to_digest
()
{
DIGEST
=
"
${
DIGEST
}
\t
$1
"
DIGEST
=
"
${
DIGEST
}
\
n\
t
$1
"
}
add_status_to_digest
()
...
...
@@ -258,17 +257,17 @@ save_digest()
{
if
[[
-d
"
$SRCDIR
/digest"
]]
then
echo
"
$DIGEST
"
>
"
$DIGEST_FILE
"
echo
-e
"
$DIGEST
"
>
"
$DIGEST_FILE
"
else
echo
"Can't save digest, digest directory doesn't exists."
echo
"Can't save digest, digest directory doesn't exists."
>
/dev/stderr
fi
}
CURRENT_ACTION
=
"unknown"
log_error
()
{
echo
"Error while building
$CURRENT_PACKAGE
, dependency tree:
$CURRENT_DEPENDENCY_TREE
"
echo
"Current action was: '
$CURRENT_ACTION
'"
echo
"Error while building
$CURRENT_PACKAGE
, dependency tree:
$CURRENT_DEPENDENCY_TREE
"
>
/dev/stderr
echo
"Current action was: '
$CURRENT_ACTION
'"
>
/dev/stderr
add_to_digest
"
$CURRENT_ACTION
NOK"
# We use 0 here to allow GitLab to save artifacts even if failure happened
exit
0
...
...
generate-current-status.sh
View file @
122c446c
#!/bin/bash
set
-e
get_database
()
{
local
REPOSITORY_URL
=
"
$1
"
...
...
recipes/apply.sh
View file @
122c446c
#!/bin/bash
set
-e
DIR
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
>
/dev/null
&&
pwd
)
"
if
[[
-f
"
$DIR
/
$1
.sh"
]]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment