UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ironbank Containers
C
Confluent
Confluent Component Operator
cp-init-container-operator-6.1.1
Commits
0c8d43a0
Commit
0c8d43a0
authored
Jun 07, 2021
by
Scott Stroud
Browse files
feedback
parent
af839488
Pipeline
#299792
passed with stages
in 20 minutes and 14 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
168 additions
and
7 deletions
+168
-7
.dockerignore
.dockerignore
+3
-0
.gitignore
.gitignore
+4
-0
Dockerfile
Dockerfile
+7
-7
scripts/build-image.sh
scripts/build-image.sh
+4
-0
scripts/genManifestTemplate.sh
scripts/genManifestTemplate.sh
+80
-0
scripts/importArtifacts.sh
scripts/importArtifacts.sh
+70
-0
No files found.
.dockerignore
0 → 100644
View file @
0c8d43a0
scripts/build-image.sh
scripts/genManifestTemplate.sh
scripts/importArtifacts.sh
\ No newline at end of file
.gitignore
0 → 100644
View file @
0c8d43a0
*.whl
*.tar.gz
*.rpm
jsonnet
\ No newline at end of file
Dockerfile
View file @
0c8d43a0
...
@@ -14,8 +14,8 @@
...
@@ -14,8 +14,8 @@
# limitations under the License.
# limitations under the License.
ARG
BASE_REGISTRY=registry1.dso.mil
ARG
BASE_REGISTRY=registry1.dso.mil
ARG
BASE_IMAGE=redhat/
ubi/ubi8
ARG
BASE_IMAGE=redhat/
openjdk/openjdk11
ARG
BASE_TAG=
8.3
ARG
BASE_TAG=
1.11
FROM
${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}
FROM
${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}
...
@@ -27,11 +27,11 @@ USER root
...
@@ -27,11 +27,11 @@ USER root
########################################
########################################
## Install Python
## Install Python
RUN
dnf update
-y
&&
\
RUN
dnf update
-y
&&
dnf
install
-y
python38.x86_64 python38-pip-wheel.noarch
\
dnf
install
-y
python38.x86_64
&&
\
&&
ln
-s
/usr/bin/python3 /usr/bin/python
\
dnf
install
-y
python38-pip-wheel.noarch
&&
\
&&
ln
-s
/usr/bin/pip3 /usr/bin/pip
\
dnf clean all
&&
\
&&
dnf clean all
\
rm
-rf
/var/cache/dnf
&&
rm
-rf
/var/cache/dnf
## Python Installed
## Python Installed
########################################
########################################
...
...
build-image.sh
→
scripts/
build-image.sh
View file @
0c8d43a0
...
@@ -22,6 +22,8 @@ fi
...
@@ -22,6 +22,8 @@ fi
BASE_REGISTRY
=
${
BASE_REGISTRY
:-
'registry1.dso.mil'
}
BASE_REGISTRY
=
${
BASE_REGISTRY
:-
'registry1.dso.mil'
}
MANI
=
'hardening_manifest.yaml'
MANI
=
'hardening_manifest.yaml'
cd
../
## parse manifest with yq (https://github.com/mikefarah/yq)
## parse manifest with yq (https://github.com/mikefarah/yq)
name
=
$(
yq e
'.name'
$MANI
)
name
=
$(
yq e
'.name'
$MANI
)
tags
=(
$(
yq e
'.tags.[]'
$MANI
)
)
tags
=(
$(
yq e
'.tags.[]'
$MANI
)
)
...
@@ -55,6 +57,8 @@ for tag in "${tags[@]}";do
...
@@ -55,6 +57,8 @@ for tag in "${tags[@]}";do
echo
"🏷 Tagged build with
$BASE_REGISTRY
/
$name
:
$tag
"
echo
"🏷 Tagged build with
$BASE_REGISTRY
/
$name
:
$tag
"
done
done
cd
scripts
end
=
`
date
+%s
`
end
=
`
date
+%s
`
duration
=
$((
end-start
))
duration
=
$((
end-start
))
echo
"🏁 Finished
$CONTAINER
build (
${
duration
}
seconds)"
echo
"🏁 Finished
$CONTAINER
build (
${
duration
}
seconds)"
\ No newline at end of file
scripts/genManifestTemplate.sh
0 → 100755
View file @
0c8d43a0
if
[[
-f
.env
]]
;
then
echo
"Loading in '.env' for values ..."
export
$(
grep
-v
'^#'
.env | xargs
)
echo
" "
fi
VERSION
=
${
VERSION
:-
'6.1.1.0'
}
SCRIPTS_HOME
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&> /dev/null
&&
pwd
)
"
PROJECT_HOME
=
${
PROJECT_HOME
:-
'../'
}
PROJECT_HOME
=
$(
realpath
$PROJECT_HOME
)
myShaRona
()
{
myfile
=
$(
basename
$1
)
mydir
=
$(
dirname
$1
)
mkdir
-p
$mydir
if
[
!
-e
"
$mydir
/filelist.txt"
]
;
then
touch
"
$mydir
/filelist.txt"
fi
if
[[
"
$OSTYPE
"
==
"darwin"
*
]]
;
then
mySha
=
$(
shasum
-a
256
$1
|
cut
-d
" "
-f
1
)
else
mySha
=
$(
sha256sum
$1
|
cut
-d
" "
-f
1
)
fi
echo
-e
"
$myfile
|
$mySha
"
>>
$mydir
/filelist.txt
}
filelist
()
{
rm
-f
$1
/filelist.txt
for
filename
in
$1
/
*
;
do
myShaRona
$filename
done
}
if
[
$#
-eq
0
]
;
then
echo
"filelist.txt or dir path argument required "
exit
1
fi
# if there is not a filelist.txt, generate one
if
[
-f
"
$1
"
]
;
then
filefile
=
$(
realpath
$1
)
elif
[
-f
"
$1
/filelist.txt"
]
;
then
filefile
=
$(
realpath
$1
)
/filelist.txt
elif
[
-d
"
$1
"
]
;
then
filefile
=
$(
realpath
$1
)
/filelist.txt
fi
filelist
$1
basedir
=
$(
dirname
$filefile
)
cd
$basedir
if
[[
$filefile
==
*
"ironbank-files"
*
]]
;
then
urlPrefix
=
"https://ironbank-files.s3.amazonaws.com"
elif
[[
$filefile
==
*
"confluent"
*
]]
;
then
urlPrefix
=
"https://packages.confluent.io/rpm/
${
VERSION
:0:3
}
"
elif
[[
$filefile
==
*
"pythonhosted"
*
]]
;
then
echo
"unsupported cause of the weird guid in the path"
exit
0
fi
echo
"resources:"
>
$basedir
/hardened_manifest_template.yaml
while
IFS
=
read
-r
line
do
IFS
=
" | "
read
-a
parts
<<<
$line
cat
>>
$basedir
/hardened_manifest_template.yaml
<<
EOL
- filename:
${
parts
[0]
}
url:
${
urlPrefix
}
/
${
parts
[0]
}
validation:
type: sha256
value:
${
parts
[1]
}
EOL
done
<
"
$filefile
"
\ No newline at end of file
scripts/importArtifacts.sh
0 → 100755
View file @
0c8d43a0
#!/bin/bash
start
=
`
date
+%s
`
if
[[
-f
.env
]]
;
then
echo
"Loading in '.env' for values ..."
export
$(
grep
-v
'^#'
.env | xargs
)
echo
" "
fi
SCRIPTS_HOME
=
"
$(
cd
"
$(
dirname
"
${
BASH_SOURCE
[0]
}
"
)
"
&> /dev/null
&&
pwd
)
"
PROJECT_HOME
=
${
PROJECT_HOME
:-
'../'
}
PROJECT_HOME
=
$(
realpath
$PROJECT_HOME
)
RESOURCE_HOME
=
${
RESOURCE_HOME
:-
'../../resources'
}
RESOURCE_HOME
=
$(
realpath
$RESOURCE_HOME
)
importArtifacts
()
{
manifestPath
=
$1
httpdomain
=
$2
resourceDir
=
$3
echo
-e
"
\n
Importing
${
httpdomain
}
artifacts ..."
maniDir
=
$(
dirname
"
$manifestPath
"
)
if
[[
!
-f
"
$maniDir
/build-image.sh"
]]
;
then
cp
build-image.sh
$maniDir
/
fi
# (re)set the filelist.txt
mkdir
-p
$resourceDir
prefix
=
"url: "
pushd
$resourceDir
grep
$httpdomain
$manifestPath
|
while
read
-r
line
;
do
url
=
${
line
##*
$prefix
}
filename
=
$(
basename
"
$url
"
)
if
[[
!
-f
"
$filename
"
]]
;
then
echo
"downloading
${
url
}
..."
wget
$url
else
echo
"Using existing
$filename
. Run ./clean.sh if thats not desired."
fi
if
[[
!
-f
"
$maniDir
/
$filename
"
]]
;
then
echo
"copying
${
filename
}
into
${
maniDir
}
..."
cp
$filename
$maniDir
/
fi
done
popd
}
mani
=
$(
realpath
"../hardening_manifest.yaml"
)
importArtifacts
$mani
'ironbank-files.s3.amazonaws.com'
"
$RESOURCE_HOME
/ironbank-files"
importArtifacts
$mani
'packages.confluent.io'
"
$RESOURCE_HOME
/confluent"
importArtifacts
$mani
'files.pythonhosted.org'
"
$RESOURCE_HOME
/pythonhosted"
echo
"Generating hardening_manifest_template.yaml ..."
$SCRIPTS_HOME
/genManifestTemplate.sh
"
$RESOURCE_HOME
/ironbank-files"
$SCRIPTS_HOME
/genManifestTemplate.sh
"
$RESOURCE_HOME
/confluent"
$SCRIPTS_HOME
/genManifestTemplate.sh
"
$RESOURCE_HOME
/pythonhosted"
end
=
`
date
+%s
`
duration
=
$((
end-start
))
echo
"#########################"
echo
"All done (
${
duration
}
seconds)"
echo
"#########################"
Write
Preview
Markdown
is supported
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