Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdk-heartbeat: cover requirements.txt automatic installs #2393

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions projects/vdk-heartbeat/.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,28 @@ vdk-heartbeat-test:
junit: tests.xml


vdk-heartbeat-release-acceptance-test:
stage: pre_release
before_script:
- cd projects/vdk-heartbeat
script:
- set -x
- python setup.py sdist --formats=gztar
- pip install vdk-heartbeat --extra-index-url $PIP_EXTRA_INDEX_URL
- export VDK_HEARTBEAT_API_TOKEN=$VDK_API_TOKEN
- export VDK_HEARTBEAT_OP_ID="vdk-heartbeat-$CI_PIPELINE_ID"
- export JOB_NAME=vdk-heartbeat-release-test-job-$(date +%s)
- vdk-heartbeat -f cicd/cicd_heartbeat_config.ini
artifacts:
when: always
reports:
junit: tests.xml
only:
refs: # TODO switch to "main" so it is used as a pre-release test not pre-merge test
- external_pull_requests
changes: *vdk_heartbeat_changes_locations


vdk-heartbeat-release:
before_script:
- cd projects/vdk-heartbeat
Expand Down
10 changes: 10 additions & 0 deletions projects/vdk-heartbeat/cicd/cicd_heartbeat_config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[DEFAULT]
# Genereate with https://console-stg.cloud.vmware.com/csp/gateway/portal/#/user/tokens
# VDKCLI_OAUTH2_REFRESH_TOKEN= passed as environment variable
VDKCLI_OAUTH2_URI=https://console-stg.cloud.vmware.com/csp/gateway/am/api/auth/api-tokens/authorize
CONTROL_API_URL=http://cicd-control-service-svc:8092
# https://iaclqhm5xk.execute-api.us-west-1.amazonaws.com/data-jobs

JOB_RUN_TEST_MODULE_NAME=vdk.internal.heartbeat.simple_run_test
JOB_RUN_TEST_CLASS_NAME=SimpleRunTest
DATAJOB_DIRECTORY_NAME=simple
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
# SPDX-License-Identifier: Apache-2.0
import logging

from faker import Faker
from vdk.api.job_input import IJobInput

log = logging.getLogger(__name__)


def run(job_input: IJobInput):
# this is just added to test that external libraries are installed and imported correctly from requirements.txt
fake = Faker()
log.info(f"Fake name: {fake.name()}")

log.info(f"Empty job that just logs and exits")
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faker
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@
# SPDX-License-Identifier: Apache-2.0
import logging

from faker import Faker
from vacloud.api.job_input import IJobInput

log = logging.getLogger(__name__)


def run(job_input: IJobInput):
# this is just added to test that external libraries are installed and imported correctly from requirements.txt
fake = Faker()
log.info(f"Fake name: {fake.name()}")

# Test creates dynamically file 06_override_properties.py
# which will override properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,20 @@
# SPDX-License-Identifier: Apache-2.0
import logging

from faker import Faker
from vdk.api.job_input import IJobInput

log = logging.getLogger(__name__)


def run(job_input: IJobInput):
# this is just added to test that external libraries are installed and imported correctly from requirements.txt
fake = Faker()
log.info(f"Fake name: {fake.name()}")

log.info(f"Get current properties ")
props = job_input.get_all_properties()
props["succeeded"] = "true"
log.info(f"Save new properties ")
log.info(f"Save new properties {props}")
job_input.set_all_properties(props)
log.info(f"Updated property now to {props['succeeded']}")
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

Faker
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@
# SPDX-License-Identifier: Apache-2.0
import logging

from faker import Faker
from vdk.api.job_input import IJobInput


log = logging.getLogger(__name__)


def run(job_input: IJobInput):
# this is just added to test that external libraries are installed and imported correctly from requirements.txt
fake = Faker()
log.info(f"Fake name: {fake.name()}")

# Test creates dynamically file 06_override_properties.py
# which will override properties

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Faker
vdk-trino