Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
OGS Container Maker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
ogs
OGS Container Maker
Commits
d7899e5a
Commit
d7899e5a
authored
5 years ago
by
Lars Bilke
Browse files
Options
Downloads
Patches
Plain Diff
Added --ccache parameter.
parent
1291dbe1
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
ogscm/building_blocks/ccache.py
+3
-3
3 additions, 3 deletions
ogscm/building_blocks/ccache.py
ogscm/cli.py
+18
-10
18 additions, 10 deletions
ogscm/cli.py
ogscm/cli_args.py
+6
-0
6 additions, 0 deletions
ogscm/cli_args.py
ogscm/container_info.py
+4
-2
4 additions, 2 deletions
ogscm/container_info.py
with
31 additions
and
15 deletions
ogscm/building_blocks/ccache.py
+
3
−
3
View file @
d7899e5a
# pylint: disable=invalid-name, too-few-public-methods
# pylint: disable=too-many-instance-attributes
"""
Package manager Conan
building block
"""
"""
ccache
building block
"""
from
__future__
import
absolute_import
from
__future__
import
unicode_literals
...
...
@@ -15,12 +15,12 @@ from hpccm.primitives.shell import shell
class
ccache
(
bb_base
):
"""
Package manager Conan
building block
"""
"""
ccache
building block
"""
def
__init__
(
self
,
**
kwargs
):
"""
Initialize building block
"""
super
(
ccache
,
self
).
__init__
()
self
.
__cache_dir
=
kwargs
.
get
(
'
cache_dir
'
,
'
/opt/cache
'
)
self
.
__cache_dir
=
kwargs
.
get
(
'
cache_dir
'
,
'
/opt/
c
cache
'
)
self
.
__cache_size
=
kwargs
.
get
(
'
cache_size
'
,
'
5G
'
)
self
.
__instructions
()
...
...
This diff is collapsed.
Click to expand it.
ogscm/cli.py
+
18
−
10
View file @
d7899e5a
...
...
@@ -307,6 +307,11 @@ def main(): # pragma: no cover
])
if
ogs_version
!=
'
off
'
:
mount_args
=
''
if
args
.
ccache
:
Stage0
+=
ccache
(
cache_size
=
'
15G
'
)
if
info
.
buildkit
:
mount_args
=
f
'
{
mount_args
}
--mount=type=cache,target=/opt/ccache,id=ccache
'
if
args
.
cvode
:
cmake_args
.
append
(
'
-DOGS_USE_CVODE=ON
'
)
if
args
.
gui
:
...
...
@@ -316,15 +321,15 @@ def main(): # pragma: no cover
Stage0
+=
pip
(
packages
=
[
'
scif
'
],
pip
=
'
pip3
'
)
# SCI-F
scif_installed
=
True
Stage0
+=
raw
(
docker
=
f
"
ARG OGS_COMMIT_HASH=
{
info
.
commit_hash
}
"
)
if
info
.
buildkit
:
scif_file
=
f
"
{
info
.
out_dir
}
/ogs.scif
"
if
info
.
ogsdir
!=
''
:
context_path_size
=
len
(
ogs_version
)
os
.
chdir
(
ogs_version
)
ogs_app
=
scif
(
_arguments
=
'
--mount=type=bind,target=/scif/apps/ogs/src,rw
'
,
name
=
'
ogs
'
,
file
=
f
"
{
info
.
out_dir
[
context_path_size
+
1
:
]
}
/ogs.scif
"
)
else
:
ogs_app
=
scif
(
name
=
'
ogs
'
,
file
=
f
"
{
info
.
out_dir
}
/ogs.scif
"
)
mount_args
=
f
'
{
mount_args
}
--mount=type=bind,target=/scif/apps/ogs/src,rw
'
scif_file
=
f
"
{
info
.
out_dir
[
context_path_size
+
1
:
]
}
/ogs.scif
"
ogs_app
=
scif
(
_arguments
=
mount_args
,
name
=
'
ogs
'
,
file
=
scif_file
)
ogs_app
+=
ogs
(
repo
=
info
.
repo
,
branch
=
info
.
branch
,
commit
=
info
.
commit_hash
,
...
...
@@ -382,10 +387,13 @@ def main(): # pragma: no cover
# TODO: adapt this to else
continue
build_cmd
=
(
f
"
docker build
"
f
"
-t
{
info
.
tag
}
-f
{
definition_file_path
}
.
"
)
enable_buildkit
=
''
if
info
.
buildkit
:
build_cmd
=
"
(cd {0} && DOCKER_BUILDKIT=1 {1})
"
.
format
(
enable_buildkit
=
'
DOCKER_BUILDKIT=1
'
build_cmd
=
(
f
"
{
enable_buildkit
}
docker build
"
f
"
-t
{
info
.
tag
}
-f
{
definition_file_path
}
.
"
)
if
info
.
ogsdir
!=
''
:
build_cmd
=
"
(cd {0} && {1})
"
.
format
(
ogs_version
,
build_cmd
)
print
(
f
"
Running:
{
build_cmd
}
"
)
subprocess
.
run
(
build_cmd
,
shell
=
True
)
...
...
This diff is collapsed.
Click to expand it.
ogscm/cli_args.py
+
6
−
0
View file @
d7899e5a
...
...
@@ -102,6 +102,12 @@ class Cli_Args(argparse.ArgumentParser):
action
=
'
store_true
'
,
help
=
'
Generate multi-stage Dockerfiles for small runtime
'
'
images
'
)
build_g
.
add_argument
(
'
--ccache
'
,
dest
=
'
ccache
'
,
action
=
'
store_true
'
,
help
=
'
Enables ccache build caching.
'
)
switches_g
=
self
.
add_argument_group
(
'
Additional options
'
)
switches_g
.
add_argument
(
'
--base_image
'
,
type
=
str
,
...
...
This diff is collapsed.
Click to expand it.
ogscm/container_info.py
+
4
−
2
View file @
d7899e5a
...
...
@@ -20,7 +20,8 @@ from ogscm import config
class
container_info
():
def
__init__
(
self
,
args_iter
,
args
):
"""
Initialize container info
"""
self
.
buildkit
=
False
self
.
buildkit
=
True
self
.
ogsdir
=
''
self
.
outdir
=
''
self
.
definition_file
=
''
self
.
images_out_dir
=
''
...
...
@@ -111,12 +112,13 @@ class container_info():
if
os
.
path
.
isdir
(
ogs_version
):
self
.
buildkit
=
True
self
.
ogsdir
=
ogs_version
if
args
.
file
!=
''
:
self
.
out_dir
=
args
.
out
self
.
definition_file
=
args
.
file
else
:
if
self
.
buildkit
:
if
self
.
ogsdir
!=
''
:
self
.
out_dir
=
os
.
path
.
join
(
ogs_version
,
f
"
{
args
.
out
}
/
{
container_format
}
/
{
img_folder
}
"
)
else
:
...
...
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