Commit 869658cd authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

feat: move group

parent ba1e368c
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
include:
  - project: 'Orange-OpenSource/tbc/tools/gitlab-ci'
  - project: 'to-be-continuous/tools/gitlab-ci'
    ref: 'master'
    file: '/templates/validation.yml'
  - project: 'Orange-OpenSource/tbc/kicker'
  - project: 'to-be-continuous/kicker'
    ref: 'master'
    file: '/templates/validation.yml'
  - project: 'Orange-OpenSource/tbc/bash'
  - project: 'to-be-continuous/bash'
    ref: '1.0.0'
    file: 'templates/gitlab-ci-bash.yml'

+2 −2
Original line number Diff line number Diff line
@@ -70,8 +70,8 @@ Git commits in _to be continuous_ shall be:
1. **atomic** (1 commit `=` 1 and only 1 _thing_),
2. **semantic** (using [semantic-release commit message syntax](https://semantic-release.gitbook.io/semantic-release/#commit-message-format)).

You'll find extensive information about Git commit conventions on the [reference documentation website](https://orange-opensource.gitlab.io/tbc/doc/dev/workflow/#git-commit-guidelines).
You'll find extensive information about Git commit conventions on the [reference documentation website](https://to-be-continuous.gitlab.io/doc/dev/workflow/#git-commit-guidelines).

### Coding Guidelines

The extensive _to be continuous_ coding guidelines can be found on the [reference documentation website](https://orange-opensource.gitlab.io/tbc/doc/dev/guidelines/).
The extensive _to be continuous_ coding guidelines can be found on the [reference documentation website](https://to-be-continuous.gitlab.io/doc/dev/guidelines/).
+2 −2
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ In order to include this template in your project, add the following to your `gi

```yaml
include:
  - project: 'Orange-OpenSource/tbc/terraform'
  - project: 'to-be-continuous/terraform'
    ref: '1.0.0'
    file: '/templates/gitlab-ci-terraform.yml'
```
@@ -270,7 +270,7 @@ resource "aws_instance" "web_server" {
It may happen that you need to use different configuration variables depending on the environment you are deploying.
For instance separate `GOOGLE_CREDENTIALS` if you're using [Google Provider](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#full-reference).

For this, you shall either use [GitLab scoped variables](https://docs.gitlab.com/ee/ci/environments/index.html#scoping-environments-with-specs) or our [scoped variables syntax](https://orange-opensource.gitlab.io/tbc/doc/usage/#scoped-variables) to limit/override some variables values, using `$CI_ENVIRONMENT_NAME` as the conditional variable.
For this, you shall either use [GitLab scoped variables](https://docs.gitlab.com/ee/ci/environments/index.html#scoping-environments-with-specs) or our [scoped variables syntax](https://to-be-continuous.gitlab.io/doc/usage/#scoped-variables) to limit/override some variables values, using `$CI_ENVIRONMENT_NAME` as the conditional variable.

Example: different [OpenStack provider configuration](https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs#configuration-reference) for production

+5 −5
Original line number Diff line number Diff line
# =========================================================================================
# Copyright (C) 2021 Orange
# Copyright (C) 2021 Orange & contributors
#
# This program is free software; you can redistribute it and/or modify it under the terms 
# of the GNU Lesser General Public License as published by the Free Software Foundation; 
@@ -14,7 +14,7 @@
# Floor, Boston, MA  02110-1301, USA.
# =========================================================================================
variables:
  # Default Docker image (can be overriden)
  # Default Docker image (can be overridden)
  TF_IMAGE: "hashicorp/terraform:light"
  TF_TFSEC_IMAGE: "tfsec/tfsec-ci"
  TF_TFSEC_ARGS: "."
@@ -36,7 +36,7 @@ variables:
  # default integration ref name (pattern)
  INTEG_REF: '/^develop$/'

# allowed stages depend on your template type (see: https://orange-opensource.gitlab.io/tbc/doc/understand/#generic-pipeline-stages)
# allowed stages depend on your template type (see: https://to-be-continuous.gitlab.io/doc/understand/#generic-pipeline-stages)
stages:
  - build
  - test
@@ -448,7 +448,7 @@ stages:
  }

  function get_latest_template_version() {
    tag_json=$(wget -T 5 -q -O - "$CI_API_V4_URL/projects/Orange-OpenSource%2Ftbc%2F$1/repository/tags?per_page=1" 2> /dev/null || curl -s --connect-timeout 5 "$CI_API_V4_URL/projects/Orange-OpenSource%2Ftbc%2F$1/repository/tags?per_page=1" 2> /dev/null || echo "")
    tag_json=$(wget -T 5 -q -O - "$CI_API_V4_URL/projects/to-be-continuous%2F$1/repository/tags?per_page=1" 2> /dev/null || curl -s --connect-timeout 5 "$CI_API_V4_URL/projects/to-be-continuous%2F$1/repository/tags?per_page=1" 2> /dev/null || echo "")
    echo "$tag_json" | sed -rn 's/^.*"name":"([^"]*)".*$/\1/p'
  }

@@ -484,7 +484,7 @@ stages:
    name: "$TF_IMAGE"
    entrypoint: [""]
  services:
    - name: "$CI_REGISTRY/orange-opensource/tbc/tools/tracking:master"
    - name: "$CI_REGISTRY/to-be-continuous/tools/tracking:master"
      command: ["--service", "terraform", "1.0.0" ]
  before_script:
    # set environment context (before unscope_variables)
+9 −9
Original line number Diff line number Diff line
@@ -9,10 +9,10 @@ function setup() {
  export CCC=ccc
  export DDD=ddd

  export scoped__AAA__if__VEGETABLE__equals__carrot="overriden aaa"
  export scoped__BBB__if__VEGETABLE__in__lettuce__potato="overriden bbb"
  export scoped__CCC__if__VEGETABLE__endswith_ic__ato="overriden ccc"
  export scoped__DDD__ifnot__VEGETABLE__defined="overriden ddd"
  export scoped__AAA__if__VEGETABLE__equals__carrot="overridden aaa"
  export scoped__BBB__if__VEGETABLE__in__lettuce__potato="overridden bbb"
  export scoped__CCC__if__VEGETABLE__endswith_ic__ato="overridden ccc"
  export scoped__DDD__ifnot__VEGETABLE__defined="overridden ddd"
}

@test "scoped variables with none" {
@@ -25,7 +25,7 @@ function setup() {
  assert_equal "$AAA" 'aaa'
  assert_equal "$BBB" 'bbb'
  assert_equal "$CCC" 'ccc'
  assert_equal "$DDD" 'overriden ddd'
  assert_equal "$DDD" 'overridden ddd'
}

@test "scoped variables with carrot" {
@@ -36,7 +36,7 @@ function setup() {
  unscope_variables

  # THEN
  assert_equal "$AAA" 'overriden aaa'
  assert_equal "$AAA" 'overridden aaa'
  assert_equal "$BBB" 'bbb'
  assert_equal "$CCC" 'ccc'
  assert_equal "$DDD" 'ddd'
@@ -51,8 +51,8 @@ function setup() {

  # THEN
  assert_equal "$AAA" 'aaa'
  assert_equal "$BBB" 'overriden bbb'
  assert_equal "$CCC" 'overriden ccc'
  assert_equal "$BBB" 'overridden bbb'
  assert_equal "$CCC" 'overridden ccc'
  assert_equal "$DDD" 'ddd'
}

@@ -66,6 +66,6 @@ function setup() {
  # THEN
  assert_equal "$AAA" 'aaa'
  assert_equal "$BBB" 'bbb'
  assert_equal "$CCC" 'overriden ccc'
  assert_equal "$CCC" 'overridden ccc'
  assert_equal "$DDD" 'ddd'
}