Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
gitlab-ci
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Jira
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
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
Clea OS
infrastructure
gitlab-ci
Commits
cb9b211d
Commit
cb9b211d
authored
3 years ago
by
Felix Gerking
Browse files
Options
Downloads
Patches
Plain Diff
package_release: Split alphaplan FWR generation and package_release
parent
3f293145
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
alphaplan_fwr.py
+80
-0
80 additions, 0 deletions
alphaplan_fwr.py
manifest-build.yml
+15
-6
15 additions, 6 deletions
manifest-build.yml
package_release.py
+0
-19
0 additions, 19 deletions
package_release.py
with
95 additions
and
25 deletions
alphaplan_fwr.py
+
80
−
0
View file @
cb9b211d
#!/usr/bin/env python3
#!/usr/bin/env python3
import
argparse
import
json
import
json
import
os
import
os
import
shutil
import
shutil
import
sys
import
sys
import
requests
import
requests
import
glob
from
alphaplan_keys
import
ApKeys
,
ApSubKeys
,
get_ap_dict
from
alphaplan_keys
import
ApKeys
,
ApSubKeys
,
get_ap_dict
def
ap_send_json
(
jsonobj
):
def
ap_send_json
(
jsonobj
):
print
(
"
##### Currently in debug mode: No data is send to AlphaPlan webservice
"
)
return
"""
Sends the generated files to the Alphaplan webservice
"""
"""
Sends the generated files to the Alphaplan webservice
"""
url
=
os
.
environ
.
get
(
"
AP_WEBSERVICE_URL
"
)
url
=
os
.
environ
.
get
(
"
AP_WEBSERVICE_URL
"
)
usr
=
os
.
environ
.
get
(
"
AP_WEBSERVICE_USR
"
)
usr
=
os
.
environ
.
get
(
"
AP_WEBSERVICE_USR
"
)
...
@@ -263,3 +267,79 @@ def generate_fwr_articles(
...
@@ -263,3 +267,79 @@ def generate_fwr_articles(
shutil
.
copyfile
(
jsonfile_local
,
jsonfile_output
,
follow_symlinks
=
True
)
shutil
.
copyfile
(
jsonfile_local
,
jsonfile_output
,
follow_symlinks
=
True
)
# Send data object to AlphaPlan webservice
# Send data object to AlphaPlan webservice
ap_send_json
(
data
)
ap_send_json
(
data
)
def
main
():
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"
--images-dir
"
,
help
=
"""
Yocto images directory
"""
,
dest
=
"
images_dir
"
,
)
parser
.
add_argument
(
"
--outputdir-upload
"
,
help
=
"""
Base directory name for uploaded artifacts
"""
,
dest
=
"
outputdir_upload
"
,
)
parser
.
add_argument
(
"
--outputdir-local
"
,
help
=
"""
Base directory for locally deployed artifacts, should contain absolut path.
"""
,
dest
=
"
outputdir_local
"
,
)
args
,
_
=
parser
.
parse_known_args
()
if
args
.
outputdir_upload
is
None
or
args
.
outputdir_local
is
None
:
sys
.
exit
(
"
ERROR: outputdir-local and outputdir-upload needs to be specified.
"
)
# Get bitbake variables from testdata.json file
testdata_files
=
[]
if
args
.
images_dir
is
not
None
:
testdata_files
+=
glob
.
glob
(
os
.
path
.
join
(
args
.
images_dir
,
"
*.testdata.json
"
))
with
open
(
testdata_files
[
0
],
"
r
"
,
encoding
=
"
utf-8
"
)
as
f
:
buildvars
=
json
.
load
(
f
)
machine
=
buildvars
[
"
MACHINE
"
]
version
=
buildvars
[
"
DISTRO_VERSION
"
]
artifacts_all
=
buildvars
[
"
DISTRO_RELEASE_ARTEFACTS
"
].
split
()
artifacts_all
.
append
(
"
BUILD_SRCREVS.log
"
)
if
version
.
startswith
(
"
fngsystem
"
):
release_name_local
=
version
.
replace
(
"
fngsystem
"
,
"
FNGSystem
"
)
release_name
=
release_name_local
else
:
release_name
=
"
GUF-Yocto-%s
"
%
version
release_name_local
=
"
Yocto-%s
"
%
version
output_dir
=
os
.
path
.
join
(
args
.
outputdir_upload
,
release_name
)
outlocal_dir
=
os
.
path
.
join
(
args
.
outputdir_local
,
release_name_local
)
if
not
os
.
path
.
isdir
(
outlocal_dir
):
sys
.
exit
(
"
ERROR: ouputdir-local does not exist
"
)
if
not
os
.
path
.
isdir
(
output_dir
):
sys
.
exit
(
"
ERROR: ouputdir-upload does not exist
"
)
# Get md5sums.txt
md5sums_file
=
os
.
path
.
join
(
output_dir
,
machine
,
"
md5sums.txt
"
)
md5sums
=
{}
with
open
(
md5sums_file
)
as
f
:
for
line
in
f
:
# Assuming line format: "<md5sum> <filename>\n"
name
=
line
.
split
(
"
"
)[
1
].
rstrip
()
sum
=
line
.
split
(
"
"
)[
0
]
md5sums
[
name
]
=
sum
# Generate alphaplan FWR articles
alphaplan_fwr
.
generate_fwr_articles
(
output_dir
,
outlocal_dir
,
machine
,
release_name_local
,
artifacts_all
,
md5sums
,
)
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
manifest-build.yml
+
15
−
6
View file @
cb9b211d
...
@@ -130,12 +130,6 @@ variables:
...
@@ -130,12 +130,6 @@ variables:
outdir="${OUTDIR_BASE}-fngsystem/CI_Builds"
outdir="${OUTDIR_BASE}-fngsystem/CI_Builds"
fi
fi
# Generate AlphaPlan FWR articles if release tag is set
if [ -n "$CI_COMMIT_TAG" ] && \
[[ "${CI_PARAM_PACKAGE_FTP}" == "false" ]];then
UPLOAD_PARAM="${UPLOAD_PARAM} --generate-fwr-articles"
fi
script=".gitlab-ci/package_release.py"
script=".gitlab-ci/package_release.py"
[ ! -x "$script" ] && script=".repo/manifests/$script"
[ ! -x "$script" ] && script=".repo/manifests/$script"
[ ! -x "$script" ] && echo "Failed to find package_release script"
[ ! -x "$script" ] && echo "Failed to find package_release script"
...
@@ -156,6 +150,21 @@ variables:
...
@@ -156,6 +150,21 @@ variables:
--outputdir-local="${outdir}"
--outputdir-local="${outdir}"
fi
fi
# Generate AlphaPlan FWR articles if release tag is set
ap-script=".gitlab-ci/alphaplan_fwr.py"
[ ! -x "${ap-script}" ] && script=".repo/manifests/${ap-script}"
[ ! -x "${ap-script}" ] && echo "Failed to find alphaplan_fwr script"
#if [ -n "$CI_COMMIT_TAG" ] && \
echo "CI AP debug mode"
if true && \
[[ "${CI_PARAM_PACKAGE_FTP}" == "false" ]];then
${ap-script} \
--images-dir="${ARTIFACTS_IMAGE_PATH}" \
--outputdir-local=${outdir} \
--outputdir-upload=release
fi
.prepare_test
:
.prepare_test
:
before_script
:
before_script
:
-
*setup_ssh
-
*setup_ssh
...
...
This diff is collapsed.
Click to expand it.
package_release.py
+
0
−
19
View file @
cb9b211d
...
@@ -7,7 +7,6 @@ import sys
...
@@ -7,7 +7,6 @@ import sys
import
shutil
import
shutil
import
hashlib
import
hashlib
import
tempfile
import
tempfile
import
alphaplan_fwr
from
datetime
import
datetime
from
datetime
import
datetime
from
convert_md2html
import
convertmd2html
from
convert_md2html
import
convertmd2html
...
@@ -185,13 +184,6 @@ def main():
...
@@ -185,13 +184,6 @@ def main():
help
=
"""
Documentation directory
"""
,
help
=
"""
Documentation directory
"""
,
dest
=
"
doc_dir
"
,
dest
=
"
doc_dir
"
,
)
)
parser
.
add_argument
(
"
--generate-fwr-articles
"
,
help
=
"""
Enable AlphaPlan FWR generation
"""
,
dest
=
"
generate_fwr_articles
"
,
action
=
"
store_true
"
,
)
parser
.
set_defaults
(
generate_fwr_articles
=
False
)
args
,
_
=
parser
.
parse_known_args
()
args
,
_
=
parser
.
parse_known_args
()
if
args
.
outputdir_upload
is
None
and
args
.
outputdir_local
is
None
:
if
args
.
outputdir_upload
is
None
and
args
.
outputdir_local
is
None
:
...
@@ -290,17 +282,6 @@ def main():
...
@@ -290,17 +282,6 @@ def main():
artifacts_all
.
append
(
"
license.manifest
"
)
artifacts_all
.
append
(
"
license.manifest
"
)
# Generate alphaplan FWR articles
if
args
.
generate_fwr_articles
:
alphaplan_fwr
.
generate_fwr_articles
(
output_dir
,
outlocal_dir
,
machine
,
release_name_local
,
artifacts_all
,
md5sums
,
)
# Generate metadata
# Generate metadata
if
args
.
sdk_dir
is
None
:
if
args
.
sdk_dir
is
None
:
generate_metadata
(
generate_metadata
(
...
...
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