From d7ee1fca01e4e10e06ff2f1b42091a9de8f26a68 Mon Sep 17 00:00:00 2001
From: Jien Huang <huangjien@gmail.com>
Date: Tue, 21 Nov 2023 13:13:23 +0000
Subject: [PATCH] Red wash (#63)

* init

* add devcontainer

* use ms dind

* copy plugins works

* spelling and comments
---
 .devcontainer/Dockerfile        |  8 ++++++++
 .devcontainer/devcontainer.json | 30 ++++++++++++++++++++++++++++++
 .gitignore                      |  1 +
 README.md                       | 33 ++++++++++++++++++++++++++++++++-
 galaxy.yml                      |  2 +-
 5 files changed, 72 insertions(+), 2 deletions(-)
 create mode 100644 .devcontainer/Dockerfile
 create mode 100644 .devcontainer/devcontainer.json

diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile
new file mode 100644
index 00000000..a1da226a
--- /dev/null
+++ b/.devcontainer/Dockerfile
@@ -0,0 +1,8 @@
+# [Choice] Debian OS version (use bullseye on local arm64/Apple Silicon): bookworm, buster, bullseye
+ARG VARIANT="bullseye"
+# FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/base:${VARIANT}
+FROM mcr.microsoft.com/devcontainers/base:${VARIANT}
+
+# [Optional] Uncomment this section to install additional OS packages.
+# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
+#     && apt-get -y install --no-install-recommends <your-package-list-here>
diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json
new file mode 100644
index 00000000..b94694d1
--- /dev/null
+++ b/.devcontainer/devcontainer.json
@@ -0,0 +1,30 @@
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the
+// README at: https://github.com/devcontainers/templates/tree/main/src/debian
+{
+	"name": "molecule",
+	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
+	//"image": "mcr.microsoft.com/devcontainers/java:8",
+	"runArgs": [
+        "--env-file", "${localWorkspaceFolder}/.devcontainer/.env"
+    ],
+	"build": {
+	  "dockerfile": "Dockerfile",
+	  "context": ".."
+	},
+	// Features to add to the dev container. More info: https://containers.dev/features.
+	"features": {
+	  "ghcr.io/devcontainers/features/docker-in-docker:2": {},
+	  "ghcr.io/devcontainers-contrib/features/curl-apt-get:1": {},
+	  "ghcr.io/devcontainers-contrib/features/jfrog-cli-npm:1": {},
+	  "ghcr.io/devcontainers/features/python:1": {}
+	},
+  
+	"overrideFeatureInstallOrder": [
+	  "ghcr.io/devcontainers/features/common-utils",
+	  "ghcr.io/devcontainers/features/git",
+	  "ghcr.io/devcontainers/features/github-cli:1",
+	  "ghcr.io/devcontainers-contrib/features/curl-apt-get:1",
+	  "ghcr.io/devcontainers-contrib/features/zsh-plugins",
+	  "ghcr.io/devcontainers/features/docker-in-docker"
+	]
+  }
diff --git a/.gitignore b/.gitignore
index a657f9c7..6b73a085 100644
--- a/.gitignore
+++ b/.gitignore
@@ -115,4 +115,5 @@ play.yml
 ansible_collections
 .DS_Store
 bin/
+.devcontainer/.env
 
diff --git a/README.md b/README.md
index 1e001dfa..dbed95fd 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,7 @@ A collection of Middleware modules and roles required for installing CĂșram Soci
 ## Overview
 
 Collections are a distribution format for Ansible content. You can use collections to package and distribute playbooks, roles, modules, and plugins.
-You can publish and use collections through `Ansible Galaxy <https://galaxy.ansible.com/ibm>`.
+You can publish and use collections through `Ansible Galaxy <https://galaxy.ansible.com/merative>`.
 
 Assumption for having collection as a repo, is it enable reuse of content as well, such repo can be easily used separately by just adding `ansible.cfg`.
 
@@ -41,3 +41,34 @@ and other tools need in order to package, build and publish the collection::
 ### Useful links
 
 * https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html
+
+### Use Dev Container
+
+If you have installed docker and VS Code on your machine, please add extension **Dev Containers** to VS Code, then you can use it to quickly setup your local development environment.
+
+1. Add **.env** file under folder **.devcontainer** , you can put environment variables in it, these env vars will appear in the docker container. And **.env** has been put in the .gitignore, so you can put secrets in it, it will not be merge to github repo. Content of it:
+
+```
+ARTIFACTORY_URL=[artifactory url]
+ARTIFACTORY_REPO=[repo contains software installer]
+ARTIFACTORY_TOKEN=[token of artifactory]
+LOCAL_PATH=/workspaces/spm-middleware
+```
+2. After the dev container startup, you need to:
+    
+    a. install python packages
+    ```
+    pip install -r requirements.txt
+    ```
+
+    b. copy ansible plugins for molecule test
+    ```
+    mkdir -p /home/vscode/.ansible/plugins/
+    cp -r plugins/* /home/vscode/.ansible/plugins/
+    ```
+
+3. Then you can test if molecule works correctly:
+
+    ```
+    molecule test -s websphere-v90-rockylinux8
+    ```
diff --git a/galaxy.yml b/galaxy.yml
index 71f1a09d..7222c41b 100644
--- a/galaxy.yml
+++ b/galaxy.yml
@@ -11,7 +11,7 @@ name: spm_middleware
 
 # The version of the collection. Must be compatible with semantic versioning
 # Please note. version also exists in /github/workflows/release.yml and will need to be update also
-version: 1.3.1
+version: 1.4.0
 
 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection
 readme: README.md