Skip to content

Conversation

daniel-hutao
Copy link
Member

@daniel-hutao daniel-hutao commented Aug 10, 2022

Pre-Checklist

Note: please complete ALL items in the following checklist.

  • I have read through the CONTRIBUTING.md documentation.
  • My code has the necessary comments and documentation (if needed).
  • I have added relevant tests

Description

This is the first version of the plugin harbor-docker, just a simple support for the create and delete operations. There are a lot of todo left. I will continue to optimize this plugin in the next days to make this plugin production ready.

Related Issues

N/A

New Behavior (screenshots if needed)

1. create

  • config-harbor.yaml
---
# core config
varFile: "" # If not empty, use the specified external variables config file
toolFile: "" # If not empty, use the specified external tools config file
state: # state config, backend can be local or s3
  backend: local
  options:
    stateFile: devstream.state

---
tools:
  # name of the tool
  - name: harbor-docker
    # id of the tool instance
    instanceID: default
    # format: name.instanceID; If specified, dtm will make sure the dependency is applied first before handling this tool.
    dependsOn: [ ]
    # options for the plugin
    options:
      hostname: "harbor.example.com"
  • ./dtm apply -f config-harbor.yaml -y
2022-08-11 10:03:25 ℹ [INFO]  Apply started.
2022-08-11 10:03:25 ℹ [INFO]  Got Backend from config: local
2022-08-11 10:03:25 ℹ [INFO]  Using dir <.devstream> to store plugins.
2022-08-11 10:03:25 ℹ [INFO]  Using local backend. State file: devstream.state.
2022-08-11 10:03:25 ℹ [INFO]  Tool (harbor-docker/default) found in config but doesn't exist in the state, will be created.
2022-08-11 10:03:25 ℹ [INFO]  Start executing the plan.
2022-08-11 10:03:25 ℹ [INFO]  Changes count: 1.
2022-08-11 10:03:25 ℹ [INFO]  -------------------- [  Processing progress: 1/1.  ] --------------------
2022-08-11 10:03:25 ℹ [INFO]  Processing: (harbor-docker/default) -> Create ...
2022-08-11 10:03:26 ℹ [INFO]  Cmd: ./install.sh.
......
Stdout: ✔ ----Harbor has been installed and started successfully.----
2022-08-11 10:03:31 ℹ [INFO]  Cmd: docker compose ls.
Stdout: NAME                STATUS              CONFIG FILES
Stdout: devstream           running(9)          /root/devstream/docker-compose.yml
2022-08-11 10:03:31 ✔ [SUCCESS]  Tool (harbor-docker/default) Create done.
2022-08-11 10:03:31 ℹ [INFO]  -------------------- [  Processing done.  ] --------------------
2022-08-11 10:03:31 ✔ [SUCCESS]  All plugins applied successfully.
2022-08-11 10:03:31 ✔ [SUCCESS]  Apply finished.

image

2. delete

  • ./dtm delete -f config-harbor.yaml -y
2022-08-11 10:06:15 ℹ [INFO]  Delete started.
2022-08-11 10:06:15 ℹ [INFO]  Got Backend from config: local
2022-08-11 10:06:15 ℹ [INFO]  Using dir <.devstream> to store plugins.
2022-08-11 10:06:16 ℹ [INFO]  Using local backend. State file: devstream.state.
2022-08-11 10:06:16 ℹ [INFO]  Tool (harbor-docker/default) will be deleted.
2022-08-11 10:06:16 ℹ [INFO]  Start executing the plan.
2022-08-11 10:06:16 ℹ [INFO]  Changes count: 1.
2022-08-11 10:06:16 ℹ [INFO]  -------------------- [  Processing progress: 1/1.  ] --------------------
2022-08-11 10:06:16 ℹ [INFO]  Processing: (harbor-docker/default) -> Delete ...
2022-08-11 10:06:16 ℹ [INFO]  Cmd: docker compose down -v.
Stderr: Container nginx  Stopping
Stderr: Container nginx  Stopping
Stderr: Container registryctl  Stopping
Stderr: Container registryctl  Stopping
Stderr: Container harbor-jobservice  Stopping
Stderr: Container harbor-jobservice  Stopping
Stderr: Container harbor-jobservice  Stopped
Stderr: Container harbor-jobservice  Removing
Stderr: Container harbor-jobservice  Removed
Stderr: Container nginx  Stopped
Stderr: Container nginx  Removing
Stderr: Container nginx  Removed
Stderr: Container harbor-portal  Stopping
Stderr: Container harbor-portal  Stopping
Stderr: Container harbor-core  Stopping
Stderr: Container harbor-core  Stopping
Stderr: Container harbor-portal  Stopped
Stderr: Container harbor-portal  Removing
Stderr: Container harbor-portal  Removed
Stderr: Container harbor-core  Stopped
Stderr: Container harbor-core  Removing
Stderr: Container harbor-core  Removed
Stderr: Container harbor-db  Stopping
Stderr: Container harbor-db  Stopping
Stderr: Container registry  Stopping
Stderr: Container registry  Stopping
Stderr: Container redis  Stopping
Stderr: Container redis  Stopping
Stderr: Container registry  Stopped
Stderr: Container registry  Removing
Stderr: Container registry  Removed
Stderr: Container harbor-db  Stopped
Stderr: Container harbor-db  Removing
Stderr: Container harbor-db  Removed
Stderr: Container redis  Stopped
Stderr: Container redis  Removing
Stderr: Container redis  Removed
Stderr: Container registryctl  Stopped
Stderr: Container registryctl  Removing
Stderr: Container registryctl  Removed
Stderr: Container harbor-log  Stopping
Stderr: Container harbor-log  Stopping
Stderr: Container harbor-log  Stopped
Stderr: Container harbor-log  Removing
Stderr: Container harbor-log  Removed
Stderr: Network devstream_harbor  Removing
Stderr: Network devstream_harbor  Removed
2022-08-11 10:06:36 ℹ [INFO]  Cmd: docker compose ls.
Stdout: NAME                STATUS              CONFIG FILES
2022-08-11 10:06:36 ℹ [INFO]  Prepare to delete 'harbor-docker_default' from States.
2022-08-11 10:06:36 ✔ [SUCCESS]  Tool (harbor-docker/default) delete done.
2022-08-11 10:06:36 ℹ [INFO]  -------------------- [  Processing done.  ] --------------------
2022-08-11 10:06:36 ✔ [SUCCESS]  All plugins deleted successfully.
2022-08-11 10:06:36 ✔ [SUCCESS]  Delete finished.

Signed-off-by: Daniel Hu <tao.hu@merico.dev>
Signed-off-by: Daniel Hu <tao.hu@merico.dev>
@daniel-hutao daniel-hutao force-pushed the feat-harbor branch 3 times, most recently from 76822c3 to 592b1aa Compare August 11, 2022 09:44
@daniel-hutao daniel-hutao marked this pull request as ready for review August 11, 2022 10:07
@daniel-hutao daniel-hutao requested review from IronCore864 and a team as code owners August 11, 2022 10:07
Signed-off-by: Daniel Hu <tao.hu@merico.dev>
@iyear
Copy link
Member

iyear commented Aug 15, 2022

The core logic is in the scripts. Is there a source for the shell script used? I'm not familiar with bash so I can't review it. if you wrote the script yourself, this might need someone else to review it.

@iyear iyear added the enhancement New feature or request label Aug 15, 2022
@daniel-hutao
Copy link
Member Author

The core logic is in the scripts. Is there a source for the shell script used? I'm not familiar with bash so I can't review it. if you wrote the script yourself, this might need someone else to review it.

The scripts is wrote by the Harbor authors. https://github.com/goharbor/harbor/releases/tag/v2.4.3

@iyear
Copy link
Member

iyear commented Aug 15, 2022

@daniel-hutao Then there should be no problem.

Copy link
Member

@iyear iyear left a comment

Choose a reason for hiding this comment

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

LGTM👏

Signed-off-by: Daniel Hu <tao.hu@merico.dev>
@daniel-hutao daniel-hutao requested a review from aFlyBird0 August 15, 2022 04:00
Copy link
Member

@aFlyBird0 aFlyBird0 left a comment

Choose a reason for hiding this comment

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

lgtm. 👏

@aFlyBird0 aFlyBird0 assigned IronCore864 and unassigned aFlyBird0 Aug 15, 2022
@daniel-hutao daniel-hutao merged commit 04cfcef into devstream-io:main Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants