Commit 7c1ea7e2 authored by moha-s's avatar moha-s
Browse files

Initial commit for cookiecutter R2 CLI

parent fc846d1d
Loading
Loading
Loading
Loading

cookiecutter.config.js

0 → 100644
+47 −0
Original line number Diff line number Diff line
module.exports = [
    {
      name: "Job folder creation",
      templatePath: "tools/job_template/r2_jobname/",
      outputPath: "jobs/",
      fields: [
        {
          templateVariable: "r2_jobname",
          question: "What is the name of your job?"
        },
        {
          templateVariable: "r2_jobdescription",
          question: "Give a short description of your job"
        },
        {
          templateVariable: "r2_stage",
          question: "What is the default stage of your job?",
          choices: ["static_tests", "build", "dynamic_tests", "provision", "review", "release", "deploy", "others"]
        },
        {
          templateVariable: "r2_maintainer",
          question: "What is your Gitlab username?"
        },
        {
          templateVariable: "r2_license",
          question: "What license do you want to use?",
          choices: ["MIT", "Apache-2.0"]
        },
        {
          templateVariable: "r2_imagename",
          question: "What is the Docker image that you will use? (just the name)"
        },
        {
          templateVariable: "r2_imagetag",
          question: "What is the tag of this image?",
          errorMessage: "Must be a specific tag",
          isValid(val) {
            return val !== "latest";
          }
        },
        {
          templateVariable: "r2_icon",
          question: "Finally, paste an emoji that represents your job"
        }
      ]
    }
  ];
 No newline at end of file
+0 −10
Original line number Diff line number Diff line
name: "{{ job_name }}"
description: "{{ description }}"
default_stage: "{{ stage }}"
icon: "{{ icon }}"
maintainer: "{{ maintainer }}"
license: "{{ license name }}"
images:
  "{{ image_name }}": "{{ image_tag }}"
tools:
  "{{ tool_name }}": "{{ tool_version }}"
 No newline at end of file
+6 −6
Original line number Diff line number Diff line
## Objective

{{ description }}
r2_jobdescription

## How to use it

1. <Your steps>
1. Add this job URL inside the `include` list of your `.gitlab-ci.yml` file (see the [quick setup](/use-the-hub/#quick-setup)). You can specify [a fixed version](#changelog) instead of `latest`.
    ```yaml
      - remote: 'https://jobs.r2devops.io/latest/<job_name>.yml'
      - remote: 'https://jobs.r2devops.io/latest/r2_jobname.yml'
    ```
1. If you need to customize the job (stage, variables, ...) 👉 check the [jobs
   customization](/use-the-hub/#jobs-customization)
@@ -15,14 +15,14 @@

## Job details

* Job name: `{{ job_name }}`
* Job name: `r2_jobname`
* Docker image:
[`{{ image }}`](https://hub.docker.com/r/_/{{ image }})
* Default stage: `{{ stage }}`
[`r2_imagename`](https://hub.docker.com/r/_/r2_imagename)
* Default stage: `r2_stage`
* When: `always`

### Variables

| Name | Description | Default |
| ---- | ----------- | ------- |
| `VARIABLE` <img width=100/> | A general variable for this job <img width=175/>| `{{ variable }}` <img width=100/>|
| `VARIABLE` <img width=100/> | A general variable for this job <img width=175/>| `Hello R2` <img width=100/>|
+9 −0
Original line number Diff line number Diff line
name: r2_jobname
description: r2_jobdescription
default_stage: r2_stage
icon: r2_icon
maintainer: r2_maintainer
license: r2_license
images:
  r2_imagename:r2_imagetag
tools:
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
stages:
  - {{ stage }}
  - r2_stage

job_name:
    image: {{ image_tag }}
    stage: {{ stage }}
r2_jobname:
    image: r2_imagename:r2_imagetag
    stage: r2_stage
    variables:
      VARIABLE: {{ variable }}
      VARIABLE: "Hello R2"
    script:
      - echo "${VARIABLE}"
Loading