Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
samba
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
obextra
samba
Commits
2bdc2fae
Commit
2bdc2fae
authored
1 year ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
debug apkg-deploy.sh script
parent
b35fff58
No related branches found
No related tags found
No related merge requests found
Pipeline
#3666
failed
1 year ago
Stage: build
Stage: rebuild
Stage: deploy
Pipeline: samba
#3667
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+2
-1
2 additions, 1 deletion
.gitlab-ci.yml
apkg-deploy.sh
+152
-0
152 additions, 0 deletions
apkg-deploy.sh
with
154 additions
and
1 deletion
.gitlab-ci.yml
+
2
−
1
View file @
2bdc2fae
...
...
@@ -95,4 +95,5 @@ deploy:
stage
:
deploy
needs
:
[
"
build"
,
"
rebuild:packages"
]
script
:
-
apkg-deploy.sh
-
chmod +x ./apkg-deploy.sh
-
./apkg-deploy.sh
This diff is collapsed.
Click to expand it.
apkg-deploy.sh
0 → 100755
+
152
−
0
View file @
2bdc2fae
#!/usr/bin/bash
# Copyright (c) 2015-2023 Eric Vidal <eric@obarun.org>
# All rights reserved.
#
# This file is part of Obarun. It is subject to the license terms in
# the LICENSE file found in the top-level directory of this
# distribution.
# This file may not be copied, modified, propagated, or distributed
# except according to the terms contained in the LICENSE file.
export
PROG
=
"
${
0
##*/
}
"
export
CLOCK_ENABLED
=
0
export
COLOR_ENABLED
=
1
export
VERBOSITY
=
1
export
ODB_WORKDIR
=
"
${
CI_PROJECT_DIR
}
/packages"
die
()
{
oblog
-f
"
${
@
}
"
exit
111
}
clean_up
()
{
local
wstat
=
${
1
:-
$?
}
# unhook all traps to avoid race conditions
trap
''
EXIT TERM HUP QUIT INT ERR
oblog
"Release lock of repository
${
repo
}
"
odb
-r
"
${
repo
}
"
unlock
exit
$wstat
}
pacman_search
()
{
local
repo
=
"
${
1
}
"
package
=
"
${
2
}
"
tag
=
"
${
3
}
"
if
!
pacman
-Sl
"
${
repo
}
"
--config
"
${
CI_PROJECT_DIR
}
"
/pacman.conf |
grep
"
${
package
}
${
tag
}
"
;
then
return
1
else
return
0
fi
}
pacman_create_config
()
{
oblog
"create temporary pacman configuration file"
echo
"
[options]
Architecture = auto
Color
ParallelDownloads = 5
SigLevel = Required DatabaseOptional
LocalFileSigLevel = Optional
[obcore-testing]
SigLevel = Required
Server = https://cloud.server.obarun.org/
\$
repo/os/
\$
arch/
[obcore]
SigLevel = Required
Server = https://cloud.server.obarun.org/
\$
repo/os/
\$
arch/
[obextra-testing]
SigLevel = Required
Server = https://cloud.server.obarun.org/
\$
repo/os/
\$
arch/
[obextra]
SigLevel = Required
Server = https://cloud.server.obarun.org/
\$
repo/os/
\$
arch/
[core-testing]
SigLevel = DatabaseOptional
Include = /etc/pacman.d/mirrorlist
[core]
SigLevel = DatabaseOptional
Include = /etc/pacman.d/mirrorlist
[extra-testing]
SigLevel = DatabaseOptional
Include = /etc/pacman.d/mirrorlist
[extra]
SigLevel = DatabaseOptional
Include = /etc/pacman.d/mirrorlist
"
>
"
${
CI_PROJECT_DIR
}
"
/pacman.conf
}
gpg_fingerprint
=
$(
echo
"
${
GPG_SIGN_KEY_FINGERPRINT
}
"
|
base64
-d
|
tr
-d
'\r'
)
repo
=
"
${
CI_PROJECT_NAMESPACE
##*/
}
"
arch_repo
=
"
${
repo
/ob/
}
"
tag
=
$(
git describe
--tags
--abbrev
=
0
)
pacman_create_config
oblog
"Synchronizing db"
pacman
-Syy
--config
"
${
CI_PROJECT_DIR
}
"
/pacman.conf
if
pacman_search
"
${
arch_repo
}
-testing"
"
${
CI_PROJECT_NAME
}
"
"
${
tag
}
"
;
then
repo
=
"
${
repo
}
-testing"
fi
cd
"
${
CI_PROJECT_DIR
}
"
oblog
"Create directory
${
CI_PROJECT_DIR
}
/packages/db"
mkdir
-p
packages/db
||
die
"unable to create
${
CI_PROJECT_DIR
}
/packages/db directory"
oblog
"Move compressed packages to packages directory"
mv
*
.pkg.tar.xz packages
trap
'clean_up'
EXIT
apkg-lock.sh
"
${
repo
}
"
||
die
"unable to lock the repository"
oblog
"Download db files from
${
repo
}
"
odb
-r
"
${
repo
}
"
-d
download
||
die
"unable to download db files"
packages
=(
$(
find packages
-maxdepth
1
-type
f
)
)
db
=
"
${
repo
}
.db.tar.gz"
oblog
"Import gpg key"
echo
"
${
GPG_SIGN_KEY
}
"
|
base64
-d
| gpg
--import
||
die
"unable to import gpg key"
oblog
"add gpg to pacman keyring"
echo
"
${
GPG_SIGN_KEY_PUBLIC
}
"
|
base64
-d
>
public.key
pacman-key
--init
||
die
"unable to init pacman db"
pacman-key
--add
public.key
||
die
"unable to add gpg key to pacman keyring"
pacman-key
--lsign-key
"
${
gpg_fingerprint
}
"
oblog
"Sign package(s) and add it to db"
for
package
in
"
${
packages
[@]
}
"
;
do
gpg
--detach-sign
--no-armor
packages/
"
${
package
##*/
}
"
repo-add packages/db/
"
${
db
}
"
packages/
"
${
package
##*/
}
"
--sign
--key
"
${
gpg_fingerprint
}
"
||
die
"unable to add package to db"
done
oblog
"Destroy gpg configuration"
rm
-f
public.key
rm
-rf
/root/.gnupg
oblog
"Upload packages to
${
repo
}
"
odb
-r
"
${
repo
}
"
upload
||
die
"unable to upload packages"
oblog
"Upload db to
${
repo
}
"
odb
-r
"
${
repo
}
"
-d
upload
||
die
"unable to upload db"
oblog
"Archive old packages"
odb
-r
"
${
repo
}
"
archive
||
die
"unable to archive packages"
clean_up 0
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment