Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
Signed-off-by: dciangot <[email protected]>
  • Loading branch information
dciangot committed Sep 16, 2024
1 parent b620fb6 commit cebb54d
Show file tree
Hide file tree
Showing 30 changed files with 35 additions and 1,019 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ jobs:
uses: actions/checkout@v4
- name: Run plugin
run: |
wget https://github.com/interTwin-eu/interlink-docker-plugin/releases/download/0.0.24-no-gpu/docker-plugin_Linux_x86_64 -O docker-plugin \
&& chmod +x docker-plugin \
&& docker ps \
&& export INTERLINKCONFIGPATH=$PWD/ci/manifests/plugin-config.yaml \
&& ./docker-plugin &
git clone https://github.com/interTwin-eu/interlink-slurm-plugin.git \
&& cd interlink-slurm-plugin/docker \
&& docker compose up -d
- name: Get Repo Owner
id: get_repo_owner
run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')
Expand All @@ -27,7 +25,7 @@ jobs:
with:
workdir: ci
verb: call
args: -s --name my-test build-images new-interlink --plugin-endpoint tcp://localhost:4000 test stdout
args: -s --name slurm-test build-images new-interlink --plugin-endpoint tcp://localhost:4000 test stdout
cloud-token: ${{ secrets.DAGGER_CLOUD_TOKEN }}
version: "0.13.0"
#dagger-flags: -d
1 change: 1 addition & 0 deletions ci/dagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
"source": "github.com/marcosnils/daggerverse/k3s@ce8fe35d309bdb29f9983f7d90ea518e724534fe"
}
],
"source": ".",
"engineVersion": "v0.13.0"
}
43 changes: 28 additions & 15 deletions ci/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,9 @@ type Interlink struct {
VirtualKubeletRef string
InterlinkRef string
PluginRef string
// +private
Kubectl *dagger.Container
// +private
KubeAPIs *dagger.Service
// +private
KubeConfig *dagger.File
Kubectl *dagger.Container
KubeAPIs *dagger.Service
KubeConfig *dagger.File
// +private
KubeConfigHost *dagger.File
InterlinkContainer *dagger.Container
Expand Down Expand Up @@ -327,16 +324,30 @@ func (m *Interlink) Kube(
ctx context.Context,
) (*dagger.Service, error) {

return dag.K3S(m.Name).Server(), nil
return m.KubeAPIs, nil

}

// Wait for cluster to be ready, then setup the test container
func (m *Interlink) Run(
ctx context.Context,
// +optional
// +defaultPath="./manifests"
manifests *dagger.Directory,
) (*dagger.Container, error) {

return m.Kubectl.
return dag.Container().From("bitnami/kubectl:1.29.7-debian-12-r3").
WithUser("root").
WithExec([]string{"mkdir", "-p", "/opt/user"}).
WithExec([]string{"chown", "-R", "1001:0", "/opt/user"}).
WithExec([]string{"apt", "update"}).
WithExec([]string{"apt", "update"}).
WithExec([]string{"apt", "install", "-y", "curl", "python3", "python3-pip", "python3-venv", "git", "vim"}).
WithMountedFile("/.kube/config", dag.K3S(m.Name).Config(dagger.K3SConfigOpts{Local: false})).
WithExec([]string{"chown", "1001:0", "/.kube/config"}).
WithUser("1001").
WithDirectory("/manifests", manifests).
WithEntrypoint([]string{"kubectl"}).
WithWorkdir("/opt/user").
WithExec([]string{"bash", "-c", "git clone https://github.com/interTwin-eu/vk-test-set.git"}).
WithExec([]string{"bash", "-c", "cp /manifests/vktest_config.yaml /opt/user/vk-test-set/vktest_config.yaml"}).
Expand All @@ -349,19 +360,21 @@ func (m *Interlink) Run(
func (m *Interlink) Test(
ctx context.Context,
// +optional
// +defaultPath="./manifests"
manifests *dagger.Directory,
// +optional
localCluster *dagger.Service,
// +optional
// +default false
//cleanup bool,
) (*dagger.Container, error) {

result := m.Kubectl.
WithWorkdir("/opt/user").
WithExec([]string{"bash", "-c", "git clone https://github.com/interTwin-eu/vk-test-set.git"}).
WithExec([]string{"bash", "-c", "cp /manifests/vktest_config.yaml /opt/user/vk-test-set/vktest_config.yaml"}).
WithWorkdir("/opt/user/vk-test-set").
WithExec([]string{"bash", "-c", "python3 -m venv .venv && source .venv/bin/activate && pip3 install -e ./ "}).
WithExec([]string{"bash", "-c", "source .venv/bin/activate && export KUBECONFIG=/.kube/config && sleep 0 && pytest -vk 'not rclone'"})
c, err := m.Run(ctx, manifests)
if err != nil {
return nil, err
}

result := c.WithExec([]string{"bash", "-c", "source .venv/bin/activate && export KUBECONFIG=/.kube/config && pytest -vk 'not rclone and not limits'"})

return result, nil

Expand Down
3 changes: 2 additions & 1 deletion ci/manifests/vktest_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ values:
namespace: interlink

annotations:
slurm-job.vk.io/flags: "--job-name=test-pod-cfg -t 2800 --ntasks=8 --nodes=1 --mem-per-cpu=2000"
slurm-job.vk.io/flags: "--job-name=test-pod-cfg -t 2800"
slurm-job.vk.io/image-root: "docker://"

tolerations:
- key: virtual-node.interlink/no-schedule
Expand Down
Binary file removed example/.DS_Store
Binary file not shown.
1 change: 0 additions & 1 deletion example/.gitignore

This file was deleted.

Empty file removed example/Dockerfile.mock
Empty file.
Empty file removed example/README.md
Empty file.
48 changes: 0 additions & 48 deletions example/create_openapi.py

This file was deleted.

9 changes: 0 additions & 9 deletions example/interlink-docker/interlink/InterLinkConfig.yaml

This file was deleted.

46 changes: 0 additions & 46 deletions example/interlink-docker/interlink/docker-compose.yaml

This file was deleted.

15 changes: 0 additions & 15 deletions example/interlink-docker/interlink/sidecarConfig.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions example/interlink-docker/test_pod.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions example/interlink-docker/vk/InterLinkConfig.yaml

This file was deleted.

101 changes: 0 additions & 101 deletions example/interlink-docker/vk/deployment.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions example/interlink-docker/vk/kustomization.yaml

This file was deleted.

Loading

0 comments on commit cebb54d

Please sign in to comment.