Skip to content

Commit

Permalink
vdk-quickstart: remove use of global varaibles in CI
Browse files Browse the repository at this point in the history
The use of global variables in GitLab CI can create problems when
multiple CI files are being imported, as variables are not scoped to a
specific file. This can lead to unexpected variables being set, causing
issues in the CI/CD pipeline.

This is what is happening wiht quickstart-vdk test -
https://gitlab.com/vmware-analytics/versatile-data-kit/-/jobs/3901914540

It expected that there's python installed because it's supposed to use
python image but some other file overrides this image to docker and
causes the test to fail.

This changes quickstart-vdk to use job-level variables.

In future changes I will be changing all CIs to use  job-level variables
or environment variables to avoid conflicts and ensure proper scoping.
Or ensure that global variabels and labels are prefixed with the project
or plugin name.

Testing Done: this PR CI

Signed-off-by: Antoni Ivanov <[email protected]>
  • Loading branch information
antoniivanov committed Mar 9, 2023
1 parent 63c2a30 commit a07c767
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
3 changes: 2 additions & 1 deletion projects/vdk-plugins/.plugin-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
extends: .build-plugin

.release-plugin:
image: "python:3.10"
stage: release
before_script:
- export VDK_PATCH_VERSION=${CI_PIPELINE_ID}
Expand Down Expand Up @@ -89,7 +90,7 @@
- echo "Build and release vdk image of plugin $PLUGIN_NAME"
- cd $PLUGIN_NAME/ || exit 1
- sed -ri "s/__version__ = \"([[:digit:]]\.[[:digit:]]\.).*\"$/__version__ = \"\1${VDK_PATCH_VERSION}\"/g" setup.py
- apk add --no-cache git bash python3
- apk add --no-cache git bash python3 py3-pip
- python3 -V
- python3 -m pip install -U setuptools configparser
- export VDK_PACKAGE=$(python3 setup.py --name)
Expand Down
8 changes: 1 addition & 7 deletions projects/vdk-plugins/quickstart-vdk/.plugin-ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
# Copyright 2021-2023 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0

image: "python:3.7"

variables:
DOCKER_HOST: tcp://localhost:2375
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ""

# Add all quickstart-vdk dependencies locations which trigger the dependency release when changed.
# In this way, quickstart-vdk will always be tested before one or more dependencies are changed, and
# this is important since quickstart-vdk has unpinned dependencies and when they are upgraded,
Expand Down Expand Up @@ -78,6 +71,7 @@ quickstart-vdk-release-candidate-base-image:
extends: .release-vdk-image

quickstart-vdk-release-acceptance-test:
image: "python:3.10"
stage: pre_release_test
before_script:
- export VDK_PATCH_VERSION=${CI_PIPELINE_ID}.dev${CI_PIPELINE_IID}
Expand Down

0 comments on commit a07c767

Please sign in to comment.