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

Allow user to use local scripts and configuration files in lieu of generated when using openshift ocp.sh script. #8156

Merged
merged 9 commits into from
Jan 17, 2018

Conversation

JamesDrummond
Copy link
Contributor

@JamesDrummond JamesDrummond commented Jan 3, 2018

What does this PR do?

Allow user to local scripts and configuration files in lieu of generated by setting CHE_OPENSHIFT_GENERATE_SCRIPTS =false. Default will remain to generate scripts DEFAULT_CHE_OPENSHIFT_GENERATE_SCRIPTS =true.

What issues does this PR fix or reference?

NA

Release Notes

Allow user to use local scripts and configuration files in lieu of generated when using openshift ocp.sh script.

Signed-off-by: James Drummond james@devcomb.com

@JamesDrummond JamesDrummond added the kind/enhancement A feature request - must adhere to the feature request template. label Jan 3, 2018
@JamesDrummond JamesDrummond added this to the 6.0.0-M5 milestone Jan 3, 2018
@JamesDrummond JamesDrummond self-assigned this Jan 3, 2018
@codenvy-ci
Copy link

Can one of the admins verify this patch?

1 similar comment
@codenvy-ci
Copy link

Can one of the admins verify this patch?

@benoitf benoitf added the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Jan 3, 2018
…ted.

Signed-off-by: James Drummond <james@devcomb.com>
@JamesDrummond JamesDrummond changed the title Allow user to local scripts and configuration files in lieu of generated when using openshift ocp.sh script. Allow user to use local scripts and configuration files in lieu of generated when using openshift ocp.sh script. Jan 3, 2018
if [ $IMAGE_PULL_POLICY == "Always" ]; then
docker pull "$IMAGE_INIT"
fi
docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock -v "${CONFIG_DIR}":/data -e IMAGE_INIT="$IMAGE_INIT" -e CHE_MULTIUSER="$CHE_MULTIUSER" eclipse/che-cli:${CHE_IMAGE_TAG} destroy --quiet --skip:pull --skip:nightly
Copy link
Contributor

Choose a reason for hiding this comment

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

that is copy paste based on older version of script, please update it accordingly to the current state.
And personally, I don't like the idea of allowing to use local scripts which is error prone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't like the idea for people not developing che using but for me it is much easier to use local scripts versus generated.

Will make the change of the copy paste issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

there is a reason why we generate this, we can merge this but there should be some comments that this is errorprone and may not work as expected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added warning comments.

Signed-off-by: James Drummond <james@devcomb.com>
Signed-off-by: James Drummond <james@devcomb.com>
Copy link
Contributor

@riuvshin riuvshin left a comment

Choose a reason for hiding this comment

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

before merge please, test carefully single / multi user mode and deploying from scratch

@codenvy-ci
Copy link

Can one of the admins verify this patch?

@benoitf benoitf removed their request for review January 11, 2018 10:10
@JamesDrummond
Copy link
Contributor Author

@benoitf I need another approval before I can merge. Let me know if 2 approvals are still needed for each PR per eclipse policy.

@benoitf
Copy link
Contributor

benoitf commented Jan 11, 2018

@JamesDrummond well the PR has conflicting files

Signed-off-by: James Drummond <james@devcomb.com>
@JamesDrummond
Copy link
Contributor Author

@benoitf Reply beat my fix :)

@JamesDrummond
Copy link
Contributor Author

@benoitf @sleshchenko Can one of you review/approve?

@sleshchenko
Copy link
Member

sleshchenko commented Jan 15, 2018

I tried to use your changes from your branch, so I execute

export CHE_GENERATE_SCRIPTS="false"
./deploy_che.sh --deploy-che

And I got the following output. As you can see deploy_che.sh script is invoked twice. Do you get the same or I did something wrong?

OCP output
[serg@sleschenko scripts]$ ./ocp.sh --deploy-che
OCP using existing scripts in current folder.
            10100000                
        0110011001101101            
   01001001001001011011010110       

1100110101010001000001011101000001
0111001001111010111011111000111100010001
1110111011010111000001100000111001110
101010011001001001 10011101000
1011000101000 0
100101011 0110
10100001 11011111
111101111011 111011110001
10111001000110101 00000111111011111
0110111111011100000001011001010101111111
1101000001101001000010010111101011011011
00000001111001000001110111100000
000110101101000100011110
1101011100001001
000101

[CHE] Logging on using OpenShift endpoint "https://172.19.20.21:8443"...done!
[CHE] Checking if project "eclipse-che" exists...Project does not exist...creating it...done!
[CHE] Switching to "eclipse-che"...done!
[CHE] Setting admin role to "che" service account...rolebinding "che" created
[CHE] Retrieving latest version of fabric8 tenant Che template...done! (v.2.0.78)

[CHE] Deploying Che on ocp (image eclipse/che-server:nightly)
serviceaccount "che" created
service "che-host" created
persistentvolumeclaim "che-data-volume" created
persistentvolumeclaim "claim-che-workspace" created
deploymentconfig "che" created
route "che" created

[CHE] Che deployment has been successufully bootstrapped
[CHE] -> To check OpenShift deployment logs: 'oc get events -w'
[CHE] -> To check Che server logs: 'oc logs -f dc/che'
[CHE] -> Once the deployment is completed Che will be available at:
[CHE] http://che-eclipse-che.172.19.20.21.nip.io

