You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kie.apache.org by js...@apache.org on 2023/12/08 07:26:35 UTC
(incubator-kie-kogito-pipelines) branch kie-issues_747 updated (7ced63bb -> 82d40997)
This is an automated email from the ASF dual-hosted git repository.
jstastnycz pushed a change to branch kie-issues_747
in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-pipelines.git
discard 7ced63bb prepare for pr
discard d704c9d9 fix build
discard 934af703 testing run of pipeline
discard 3b0c93f8 add util method waitForDocker
discard 92adc7b3 fix the bash commands
discard f0894bf1 switch default shell to bash
discard 87cd1a63 invoke wait-for-docker.sh explicitly
discard e0c76ab5 provide separate script wait-for-docker.sh
discard fe462534 just drop logs
discard b93d69a2 kie-issues#747: adjust kogito-ci-build image to remove jenkins consistency error
new 82d40997 kie-issues#747: tweak CI image docker startup
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (7ced63bb)
\
N -- N -- N refs/heads/kie-issues_747 (82d40997)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.ci/jenkins/Jenkinsfile.build-kogito-ci-image | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org
(incubator-kie-kogito-pipelines) 01/01: kie-issues#747: tweak CI image docker startup
Posted by js...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
jstastnycz pushed a commit to branch kie-issues_747
in repository https://gitbox.apache.org/repos/asf/incubator-kie-kogito-pipelines.git
commit 82d409975a06fa296c1766a6856eff168c7a60a1
Author: jstastny-cz <ja...@ibm.com>
AuthorDate: Wed Dec 6 19:30:43 2023 +0100
kie-issues#747: tweak CI image docker startup
---
.ci/jenkins/Jenkinsfile.build-kogito-ci-image | 7 ++++++-
apache-nodes/Dockerfile.kogito-ci-build | 13 +++++++++++--
apache-nodes/entrypoint.sh | 8 +++++---
apache-nodes/start-docker.sh | 20 ++------------------
apache-nodes/wait-for-docker.sh | 4 ++++
.../{start-docker.sh => wait-for-process.sh} | 18 +++---------------
dsl/scripts/pr_check.groovy | 5 +++--
dsl/seed/jenkinsfiles/Jenkinsfile.buildchain | 1 +
jenkins-pipeline-shared-libraries/vars/util.groovy | 7 +++++++
9 files changed, 42 insertions(+), 41 deletions(-)
diff --git a/.ci/jenkins/Jenkinsfile.build-kogito-ci-image b/.ci/jenkins/Jenkinsfile.build-kogito-ci-image
index c86ec42a..2c1a2f9c 100644
--- a/.ci/jenkins/Jenkinsfile.build-kogito-ci-image
+++ b/.ci/jenkins/Jenkinsfile.build-kogito-ci-image
@@ -1,6 +1,6 @@
import org.jenkinsci.plugins.workflow.libs.Library
-@Library('jenkins-pipeline-shared-libraries')_
+@Library("jenkins-pipeline-shared-libraries@${BRANCH_NAME}")_
pipeline {
agent {
@@ -65,8 +65,13 @@ pipeline {
}
}
steps {
+ echo 'Init docker'
+ script {
+ util.waitForDocker()
+ }
echo 'Debug basics'
sh '''
+ sh --version
locale
printenv
'''
diff --git a/apache-nodes/Dockerfile.kogito-ci-build b/apache-nodes/Dockerfile.kogito-ci-build
index fbe793b7..cf9eddd0 100644
--- a/apache-nodes/Dockerfile.kogito-ci-build
+++ b/apache-nodes/Dockerfile.kogito-ci-build
@@ -157,10 +157,19 @@ ENV CONTAINER_ENGINE_TLS_OPTIONS=""
WORKDIR /project/directory
USER root
-COPY start-docker.sh entrypoint.sh /usr/local/bin/
+COPY start-docker.sh wait-for-docker.sh wait-for-process.sh entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/start-docker.sh \
- /usr/local/bin/entrypoint.sh
+ /usr/local/bin/entrypoint.sh \
+ /usr/local/bin/wait-for-docker.sh \
+ /usr/local/bin/wait-for-process.sh
USER nonrootuser
+RUN echo "source wait-for-docker.sh" >> ~/.bashrc
+
+# Use bash as default instead of dash (BEGIN)
+RUN sudo bash -c "echo \"dash dash/sh boolean false\" | debconf-set-selections"
+RUN sudo bash -c "DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash"
+# Use bash as default instead of dash (END)
+
ENTRYPOINT ["entrypoint.sh"]
CMD ["bash"]
diff --git a/apache-nodes/entrypoint.sh b/apache-nodes/entrypoint.sh
index a1247741..61d79e22 100755
--- a/apache-nodes/entrypoint.sh
+++ b/apache-nodes/entrypoint.sh
@@ -1,11 +1,9 @@
#!/bin/bash
set -e
-# Start docker
-start-docker.sh
# cgroup v2: enable nesting
if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
- echo "in cgroupv2 branch"
+ echo "in cgroupv2 branch"
# move the processes from the root group to the /init group,
# otherwise writing subtree_control fails with EBUSY.
# An error during moving non-existent process (i.e., "cat") is ignored.
@@ -15,6 +13,10 @@ if [ -f /sys/fs/cgroup/cgroup.controllers ]; then
sudo bash -c "sed -e 's/ / +/g' -e 's/^/+/' < /sys/fs/cgroup/cgroup.controllers > /sys/fs/cgroup/cgroup.subtree_control"
fi
+# Start docker and print logs
+start-docker.sh
+
+# process the command passed, after docker is started
if [ $# -gt 0 ]; then
exec "$@"
fi
\ No newline at end of file
diff --git a/apache-nodes/start-docker.sh b/apache-nodes/start-docker.sh
index bebdf338..9b1422d9 100755
--- a/apache-nodes/start-docker.sh
+++ b/apache-nodes/start-docker.sh
@@ -1,31 +1,15 @@
#!/bin/bash
source /opt/bash-utils/logger.sh
-function wait_for_process () {
- local max_time_wait=30
- local process_name="$1"
- local waited_sec=0
- while ! pgrep "$process_name" >/dev/null && ((waited_sec < max_time_wait)); do
- INFO "Process $process_name is not running yet. Retrying in 1 seconds"
- INFO "Waited $waited_sec seconds of $max_time_wait seconds"
- sleep 1
- ((waited_sec=waited_sec+1))
- if ((waited_sec >= max_time_wait)); then
- return 1
- fi
- done
- sudo chown root:docker /var/run/docker.sock
- return 0
-}
-
INFO "Starting supervisor"
sudo bash -c "/usr/bin/supervisord >> /dev/null 2>&1" &
INFO "Waiting for docker to be running"
-wait_for_process dockerd
+source wait-for-docker.sh
if [ $? -ne 0 ]; then
ERROR "dockerd is not running after max time"
exit 1
else
+ sudo chown root:docker /var/run/docker.sock
INFO "dockerd is running"
fi
\ No newline at end of file
diff --git a/apache-nodes/wait-for-docker.sh b/apache-nodes/wait-for-docker.sh
new file mode 100644
index 00000000..ee636f9c
--- /dev/null
+++ b/apache-nodes/wait-for-docker.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+source wait-for-process.sh
+
+wait_for_process dockerd
\ No newline at end of file
diff --git a/apache-nodes/start-docker.sh b/apache-nodes/wait-for-process.sh
old mode 100755
new mode 100644
similarity index 62%
copy from apache-nodes/start-docker.sh
copy to apache-nodes/wait-for-process.sh
index bebdf338..9cfc0a8d
--- a/apache-nodes/start-docker.sh
+++ b/apache-nodes/wait-for-process.sh
@@ -1,6 +1,6 @@
#!/bin/bash
source /opt/bash-utils/logger.sh
-
+set -e
function wait_for_process () {
local max_time_wait=30
local process_name="$1"
@@ -14,18 +14,6 @@ function wait_for_process () {
return 1
fi
done
- sudo chown root:docker /var/run/docker.sock
+ INFO "Process $process_name successfully started."
return 0
-}
-
-INFO "Starting supervisor"
-sudo bash -c "/usr/bin/supervisord >> /dev/null 2>&1" &
-
-INFO "Waiting for docker to be running"
-wait_for_process dockerd
-if [ $? -ne 0 ]; then
- ERROR "dockerd is not running after max time"
- exit 1
-else
- INFO "dockerd is running"
-fi
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/dsl/scripts/pr_check.groovy b/dsl/scripts/pr_check.groovy
index 59b5ec6b..49ab0fef 100644
--- a/dsl/scripts/pr_check.groovy
+++ b/dsl/scripts/pr_check.groovy
@@ -40,8 +40,9 @@ void launch() {
void launchInDocker(String builderImage) {
docker.image(builderImage).inside(dockerArgs.join(' ')) {
- // Debug. To be removed in the future
- sh "printenv"
+ sh 'printenv > env_props'
+ archiveArtifacts artifacts: 'env_props'
+ util.waitForDocker()
sh 'ls -last /var/run/docker.sock'
try {
launchStages()
diff --git a/dsl/seed/jenkinsfiles/Jenkinsfile.buildchain b/dsl/seed/jenkinsfiles/Jenkinsfile.buildchain
index d0a7e9db..912a3e68 100644
--- a/dsl/seed/jenkinsfiles/Jenkinsfile.buildchain
+++ b/dsl/seed/jenkinsfiles/Jenkinsfile.buildchain
@@ -62,6 +62,7 @@ pipeline {
script {
sh 'printenv > env_props'
archiveArtifacts artifacts: 'env_props'
+ util.waitForDocker()
sh 'ls -last /var/run/docker.sock'
if (mavenDeployArtifacts) {
diff --git a/jenkins-pipeline-shared-libraries/vars/util.groovy b/jenkins-pipeline-shared-libraries/vars/util.groovy
index 30e00587..ea5af6a9 100644
--- a/jenkins-pipeline-shared-libraries/vars/util.groovy
+++ b/jenkins-pipeline-shared-libraries/vars/util.groovy
@@ -547,3 +547,10 @@ String displayDurationFromSeconds(int durationInSec) {
result += "${seconds}s"
return result
}
+
+/**
+ * Method to wait for dockerd to be started. Put in initial pipeline stages to make sure all starts in time.
+ */
+void waitForDocker() {
+ sh 'wait-for-docker.sh' // script in kogito-ci-build image itself put in /usr/local/bin
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@kie.apache.org
For additional commands, e-mail: commits-help@kie.apache.org