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

Fixes #26411 - Inline bastion as an engine #8032

Merged
merged 2 commits into from Mar 29, 2019

Conversation

jlsherrill
Copy link
Member

No description provided.

@theforeman-bot
Copy link

Issues: #26411

@jlsherrill
Copy link
Member Author

First commit pulls in bastion as is in katello/bastion master, second commit adapts it to an engine.

@jlsherrill
Copy link
Member Author

[test katello]

@jlsherrill
Copy link
Member Author

@waldenraines @johnpmitsch one thing that @ehelms brought when chatting about this PR, is if we want to do a gitsubtree to try to preserve all the history, or just merge it as it is (all in one commit). Curious your thoughts

@jlsherrill
Copy link
Member Author

jlsherrill commented Mar 27, 2019

Here's a todo list:

  • fix/update rake bastion:ci and rake bastion:setup
  • after merge, update infrastructure to use new rake bastion:ci/setup

My current thinking is to modify it so that:

rake bastion:setup
rake bastion:ci

sets up and runs tests for 'bastion', while:

rake bastion:katello:setup
rake bastion:katello:ci

does this for bastion_katello. Thoughts?

@jlsherrill jlsherrill marked this pull request as ready for review March 27, 2019 02:04
@johnpmitsch
Copy link
Contributor

@waldenraines @johnpmitsch one thing that @ehelms brought when chatting about this PR, is if we want to do a gitsubtree to try to preserve all the history, or just merge it as it is (all in one commit). Curious your thoughts

I don't have much experience with git sub-modules or sub-trees so its hard for me to say. My initial thoughts are if it introduces more complexity we should just merge it as is. I imagine the bastion repo will still be around (but defunct) and that will still have the original commit history? But maybe I don't see the benefits, would the submodule be beneficial for packaging reasons?

rake bastion:katello:setup
rake bastion:katello:ci
does this for bastion_katello. Thoughts?

Having these as rake tasks always felt odd to me. Can we consider adding the grunt tasks to package.json as npm scripts? We could additionally add one npm command to do all javascript (both react and angular) testing too. I think it would be another step towards modernizing and unifying this part of the code with the react code. Just a thought, I'm not opposed to the rake task syntax either.

@jlsherrill
Copy link
Member Author

I don't have much experience with git sub-modules or sub-trees so its hard for me to say. My initial thoughts are if it introduces more complexity we should just merge it as is. I imagine the bastion repo will still be around (but defunct) and that will still have the original commit history? But maybe I don't see the benefits, would the submodule be beneficial for packaging reasons?

It would just be for preserving history. Imagine importing all of bastion and its ~1500 commits directly into katello within a subdirectory. The only thing we gain is commit history, but we'd be adding ~1500 commits to the tree. The files on the file system of master would end up looking exactly the same.

Having these as rake tasks always felt odd to me. Can we consider adding the grunt tasks to package.json as npm scripts? We could additionally add one npm command to do all javascript (both react and angular) testing too. I think it would be another step towards modernizing and unifying this part of the code with the react code. Just a thought, I'm not opposed to the rake task syntax either.

That sounds reasonable, can you provide any pointers on how to do that? I'm happy to look into it.

@johnpmitsch
Copy link
Contributor

That sounds reasonable, can you provide any pointers on how to do that? I'm happy to look into it.

sure thing, you would want to replicate the commands in Bastion's Rakefile in the script section in Katello's package.json

This is what I'm thinking:

{
  "bastionTests: "cd ./bastion && grunt ci",
  "bastionSetup": "cd ./bastion && ./setup_npm",
  "allJavascriptTests: "npm run bastionSetup && npm run bastionTests && npm test" // maybe have another one with no setup
}

Then add a setup npm script as executable ./setup_npm in bastion folder that performs these steps, you could keep it as ruby or just do a bash script

@johnpmitsch
Copy link
Contributor

It would just be for preserving history. Imagine importing all of bastion and its ~1500 commits directly into katello within a subdirectory. The only thing we gain is commit history, but we'd be adding ~1500 commits to the tree. The files on the file system of master would end up looking exactly the same.

I get the general concept, I'm just failing to see the benefit. The commits would be preserved on the original Bastion repo assuming we are keeping it around, so if people want the commits for professional reasons, they are still there. It seems like more complexity for no clear reason but I'm open to being persuaded otherwise! :)

@jlsherrill
Copy link
Member Author

@johnpmitsch thats the way i was leaning as well, just wanted to open it up for discussion. Thanks!

@waldenraines
Copy link
Contributor

Here's a todo list:

  • fix/update rake bastion:ci and rake bastion:setup
  • after merge, update infrastructure to use new rake bastion:ci/setup

My current thinking is to modify it so that:

rake bastion:setup
rake bastion:ci

sets up and runs tests for 'bastion', while:

rake bastion:katello:setup
rake bastion:katello:ci

does this for bastion_katello. Thoughts?

Having these as rake tasks always felt odd to me. Can we consider adding the grunt tasks to package.json as npm scripts? We could additionally add one npm command to do all javascript (both react and angular) testing too. I think it would be another step towards modernizing and unifying this part of the code with the react code. Just a thought, I'm not opposed to the rake task syntax either.

I agree with this and we could take it a step further to replace bower entirely with a package.json and npm scripts if we ended up moving bastion into webpack.

For now I think we should do whatever is easiest to maintain functionality although I would also argue that the actual rake tasks themselves could go away.

@waldenraines @johnpmitsch one thing that @ehelms brought when chatting about this PR, is if we want to do a gitsubtree to try to preserve all the history, or just merge it as it is (all in one commit). Curious your thoughts

