Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing: Deprecate Using the yegor256/rultor Docker Image #1045

Closed
wants to merge 12 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/main/resources/com/rultor/agents/daemons/end.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/usr/bin/env bash
#@todo #754:30min Remove the deprecation code from the shell.
# Move the code to Java. May be
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebing what stops you from moving it to Java in this PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mkordas May be the lack of my understanding of the project :)

  • in the class com.rultor.agents.daemons.EndsDaemon and com.rultor.agents.daemons.StartsDaemon I need the image. I cannot find the flow.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@original-brownbear can you propose some design solution here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebing @mkordas I don't think a design solution is even needed here fortunately :)
Look @sebing , just give this file a glance https://github.com/yegor256/rultor/blob/master/src/test/java/com/rultor/profiles/GithubProfileITCase.java.
It clearly shows how to extract the script section from the Profile, this should give you all you need to figure out the image on the Java end, shouldn't it ? :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@original-brownbear Now the next question :) Sorry for keep asking them. (May be the link give the guts to ask them.

I can create a profile image like the test you have given, and equate that. But how do I get the current profile?

How do i get the current Profile in com.rultor.agents.daemons.EndsDaemon?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebing why not just go by the xpath on the xml that is available in com.rultor.agents.daemons.EndsDaemon, no need for instantiating a Profile,
just work by analogy from the Profile logic and how it interprets the XML, other examples of how this looks are all over the codebase :)

# \main\java\com\rultor\agents\daemons\EndsDaemon.java is
# the place to implement this.

set -e

if [ ! -e pid ]; then
Expand All @@ -22,6 +27,8 @@ if docker ps -qa --no-trunc | grep --quiet "${cid}"; then
else
echo "container ${cid} is dead"
date
if $image = "yegor256/rultor"; then
deprecation
fi
exit 1
fi

25 changes: 25 additions & 0 deletions src/main/resources/com/rultor/agents/req/_head.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
#!/bin/sh

#@todo #754:30min Remove the deprecation code from the shell.
# Move the code to Java. May be
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebing you wrote "may be" but actually in puzzles we should be sure about the solution

# \main\java\com\rultor\agents\daemons\StartsDaemon.java is
# the place to implement this.

if $image = "yegor256/rultor"; then
deprecation
fi

mkdir -p ~/.ssh
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" > ~/.ssh/config
chmod 600 ~/.ssh/config
Expand Down Expand Up @@ -103,3 +112,19 @@ function docker_when_possible {
sudo chown -R $(whoami) repo
cd repo
}

function deprecation(){
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sebing this function doesn't return anything, do it should be named with verb

read -d '' text << EOF
#### Deprecation Notice #### \n
You are using the Rultor default Docker image in your build.
The Rultor has to:\n
1. Provide the sudo package/command and not stop doing so whenever
a change to the Dockerfile is made, even if Rultor itself does not
need the sudo command.\n
2. Not install any gems to the global scope that interfere with
pdd or est\n
#####################################\n
EOF

echo $text
}