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

Instructions for Developers using IDE #13

Open
rosiel opened this issue Aug 11, 2023 · 10 comments
Open

Instructions for Developers using IDE #13

rosiel opened this issue Aug 11, 2023 · 10 comments

Comments

@rosiel
Copy link
Contributor

rosiel commented Aug 11, 2023

I just a lot of time developing code on my feature branch in the IDE, only to realize that I don't know how to get my changes out of docker and back into Github.

What I did:

  • specified that I wanted a feature branch in composer.json

What should I have done:
???

@DonRichards
Copy link
Member

DonRichards commented Aug 16, 2023

What I have done in the past and how I test PRs is changing the composer.json file and adding this. Just like a "vcs" but with type git you can specify the branch name as a "reference". This can also be a git tag value.

        {
            "type": "package",
            "package": {
                "name": "citation-style-language/styles-distribution",
                "version":"1.0.0",
                "source": {
                    "type": "git",
                    "url": "https://github.com/citation-style-language/styles-distribution.git",
                    "reference": "master"
                }
            }
        },

https://github.com/jhu-idc/idc-isle-dc/blob/development/codebase/composer.json#L82-L93

@rosiel
Copy link
Contributor Author

rosiel commented Aug 17, 2023

Sorry I think I miscommunicated.

I was successful at checking out the feature branch of my code (though not with git history). My question is:

  • how do i get my desired branch as a git repo? (if that case, how do i set up my git credentials to automatically be used inside the ide/containers, because I scrap and bring up these dev instances all the time)
  • Or, how do i get the code out of the ide/containers and into a git repo I have (i.e. how do I scp)?

@rosiel
Copy link
Contributor Author

rosiel commented Aug 23, 2023

from the Tech call, someone (won't say who) mentioned that to do it in the IDE, rm -rf the repo and git clone it. Then, you still have the issue of your github keys...

Annie mentioned that theres a command to copy files out of docker, which could work instead!

@nigelgbanks
Copy link
Contributor

There are two docker-compose.yml files specific for OSX and Linux that allow the mounting of the SSH agent socket into the ide docker container.

The setup script detects the host OS and copies the appropriate file.

isle-site-template/setup.sh

Lines 124 to 128 in a4e7021

function create_docker_compose_override {
if [[ "${IS_WSL}" == "false" ]]; then
cp "docker-compose.${OS}.yml" docker-compose.override.yml
fi
}

This should allow you to use your GitHub SSH key, assuming you added it to your SSH-Agent.

@nigelgbanks
Copy link
Contributor

nigelgbanks commented Oct 6, 2023

Sorry I think I miscommunicated.

I was successful at checking out the feature branch of my code (though not with git history). My question is:

  • how do i get my desired branch as a git repo? (if that case, how do i set up my git credentials to automatically be used inside the ide/containers, because I scrap and bring up these dev instances all the time)
  • Or, how do i get the code out of the ide/containers and into a git repo I have (i.e. how do I scp)?

Composer is capable of doing this: https://getcomposer.org/doc/05-repositories.md#loading-a-package-from-a-vcs-repository.

Alternatively, you can bind mount a local repository into the container.

https://docs.docker.com/storage/bind-mounts/

This is how the configuration changes get persisted to the host machine's hard disk.

@nigelgbanks
Copy link
Contributor

nigelgbanks commented Oct 6, 2023

Also, I should say there really isn't a reason to get things out of Docker. You can just work inside the container as if it were a VM, and use git inside of it.

The only concern is that you could accidentally destroy the container with your changes inside of it. If that is a concern for you, then I would suggest bind mounts.

@rosiel
Copy link
Contributor Author

rosiel commented Oct 23, 2023

@nigelgbanks
|This should allow you to use your GitHub SSH key, assuming you added it to your SSH-Agent.

Git works fine on my mac.

But it doesn't in the IDE.

First, every time I restart the docker containers i have to tell it my email and name.

And when i was ready to push to github, it gave me a popup with a one-time code that i was supposed to navigate to Github and paste in. There was no place to paste it in on Github. When I clicked the "Copy and navigate to Github" button, It did not take me to github (i.e. nothing appeared to happen).

Then the IDE froze after 5 minutes and needed to be restarted. #22

Then, after refreshing the browser, git push commands hang and nothing appears to happen.

@nigelgbanks
Copy link
Contributor

You'll need to use ssh to connect with GitHub rather than https to have your credentials saved (https://docs.github.com/en/authentication/connecting-to-github-with-ssh). I'm not sure how you are using Git on your Mac, if your are not using ssh you would need to re-enter your password every time. Unless you're using some desktop or GUI application or some other 3rd party helper, I'm not familiar with.

@nigelgbanks
Copy link
Contributor

I've just tested and this is indeed broken in the latest Docker for Mac though: docker/for-mac#7204

@nigelgbanks
Copy link
Contributor

Hmm, I really don't like the workarounds for this issue... might be that we just recommend folks mount their ~/.ssh directory, and we run a separate ssh-agent inside the IDE. They would have to enter their password again, and every time they restart the container... Things are so much easier on Linux...

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

No branches or pull requests

3 participants