I personally don't care about the history. Half of the history is "Bump bastion to version x" anyway. If we ever need the history we can check out the old repo and look at it there or on github.

@ehelms
Copy link
Member

ehelms commented Mar 28, 2019

The difference with preserving commits is the use of tools like git log or tig or blame to trace the history within the git repository itself. The original repository can be explored, it will just be more work for developers. Just adding some color.

@ehelms
Copy link
Member

ehelms commented Mar 28, 2019

I played around and I think we can keep things as is, simplify and fix the CI setup with:

diff --git a/engines/bastion_katello/package.json b/engines/bastion_katello/package.json
index e732431..ba649fe 100644
--- a/engines/bastion_katello/package.json
+++ b/engines/bastion_katello/package.json
@@ -1,4 +1,7 @@
 {
   "name": "bastion_katello",
-  "version": "1.0.0"
+  "version": "1.0.0",
+  "dependencies": {
+    "bastion": "file:../bastion"
+  }
 }

And this PR for infra -- theforeman/foreman-infra#1006
The infra PR can be merged ahead of time as the changes will be needed not just for testing this PR but to ensure the PR test job is backwards compatible.

I'd also ask for the following preparation PRs to have:

  1. PR to bastion that deprecates the repository via a README update
  2. PR to foreman-packaging that removes Bastion plugin and updates Katello's spec file

@jlsherrill
Copy link
Member Author

@ehelms i like this as it makes things simple and you've done part of the work :)

let me work on those things, thanks!

@ehelms
Copy link
Member

ehelms commented Mar 28, 2019 via email

@jlsherrill
Copy link
Member Author

@waldenraines
Copy link
Contributor

I forgot to mention you can then just drop those Rakefiles.

I guess we'd also want to update the developer documentation if we're no longer going to support rake bastion:setup. Also, we should pull this documentation into katello's setup documentation too I guess.

@ehelms
Copy link
Member

ehelms commented Mar 28, 2019

[test katello]

@jlsherrill jlsherrill changed the title [WIP] Fixes #26411 - Inline bastion as an engine Fixes #26411 - Inline bastion as an engine Mar 28, 2019
@@ -188,13 +188,13 @@ Open the file, and add the following lines (with empty lines above and below for
To setup a development environment, clone the repository or your fork of the repository. From the git checkout, setup the required development dependencies by running:

```
rake bastion:setup
npm install
Copy link
Contributor

Choose a reason for hiding this comment

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

Does only npm install work to setup everything?

Copy link
Member Author

Choose a reason for hiding this comment

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

looking at theforeman/foreman-packaging#3559

it looks like it does, except for this step:
sh "cp -rf \$(cat foreman/bastion-version) engines/bastion_katello/bastion-${bastion_version}"
@ehelms would it make sense to just create a symlink there so we don't have to do that step?

Copy link
Contributor

Choose a reason for hiding this comment

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

I only ask because it looks like more steps, but not sure if they are redundant. I can test it out soon too

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh and one more step here: "npm install bastion-${bastion_version}". Which i'll add to the docs

Copy link
Member Author

Choose a reason for hiding this comment

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

@ehelms could this be replaced with just 'npm install ../bastion' ?

Copy link
Member Author

Choose a reason for hiding this comment

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

i pushed some updated docs, and added simple instructions to ./engines/katello_bastin/README.mc

Copy link
Contributor

Choose a reason for hiding this comment

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

Does only npm install work to setup everything?

I suppose that I forgot we commit all vendor files to source control so there is no need to run bower unless you're updating a dependency.

It should be possible to remove bower entirely since we aren't really updating dependencies that often and replace it with npm and webpack in a later PR.

```

After making changes, tests and linting can be run via:

```
rake bastion:ci
grunt ci
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you plan on adding these to Katello's package.json?

Copy link
Member Author

Choose a reason for hiding this comment

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

after @ehelm's suggestion, i decided to not do that (sorry should have mentioned that here). I'd rather get this in quickly and then we can adjust if desired. Does that sound okay?

Copy link
Contributor

Choose a reason for hiding this comment

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

no worries, gotta draw the line somewhere :) I guess there is a difference between testing bastion and bastion_katello and I'm forgetting this too!

I'll try to do a follow up PR adding these to package.json, maybe we could have a single npm run ci command to run everything we expect jenkins to do as well.

Copy link
Member

Choose a reason for hiding this comment

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

Just be cautious given they both have their own package.json with dependencies and pathing configured based on their relative locations. Mixing these with the base katello dependencies and scripts might be more more mashing together than you necessarily want. If anything, I'd think you'd be better off investing in dropping all of the Grunt infrastructure in favor of native scripts (but even that may not be worth the time if the webpack/React is the future).

Copy link
Member

@ehelms ehelms left a comment

Choose a reason for hiding this comment

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

I can't see any other issues and CI is happy.

Copy link
Contributor

@waldenraines waldenraines left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@johnpmitsch johnpmitsch left a comment

Choose a reason for hiding this comment

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

Great change!

@jlsherrill jlsherrill merged commit 5c1a0d0 into Katello:master Mar 29, 2019
@jlsherrill jlsherrill deleted the bastion_rm_1 branch March 29, 2019 13:44
@tbrisker
Copy link
Member

We're now getting a cyclic failure when trying to build the katello rpm, could it be related to this change?
http://koji.katello.org/kojifiles/work/tasks/6423/186423/build.log

@jlsherrill
Copy link
Member Author

attempting to handle this here: theforeman/foreman-packaging#3559

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants