From 53a02ed3a7da4e52d470c2911b2441dd7abd65d8 Mon Sep 17 00:00:00 2001
From: vuillaut <thomas.vuillaume@gmail.com>
Date: Wed, 15 Sep 2021 01:21:40 +0200
Subject: [PATCH] fix doc

---
 docs/examples.rst                             |  6 +-
 .../1.ex_CI_build_docker_container.md         | 31 -------
 .../2.ex_CI_build_singularity_image.md        | 40 ----------
 docs/snippets/3.ex_CI_upload_new_deposit.md   | 54 -------------
 .../4.ex_CI_upload_new_version_deposit.md     | 69 ----------------
 .../5.ex_CI_build_image_and_upload_OSSR.md    | 80 -------------------
 6 files changed, 2 insertions(+), 278 deletions(-)
 delete mode 100644 docs/snippets/1.ex_CI_build_docker_container.md
 delete mode 100644 docs/snippets/2.ex_CI_build_singularity_image.md
 delete mode 100644 docs/snippets/3.ex_CI_upload_new_deposit.md
 delete mode 100644 docs/snippets/4.ex_CI_upload_new_version_deposit.md
 delete mode 100644 docs/snippets/5.ex_CI_build_image_and_upload_OSSR.md

diff --git a/docs/examples.rst b/docs/examples.rst
index 91aa8adc..e8b4b74e 100644
--- a/docs/examples.rst
+++ b/docs/examples.rst
@@ -1,12 +1,10 @@
 Examples
 ========
 
-Work in progress.
 
 .. toctree::
-   :maxdepth: 4
+   :maxdepth: 0
    :glob:
-   :caption: Examples:
 
-   examples/*
+   ../examples/*
 
diff --git a/docs/snippets/1.ex_CI_build_docker_container.md b/docs/snippets/1.ex_CI_build_docker_container.md
deleted file mode 100644
index a7f3adc5..00000000
--- a/docs/snippets/1.ex_CI_build_docker_container.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Build a Docker container during the CI process
-
- - Builds a Docker container during the CI process.
- - Uploads the container to the GitLab container registry. 
- 
-**NOTE**. You should provide the Docker recipe (`Dockerfile`) and add it to a `Docker` directory in the root directory 
-of your project.  
-
-```yaml
-stages:
-  - build_container
-
-
-build_docker:
-  stage: build_container
-  image: docker:19.03.12
-  services:
-    - docker:19.03.12-dind
-  before_script:
-    - cat /etc/os-release  # "Alpine Linux v3.12"
-    - apk add git
-    - export LAST_RELEASE=`git ls-remote --tags --refs --sort="v:refname" $CI_PROJECT_URL.git | tail -n1 | sed 's/.*\///'`
-    - echo $LAST_RELEASE
-  script:
-    - cd Docker  # You should have added before your Dockerfile in this dir
-    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-    - docker build -t $CI_REGISTRY_IMAGE:$LAST_RELEASE .
-    - docker push $CI_REGISTRY_IMAGE:$LAST_RELEASE
-  only:
-    - tags
-```   
\ No newline at end of file
diff --git a/docs/snippets/2.ex_CI_build_singularity_image.md b/docs/snippets/2.ex_CI_build_singularity_image.md
deleted file mode 100644
index 1fbb7299..00000000
--- a/docs/snippets/2.ex_CI_build_singularity_image.md
+++ /dev/null
@@ -1,40 +0,0 @@
-# Build a Singularity image during the CI process
-
-This example is based on [this project](https://gitlab.com/singularityhub/gitlab-ci) (https://zenodo.org/record/3834833).
-To be able to include the following code snippet into your `.gitlab-ci.yml` file, you should check the License 
-compatibility of your project and the origin one (an example can be found [here](
-https://gitlab.in2p3.fr/escape2020/wp3/template_project_escape/-/tree/master/.singularityci)).
-
-
-This code snippet 
-
- - Builds a Singularity image during the CI process.
- - Makes available the created artifact (the image) to be used in the next CI stages. 
- 
-**PLEASE NOTE** 
- - You should provide the Singularity recipe (`Singularity`) and add it to a `Singularity` directory in the 
-root directory of your project.
- - The image will be built using  **Singularity v2.6**.
-
-
-```yaml
-stages:
-  - build_container
-
-build_singularity:
-  stage: build_container
-  image: singularityware/singularity:gitlab-2.6
-  script:
-    - export IMAGE_NAME=$CI_PROJECT_NAME  # Choose the name of the image
-    - singularity build $IMAGE_NAME.simg Singularity/Singularity
-
-    - mkdir -p build && cp Singularity/*.simg build
-    - mkdir -p build && cp Singularity/Singularity* build
-  artifacts:
-    paths:
-      - build/Singularity.simg
-      - build/Singularity
-  only:
-    - tags
-
-```   
\ No newline at end of file
diff --git a/docs/snippets/3.ex_CI_upload_new_deposit.md b/docs/snippets/3.ex_CI_upload_new_deposit.md
deleted file mode 100644
index 76396e18..00000000
--- a/docs/snippets/3.ex_CI_upload_new_deposit.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# Upload a new entry to the OSSR 
-
- - Uses the GitLab CI to upload the current project to the ESCAPE-OSSR (The ESCAPE2020 Zenodo community).
-    - Note that the CI will be only triggered with the creation of a new release.
- - The `codemeta.json` file - compulsory if you want to run this code - will be also added to the Zenodo entry as 
- a separate file.
- - The `eossr-check-connection-zenodo` stage will create a fist dummy upload (that will be always erased), to check
- that the released code will be successfully uploaded. 
-
-
-### Upload to Zenodo
-```yaml
-stages:
- - deploy 
-
-deploy_zenodo:
-  stage: deploy
-  image: gitlab-registry.in2p3.fr/escape2020/wp3/eossr:v0.1
-  before_script:
-    - eossr-check-connection-zenodo --token $ZENODO_TOKEN --sandbox False -p $CI_PROJECT_DIR
-  script:
-    - mkdir -p build
-    - parse_last_release_git.sh $CI_PROJECT_NAME $CI_PROJECT_URL
-    - if [[ -f ./codemeta.json ]]; then cp ./codemeta.json ./build; fi
-    - ls ./build
-
-    - eossr-upload-new-deposit -t $ZENODO_TOKEN -s False -i ./build -id $ZENODO_PROJECT_ID
-  only:
-    - tags
-
-``` 
-
-
-### Upload to Sandbox Zenodo
-```yaml
-stages:
- - deploy 
-
-deploy_zenodo:
-  stage: deploy
-  image: gitlab-registry.in2p3.fr/escape2020/wp3/eossr:v0.1
-  before_script:
-    - eossr-check-connection-zenodo --token $SANDBOX_ZENODO_TOKEN --sandbox True -p $CI_PROJECT_DIR
-  script:
-    - mkdir -p build
-    - parse_last_release_git.sh $CI_PROJECT_NAME $CI_PROJECT_URL
-    - if [[ -f ./codemeta.json ]]; then cp ./codemeta.json ./build; fi
-    - ls ./build
-
-    - eossr-upload-new-deposit -t $SANDBOX_ZENODO_TOKEN -s True -i ./build -id $ZENODO_PROJECT_ID
-  only:
-    - tags
-
-``` 
diff --git a/docs/snippets/4.ex_CI_upload_new_version_deposit.md b/docs/snippets/4.ex_CI_upload_new_version_deposit.md
deleted file mode 100644
index 961cdc82..00000000
--- a/docs/snippets/4.ex_CI_upload_new_version_deposit.md
+++ /dev/null
@@ -1,69 +0,0 @@
-# Upload a new version of an existing entry to the OSSR 
-
- - Uses the GitLab CI to upload a **new version** of the current project to the ESCAPE-OSSR (The ESCAPE2020 Zenodo 
- community).
-     - Note that the CI will be only triggered with the creation of a new release.
- - The `codemeta.json` file - compulsory if you want to run this code - will be also added to the Zenodo entry as 
- a separate file.
- - The `eossr-check-connection-zenodo` stage will create a fist dummy upload (that will be always erased), to check
- that the released code will be successfully uploaded. 
- 
-**NOTE**.
-You should have saved the `deposit_id` of your project as a GitLab environment variable before the CI runs this stage.
-
-To do so:
-1. Go to https://zenodo.org/deposit,
-2. Click onto your just uploaded project,
-3. From your browser search bar, **just** copy the number (your `deposit id`) that it is included in the https direction.
-   - ex: `https://zenodo.org/record/3884963` --> just copy `3884963`.
-4. Save it as a new environment variable in your GitLab project. 
-    * Go to your GitLab project. 
-    * Click on `Settings` --> `CI/CD` --> `Variables` --> `Add variable` 
-    * `KEY`=`$ZENODO_PROJECT_ID` and fill the value with the deposit id.
-    * For Sandbox Zenodo use `KEY` = `SANDBOX_ZENODO_PROJECT_ID`
-
-
-### Upload to Zenodo
-```yaml
-stages:
- - deploy 
-
-deploy_zenodo:
-  stage: deploy
-  image: gitlab-registry.in2p3.fr/escape2020/wp3/eossr:v0.1
-  before_script:
-    - eossr-check-connection-zenodo --token $ZENODO_TOKEN --sandbox False -p $CI_PROJECT_DIR
-  script:
-    - mkdir -p build
-    - parse_last_release_git.sh $CI_PROJECT_NAME $CI_PROJECT_URL
-    - if [[ -f ./codemeta.json ]]; then cp ./codemeta.json ./build; fi
-    - ls ./build
-
-    - eossr-upload-new-version-deposit -t $ZENODO_TOKEN -s False -i ./build -id $ZENODO_PROJECT_ID
-  only:
-    - tags
-
-``` 
-
-
-### Upload to Sandbox Zenodo
-```yaml
-stages:
- - deploy 
-
-deploy_zenodo:
-  stage: deploy
-  image: gitlab-registry.in2p3.fr/escape2020/wp3/eossr:v0.1
-  before_script:
-    - eossr-check-connection-zenodo --token $SANDBOX_ZENODO_TOKEN --sandbox True -p $CI_PROJECT_DIR
-  script:
-    - mkdir -p build
-    - parse_last_release_git.sh $CI_PROJECT_NAME $CI_PROJECT_URL
-    - if [[ -f ./codemeta.json ]]; then cp ./codemeta.json ./build; fi
-    - ls ./build
-
-    - eossr-upload-new-version-deposit -t $SANDBOX_ZENODO_TOKEN -s True -i ./build -id $SANDBOX_ZENODO_PROJECT_ID
-  only:
-    - tags
-
-``` 
diff --git a/docs/snippets/5.ex_CI_build_image_and_upload_OSSR.md b/docs/snippets/5.ex_CI_build_image_and_upload_OSSR.md
deleted file mode 100644
index e392a029..00000000
--- a/docs/snippets/5.ex_CI_build_image_and_upload_OSSR.md
+++ /dev/null
@@ -1,80 +0,0 @@
-# Build a Singularity image, a Docker container and upload your project and images to the OSSR
-
-This code snippet will:
-
- - Builds a Docker container during the CI process.
- - Builds a Singularity image during the CI process.
- - Makes available the created artifacts (both images) to be used in the next CI stages.
- - Uploads the next released version of the current project, together with both images, to the ESCAPE-OSSR 
- (The ESCAPE2020 Zenodo community).
-
-Have a look before to the examples in this same directory.
-
-```yaml
-stages:
- - build_container
- - deploy
-
-build_singularity_image:
-  stage: build
-  image: singularityware/singularity:gitlab-2.6
-  script:
-    # You should have added before your Singularity recipe in a Singularity dir
-    - singularity build $IMAGE_NAME.simg Singularity/Singularity
-
-    - mkdir -p build && cp Singularity/*.simg build
-    - mkdir -p build && cp Singularity/Singularity* build
-  artifacts:
-    paths:
-      - build/Singularity.simg
-      - build/Singularity
-  only:
-    - tags
-
-build_docker_image:
-  stage: build
-  image: docker:19.03.12
-  services:
-    - docker:19.03.12-dind
-  before_script:
-    - cat /etc/os-release  # "Alpine Linux v3.12"
-    - apk add git
-    - export LAST_RELEASE=`git ls-remote --tags --refs --sort="v:refname" $CI_PROJECT_URL.git | tail -n1 | sed 's/.*\///'`
-    - echo $LAST_RELEASE
-  script:
-    - cd Docker
-    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-    - docker build -t $CI_REGISTRY_IMAGE:$LAST_RELEASE .
-    - docker push $CI_REGISTRY_IMAGE:$LAST_RELEASE
-
-    # Save docker image into a file to be uploaded in next stage
-    - docker save -o Docker_image_ESCAPE_template_project_$LAST_RELEASE.tar $CI_REGISTRY_IMAGE:$LAST_RELEASE
-    - cd .. && mkdir -p build && cp Docker/*.tar build
-    - ls build
-  artifacts:
-    paths:
-      - build/Docker_image_ESCAPE_template_project_*.tar
-  only:
-    - tags
-
-
-deploy_zenodo:
-  stage: deploy
-  image: gitlab-registry.in2p3.fr/escape2020/wp3/eossr:v0.1
-  # The `dependencies` key (and field) is added to this stage ONLY because we have created 
-  #  in previous stages some artifacts
-  dependencies:
-    - build_singularity_image
-    - build_docker_image
-  before_script:
-    - test_connection_zenodo --token $ZENODO_TOKEN --sandbox False -p $CI_PROJECT_DIR
-  script:
-    - mkdir -p build
-    - parse_last_release_git.sh $CI_PROJECT_NAME $CI_PROJECT_URL
-    - if [[ -f ./codemeta.json ]]; then cp ./codemeta.json ./build; fi
-    - ls ./build
-
-    - upload_new_version_deposit -t $ZENODO_TOKEN -s False -i ./build -id $ZENODO_PROJECT_ID
-  only:
-    - tags
-```
-- 
GitLab