Skip to content

Commit

Permalink
Cleanup #69
Browse files Browse the repository at this point in the history
* remove osweek branches from workflow files
* fix typos
* explicitly use python3
  • Loading branch information
jfaltermeier committed Nov 27, 2023
1 parent 81269b9 commit 276f7df
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 21 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker-landing-page.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Docker landing Page CI
name: Docker Landing Page CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main, osweek23 ]
branches: [ main ]

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main, osweek23 ]
branches: [ main ]

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-try-now-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main, osweek23 ]
branches: [ main ]

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-wondershaper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main, osweek23 ]
branches: [ main ]

jobs:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/service-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main, osweek23 ]
branches: [ main ]

jobs:

Expand Down
2 changes: 1 addition & 1 deletion doc/docs/Building-Internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ docker build --no-cache -t theiacloud/theia-cloud-operator:latest -f dockerfiles
docker push theiacloud/theia-cloud-operator:latest
```

Build and pish the git-init container:
Build and push the git-init container:

```bash
docker build -t theiacloud/theia-cloud-git-init:latest -f dockerfiles/git-init/Dockerfile .
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/git-init/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM debian:11-slim

RUN apt update && \
apt install python git -y && \
apt install python3 git -y && \
apt clean && \
mkdir /user && \
chmod 777 /user && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public List<String> getEnvVarsFromSecrets() {
return envVarsFromSecrets;
}

public List<InitOperation> getinitOperations() {
public List<InitOperation> getInitOperations() {
return initOperations;
}

Expand Down Expand Up @@ -279,10 +279,9 @@ public boolean equals(Object obj) {
@Override
public String toString() {
return "SessionSpec [name=" + name + ", appDefinition=" + appDefinition + ", user=" + user + ", url=" + url
+ ", error=" + error + ", workspace=" + workspace + ", lastActivity=" + lastActivity
+ ", sessionSecret=" + sessionSecret + ", envVars=" + envVars + ", envVarsFromConfigMaps="
+ envVarsFromConfigMaps + ", envVarsFromSecrets=" + envVarsFromSecrets + ", initOperations="
+ initOperations + "]";
+ ", error=" + error + ", workspace=" + workspace + ", lastActivity=" + lastActivity + ", envVars="
+ envVars + ", envVarsFromConfigMaps=" + envVarsFromConfigMaps + ", envVarsFromSecrets="
+ envVarsFromSecrets + ", initOperations=" + initOperations + "]";
}

public static boolean isEphemeral(String workspace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ private static Optional<Integer> findContainerIdxInDeployment(Deployment deploym

public static void addInitContainers(String correlationId, TheiaCloudClient client, Deployment deployment,
AppDefinition appDefinition, Session session, Set<InitOperationHandler> initOperationHandlers) {
List<InitOperation> initOperations = session.getSpec().getinitOperations();
List<InitOperation> initOperations = session.getSpec().getInitOperations();
if (initOperations == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public class GitInitOperationHandler implements InitOperationHandler {
protected static final String IMAGE_ENV_KEY = "GIT_INIT_OPERATION_IMAGE";
protected static final String DEFAULT_IMAGE = "theiacloud/theia-cloud-git-init:latest";
protected static final String ID = "git";
protected static final String INIT_CONTAINER_NAME = "git-init";

private static final Logger LOGGER = LogManager.getLogger(GitInitOperationHandler.class);

Expand Down Expand Up @@ -93,7 +94,7 @@ public void addInitContainer(String correlationId, TheiaCloudClient client, Depl
Container gitInitContainer = new Container();
initContainers.add(gitInitContainer);

gitInitContainer.setName("git-init");
gitInitContainer.setName(INIT_CONTAINER_NAME);
gitInitContainer.setImage(getImage());
String repository = args.get(0);
String branch = args.get(1);
Expand Down
34 changes: 31 additions & 3 deletions python/git-init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,18 @@ docker build -t theiacloud/theia-cloud-git-init:local -f dockerfiles/git-init/Do
```bash
# don't save in ~/.ssh/... but e.g. in ~/tmp/ssh/id_theiacloud
ssh-keygen -t ed25519 -C "Test TC Git Init SSH Keypair"

# check if key is added already
ssh-add -L

# add the key if necessary
ssh-add ~/tmp/ssh/id_theiacloud
```

### Test Checkout with container

Please also play with wrong password or public SSH Keys that are not (yet) added to the repository to get the known error cases.

```bash
# Adjust URLs and Password/PATs below
# keep spaces in front to avoid command being added to bash history
Expand All @@ -43,6 +51,7 @@ ssh-keygen -t ed25519 -C "Test TC Git Init SSH Keypair"
# HTTPS Public
docker run --rm theiacloud/theia-cloud-git-init:local "$HTTP_PUBLIC" "/tmp/my-repo" "$BRANCH"

# For HTTPS auth with PATs as password a lot of providers accept any username
# HTTPS Private
docker run --env GIT_PROMPT1=$HTTP_USERNAME --env GIT_PROMPT2=$HTTP_PASSWORD --rm theiacloud/theia-cloud-git-init:local "$HTTP_PRIVATE" "/tmp/my-repo" "$BRANCH"

Expand All @@ -52,12 +61,31 @@ docker run --env GIT_PROMPT1=$HTTP_PASSWORD --rm theiacloud/theia-cloud-git-init
# HTTPS Private with Username and Password
docker run --rm theiacloud/theia-cloud-git-init:local "$HTTP_PRIVATE_WITH_USERNAME_AND_PASSWORD" "/tmp/my-repo" "$BRANCH"

# SSH
# SSH (the expected keyname is id_theiacloud ! With a different naming pattern this command will fail. Rename/Create a copy of you keyname if necessary)
docker run --env GIT_PROMPT1=$SSH_PASSWORD -v ~/tmp/ssh/:/etc/theia-cloud-ssh --rm theiacloud/theia-cloud-git-init:local "$SSH_REPO" "/tmp/my-repo" "$BRANCH"
```

### Create Kubernetes Resources

#### Workspace

If testing on Minikube also mount a directory with expected user permissions: `minikube mount --uid 101 --gid 101 ~/tmp/minikube:/tmp/hostpath-provisioner/theia-cloud`

You might have to adjust your firewall (temporarily).

With below Sessions, the Workspace will be mounted inside the `persisted` subdirectory in the workspace.

```yaml
apiVersion: theia.cloud/v3beta
kind: Workspace
metadata:
name: ws-asdfghjkl-theia-cloud-demo-foo-theia-cloud-io
namespace: theiacloud
spec:
name: ws-asdfghjkl-theia-cloud-demo-foo-theia-cloud-io
user: [email protected]
```
#### Secret for HTTP(S) auth
```yaml
Expand All @@ -79,7 +107,7 @@ stringData:
#### Example Session for HTTP(S) auth
```yaml
apiVersion: theia.cloud/v5beta
apiVersion: theia.cloud/v7beta
kind: Session
metadata:
name: ws-asdfghjkl-theia-cloud-demo-foo-theia-cloud-io-session
Expand Down Expand Up @@ -124,7 +152,7 @@ stringData:
#### Example Session for SSH auth
```yaml
apiVersion: theia.cloud/v5beta
apiVersion: theia.cloud/v7beta
kind: Session
metadata:
name: ws-asdfghjkl-theia-cloud-demo-foo-theia-cloud-io-session
Expand Down
2 changes: 1 addition & 1 deletion python/git-init/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ touch $HOME/.ssh/known_hosts
[ -e /etc/theia-cloud-ssh/id_theiacloud ] && { sleep 1; echo $GIT_PROMPT1; } | script -q /dev/null -c 'ssh-add /etc/theia-cloud-ssh/id_theiacloud'

# hand over to clone script
python git-init.py "$@"
python3 git-init.py "$@"
2 changes: 1 addition & 1 deletion python/git-init/git-askpw.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import os

path = "/tmp/theia-cloud-askpw"
Expand Down
2 changes: 1 addition & 1 deletion python/git-init/git-init.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import argparse
import subprocess
Expand Down

0 comments on commit 276f7df

Please sign in to comment.