Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
gentoo
fem-overlay-vendored
Commits
9da75407
Unverified
Commit
9da75407
authored
Apr 16, 2022
by
NexAdn
Browse files
Add Go dep archive creator and publisher
parent
9e8375a7
Pipeline
#2683
passed with stages
in 3 minutes and 37 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
9da75407
image
:
golang:latest
variables
:
XQ_PV
:
0.0.7
XQ_SRC_URI
:
'
https://github.com/sibprogrammer/xq/archive/refs/tags/v${PV}.tar.gz'
image
:
debian:stable
stages
:
-
make_modcache
-
deploy
default
:
before_script
:
-
apt update
-
apt -y install golang-go wget tar
make_modcache:xq:
.make_modcache
:
stage
:
make_modcache
script
:
-
"
./make_modcache.sh
xq
${XQ_PV}
${XQ_SRC_URI}"
-
"
./make_modcache.sh
${PN}
${PV}
${SRC_URI}"
artifacts
:
paths
:
-
dep-archives/
xq
:
extends
:
.make_modcache
variables
:
PN
:
"
xq"
PV
:
"
0.0.7"
SRC_URI
:
"
https://github.com/sibprogrammer/xq/archive/refs/tags/v${PV}.tar.gz"
deploy-package-registry
:
stage
:
deploy
before_script
:
-
apt update
-
apt -y install curl
script
:
-
./upload_dep_archives.sh
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"'
make_modcache.sh
View file @
9da75407
...
...
@@ -24,8 +24,10 @@ export GOMODCACHE="${PWD}/go-mod"
mkdir
-p
"
${
archivedir
}
"
||
die
"Failed to create
${
archivedir
}
"
cd
"
${
tmpdir
}
"
||
die
"cd
${
tmpdir
}
failed"
info
"Building modcache for
${
P
}
from source
${
SRC_URI
}
"
info
"Fetching source"
eval
"wget -
q
${
SRC_URI
}
"
||
die
eval
"wget -
-no-verbose
${
SRC_URI
}
"
||
die
"wget failed"
eval
"file=
\$
(basename
\"
${
SRC_URI
}
\"
)"
info
"Extracting source"
...
...
upload_dep_archives.sh
0 → 100755
View file @
9da75407
#!/bin/bash
cd
"
$(
dirname
"
${
0
}
"
)
"
:
${
DEP_ARCHIVES_DIR
:
=
"dep-archives"
}
info
()
{
echo
"[INFO]
$*
"
}
die
()
{
echo
"[ERROR]
$*
"
exit
1
}
extract_pn_pv
()
{
local
separated_pn_pv
=
"
$(
echo
${
1
}
|
sed
's/^\(.*\)-\(\([[:digit:]].\)*[[:digit:]]\)-deps.tar.*$/\1 \2/g'
)
"
PN
=
"
$(
echo
${
separated_pn_pv
}
|
awk
'{print $1;}'
)
"
PV
=
"
$(
echo
${
separated_pn_pv
}
|
awk
'{print $2;}'
)
"
P
=
"
${
PN
}
-
${
PV
}
"
}
which curl 2>&1
||
die
"Failed to find curl executable"
which
sed
2>&1
||
die
"Failed to find sed executable"
[[
"
${
CI_JOB_TOKEN
}
"
==
""
]]
&&
die
"Empty CI_JOB_TOKEN"
[[
"
${
CI_API_V4_URL
}
"
==
""
]]
&&
die
"Empty CI_API_V4_URL"
[[
"
${
CI_PROJECT_ID
}
"
==
""
]]
&&
die
"Empty CI_PROJECT_ID"
pushd
"
${
DEP_ARCHIVES_DIR
}
"
for
archive
in
*
-deps
.tar
*
;
do
!
[[
-f
"
${
archive
}
"
]]
&&
continue
extract_pn_pv
"
${
archive
}
"
info
"Uploading
${
P
}
to package registry"
curl
\
--header
"JOB-TOKEN:
$CI_JOB_TOKEN
"
\
--upload-file
"
${
archive
}
"
\
"
${
CI_API_V4_URL
}
/projects/
${
CI_PROJECT_ID
}
/packages/generic/
${
PN
}
/
${
PV
}
/
${
archive
}
"
\
||
die
"Failed to upload
${
P
}
"
done
Write
Preview
Supports
Markdown
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