rm: can't remove '/to_remove': Resource busy
WARN: Did detect TTY but not in interactive mode
INFO: (che cli): nightly - using docker 17.12.0-ce / native
WARN: (che init): 'nightly' installations cannot be upgraded to non-nightly versions
INFO: (che init): Installing configuration and bootstrap variables:
INFO: (che init): CHE_HOST=172.19.20.21
INFO: (che init): CHE_VERSION=nightly
INFO: (che init): CHE_CONFIG=/tmp/che-config
INFO: (che init): CHE_INSTANCE=/tmp/che-config/instance
INFO: (che config): Generating che configuration...
INFO: (che config): Customizing docker-compose for running in a container

            10100000                
        0110011001101101            
   01001001001001011011010110       

1100110101010001000001011101000001
0111001001111010111011111000111100010001
1110111011010111000001100000111001110
101010011001001001 10011101000
1011000101000 0
100101011 0110
10100001 11011111
111101111011 111011110001
10111001000110101 00000111111011111
0110111111011100000001011001010101111111
1101000001101001000010010111101011011011
00000001111001000001110111100000
000110101101000100011110
1101011100001001
000101

[CHE] Logging on using OpenShift endpoint "https://172.19.20.21:8443"...done!
[CHE] Checking if project "eclipse-che" exists...done!
[CHE] Switching to "eclipse-che"...done!
[CHE] Setting admin role to "che" service account...rolebinding "che" configured
[CHE] Retrieving latest version of fabric8 tenant Che template...done! (v.2.0.78)

[CHE] Deploying Che on ocp (image eclipse/che-server:nightly)
serviceaccount "che" configured
service "che-host" configured
persistentvolumeclaim "che-data-volume" configured
persistentvolumeclaim "claim-che-workspace" configured
deploymentconfig "che" configured
route "che" configured

[CHE] Che deployment has been successufully bootstrapped
[CHE] -> To check OpenShift deployment logs: 'oc get events -w'
[CHE] -> To check Che server logs: 'oc logs -f dc/che'
[CHE] -> Once the deployment is completed Che will be available at:
[CHE] http://che-eclipse-che.172.19.20.21.nip.io

[CHE] wait CHE pod booting...
[serg@sleschenko scripts]$ ^C

P.S. The same with CHE_GENERATE_SCRIPTS=true.

@JamesDrummond
Copy link
Contributor Author

JamesDrummond commented Jan 15, 2018

@sleshchenko Sorry it's my fault after I merged master changes from master didn't catch I had deploy part in there twice and out of generate script if statement. Fixed now.

#wipeout config folder
docker run -v "${CONFIG_DIR}":/to_remove alpine sh -c "rm -rf /to_remove/" || true
docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock -v "${CONFIG_DIR}":/data -e IMAGE_INIT="$IMAGE_INIT" -e CHE_MULTIUSER="$CHE_MULTIUSER" eclipse/che-cli:${CHE_IMAGE_TAG} config --skip:pull --skip:nightly
cd "${CONFIG_DIR}/instance/config/openshift/scripts/"
Copy link
Member

Choose a reason for hiding this comment

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

${CONFIG_DIR}/instance/config/openshift/scripts/ is used twice. Please consider moving it into a separated variable like OPENSHIFT_SCRIPTS_FOLDER

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added variable OPENSHIFT_SCRIPTS_FOLDER.

docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock -v "${CONFIG_DIR}":/data -e IMAGE_INIT="$IMAGE_INIT" -e CHE_MULTIUSER="$CHE_MULTIUSER" eclipse/che-cli:${CHE_IMAGE_TAG} config --skip:pull --skip:nightly
cd "${CONFIG_DIR}/instance/config/openshift/scripts/"
else
echo "OCP using existing scripts in current folder."
Copy link
Member

Choose a reason for hiding this comment

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

The previous message contains information about configuration files but this one doesn't. Should we add it here too?
To be sure that I understand configuration files correctly: is it about yaml files?

Copy link
Contributor

Choose a reason for hiding this comment

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

it is shell scripts and yaml files needed to deploy che multi user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added configuration files to second mesage.

docker run -t --rm -v /var/run/docker.sock:/var/run/docker.sock -v "${CONFIG_DIR}":/data -e IMAGE_INIT="$IMAGE_INIT" -e CHE_MULTIUSER="$CHE_MULTIUSER" eclipse/che-cli:${CHE_IMAGE_TAG} config --skip:pull --skip:nightly
cd "${CONFIG_DIR}/instance/config/openshift/scripts/"
else
echo "OCP using existing scripts in current folder."
Copy link
Contributor

Choose a reason for hiding this comment

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

it is shell scripts and yaml files needed to deploy che multi user

#Repull init image only if IMAGE_PULL_POLICY is set to Always
if [ $IMAGE_PULL_POLICY == "Always" ]; then
docker pull "$IMAGE_INIT"
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

 +      if [ $IMAGE_PULL_POLICY == "Always" ]; then
 +         docker pull "$IMAGE_INIT"
 +      fi

this must be moved out from if statement because it should be considered in both cases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved.

@JamesDrummond
Copy link
Contributor Author

@riuvshin @sleshchenko Updates complete. Please review.

…SCRIPTS

Signed-off-by: James Drummond <james@devcomb.com>
@JamesDrummond JamesDrummond merged commit 6636d7e into master Jan 17, 2018
@JamesDrummond JamesDrummond deleted the openshift_init_patch3 branch January 17, 2018 16:13
@benoitf benoitf removed the status/code-review This issue has a pull request posted for it and is awaiting code review completion by the community. label Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A feature request - must adhere to the feature request template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants