Comments (2)
For what it's worth, this originates from the koji hub code.
def importImageInternal(task_id, build_id, imgdata):
"""
Import image info and the listing into the database, and move an image
to the final resting place. The filesize may be reported as a string if it
exceeds the 32-bit signed integer limit. This function will convert it if
need be. This is the completeBuild for images; it should not be called for
scratch images.
imgdata is:
arch - the arch if the image
files - files associated with the image (appliances have multiple files)
rpmlist - the list of RPM NVRs installed into the image
"""
host = Host()
host.verify()
task = Task(task_id)
task.assertHost(host.id)
koji.plugin.run_callbacks('preImport', type='image', image=imgdata)
# import the build output
build_info = get_build(build_id, strict=True)
workpath = koji.pathinfo.task(imgdata['task_id'])
imgdata['relpath'] = koji.pathinfo.taskrelpath(imgdata['task_id'])
archives = []
for imgfile in imgdata['files']:
fullpath = os.path.join(workpath, imgfile)
archivetype = get_archive_type(imgfile)
logger.debug('image type we are importing is: %s' % archivetype)
if not archivetype:
raise koji.BuildError, 'Unsupported image type'
archives.append(import_archive(fullpath, build_info, 'image', imgdata))
# upload logs
logs = [f for f in os.listdir(workpath) if f.endswith('.log')]
for logfile in logs:
logsrc = os.path.join(workpath, logfile)
logdir = os.path.join(koji.pathinfo.build(build_info),
'data/logs/image')
koji.ensuredir(logdir)
final_path = os.path.join(logdir, os.path.basename(logfile))
if os.path.exists(final_path):
raise koji.GenericError("Error importing build log. %s already exists." % final_path)
if os.path.islink(logsrc) or not os.path.isfile(logsrc):
raise koji.GenericError("Error importing build log. %s is not a regular file." % logsrc)
os.rename(logsrc, final_path)
os.symlink(final_path, logsrc)
# record all of the RPMs installed in the image(s)
# verify they were built in Koji or in an external repo
rpm_ids = []
for an_rpm in imgdata['rpmlist']:
location = an_rpm.get('location')
if location:
data = add_external_rpm(an_rpm, location, strict=False)
else:
data = get_rpm(an_rpm, strict=True)
rpm_ids.append(data['id'])
# associate those RPMs with the image
q = """INSERT INTO image_listing (image_id,rpm_id)
VALUES (%(image_id)i,%(rpm_id)i)"""
for archive in archives:
sys.stderr.write('working on archive %s' % archive)
if archive['filename'].endswith('xml'):
continue
sys.stderr.write('associating installed rpms with %s' % archive['id'])
for rpm_id in rpm_ids:
_dml(q, {'image_id': archive['id'], 'rpm_id': rpm_id})
koji.plugin.run_callbacks('postImport', type='image', image=imgdata,
fullpath=fullpath)
https://pagure.io/koji/blob/master/f/hub/kojihub.py#_7759
Which might be a bug in kojihub itself since it's setting a value inside a loop that may or may not execute based on the iterator being non-zero in length but then the variable is referenced blindly such that is is assumed to always be populated or assigned.
from koji-containerbuild.
This issue has not been since likely because we've moved to content generator API and have consolidated tasks into single buildContainer
.
from koji-containerbuild.
Related Issues (20)
- CI builds failing
- [packit] Propose update failed for release koji-containerbuild-0.7.20-1
- [packit] Propose update failed for release koji-containerbuild-0.7.20-1
- [packit] Propose update failed for release koji-containerbuild-0.7.20-1
- [packit] Propose update failed for release koji-containerbuild-0.7.20.1-1
- [packit] Propose update failed for release koji-containerbuild-0.7.20.1-1
- [packit] Propose update failed for release koji-containerbuild-0.7.20.1-1
- location for container inspection scripts HOT 7
- [packit] Propose update failed for release 0.7.21
- Lack of Dockerfile checkout for Flatpaks can bypass plugins HOT 2
- getTaskResult returns stringify'd ints for koji_builds HOT 1
- consider relaxing jsonschema 3.2.0 requirement HOT 3
- PyPI release HOT 5
- Check build result in createContainer
- Disable scratch builds until a proper solution is found HOT 3
- Use a different osbs config section for scratch builds HOT 1
- Add createContainer and buildContainer to method list at kojiweb task page HOT 1
- getBuild need add an argument 'strict=True' HOT 1
- is this deprecated? HOT 2
- Auto populate the container version based on a "primary rpm" version HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from koji-containerbuild.