From 45e835f1972b5b2c34265b71c6eec5424606db6b Mon Sep 17 00:00:00 2001 From: ProfOak Date: Mon, 5 Jun 2023 15:39:21 -0500 Subject: [PATCH 01/10] DEV-1834: Don't do anything with gdcdatamodel2 --- .gitlab-ci.yml | 112 ------------------------------------------------- 1 file changed, 112 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5a7e8fbdf..76dac8a29 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,8 +4,6 @@ stages: - test - - build - - release_gdcdatamodel2 include: - project: nci-gdc/gitlab-templates @@ -53,113 +51,3 @@ release: - when: always variables: GDCDICTIONARY_TARGET_VERSION: $CI_COMMIT_REF_NAME - -update_reqs_for_gdcdatamodel2: - image: docker.osdc.io/ncigdc/python36-builder:1.4.0 - stage: build - script: - - !reference [.load_github_key, script] - - git clone git@github.com:NCI-GDC/gdcdatamodel2.git - - cd gdcdatamodel2 - - git checkout "$GDCDICTIONARY_TARGET_VERSION" || git checkout -b "$GDCDICTIONARY_TARGET_VERSION" - - git log -1 - - sed -i 's|gdcdictionary @ git+https://github.com/NCI-GDC/gdcdictionary.git@.*#egg=gdcdictionary|gdcdictionary @ git+https://github.com/NCI-GDC/gdcdictionary.git@'"$GDCDICTIONARY_TARGET_VERSION"'#egg=gdcdictionary|' setup.cfg - - cat setup.cfg - - pip3 --version - - pip3 install virtualenv pip-tools==6.3.0 - - pip-compile -i https://pypi.org/simple --extra=dev --output-file=dev-requirements.txt pyproject.toml - artifacts: - paths: - - gdcdatamodel2/setup.cfg - - gdcdatamodel2/dev-requirements.txt - expire_in: 1 week - rules: - - !reference [.override_gdcdictionary_version, rules] - - - -execute_plaster: - image: docker.osdc.io/ncigdc/python3.8-builder:2.1.0 - stage: build - script: - - !reference [.load_github_key, script] - - pwd - - git clone git@github.com:NCI-GDC/gdcdatamodel2.git - - cd gdcdatamodel2 - - git checkout "$GDCDICTIONARY_TARGET_VERSION" || git checkout -b "$GDCDICTIONARY_TARGET_VERSION" - - git log -1 - - sed -i 's|version = .*|version ="'"$GDCDICTIONARY_TARGET_VERSION"'"|' plaster.toml - - sed -i 's/is_git_tag = .*/is_git_tag = false/' plaster.toml - - cat plaster.toml - - bash plaster - - git status - - rm setup.cfg dev-requirements.txt - artifacts: - paths: - - gdcdatamodel2 - expire_in: 1 week - rules: - - !reference [.override_gdcdictionary_version, rules] - - -release_datamodels_to_nexus: - image: docker.osdc.io/ncigdc/python36-builder:1.4.0 - stage: release_gdcdatamodel2 - script: - - cd gdcdatamodel2 - - ls -R . - - cat setup.cfg - - cat dev-requirements.txt - - whoami - - apt-get update - - apt-get install -y python3-venv - - pip3 install -U setuptools_scm build twine setuptools - - python3 -m setuptools_scm - - python3 -m build - - twine check dist/* - - twine upload dist/* - variables: - TWINE_USERNAME: ${TWINE_USER} - TWINE_PASSWORD: ${TWINE_PASSWORD} - artifacts: - paths: - - dist/*.whl - reports: - dotenv: vars.env - rules: # Override globally-defined RELEASE_REGISTRY - - if: $CI_COMMIT_TAG - when: always - variables: - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" - - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH - when: always - variables: - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" - - if: $CI_COMMIT_REF_NAME =~ /master/ - when: always - variables: - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" - - if: $CI_COMMIT_REF_NAME =~ /main/ - when: always - variables: - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" - - when: always - needs: ['update_reqs_for_gdcdatamodel2', 'execute_plaster'] - - -push_datamodels_to_github: - image: docker.osdc.io/ncigdc/python36-builder:1.4.0 - stage: release_gdcdatamodel2 - script: - - !reference [.load_github_key, script] - - cd gdcdatamodel2 - - cat setup.cfg - - cat dev-requirements.txt - - git status - - git add . - - git commit -m "Use gdcdictionary $GDCDICTIONARY_TARGET_VERSION $CI_COMMIT_SHA" - - git push origin "$GDCDICTIONARY_TARGET_VERSION" - allow_failure: true # failure when no changes of models - rules: - - !reference [.override_gdcdictionary_version, rules] - needs: ['update_reqs_for_gdcdatamodel2', 'execute_plaster'] From 027aefd49d39c333480249f173a8c2ca0ec98040 Mon Sep 17 00:00:00 2001 From: ProfOak Date: Mon, 5 Jun 2023 17:13:10 -0500 Subject: [PATCH 02/10] DEV-1834: add more python versions --- .gitlab-ci.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76dac8a29..5aecccc06 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -22,15 +22,10 @@ variables: TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-snapshots/" -tox: - image: ${BASE_CONTAINER_REGISTRY}/${REPO_PY_VERSION}-builder:${BASE_CONTAINER_VERSION} - before_script: - - mkdir -p /usr/share/man/man1 - .python_versions: parallel: matrix: - - REPO_PY_VERSION: ["python36"] + - REPO_PY_VERSION: ["python36", "python37", "python38", "python39"] docker_build: allow_failure: true From a7d4f159ba7b834a0a9cfbd51d43b3e365751eac Mon Sep 17 00:00:00 2001 From: Arthur Collet Date: Tue, 6 Jun 2023 13:22:44 -0500 Subject: [PATCH 03/10] Using 0.2.0 of gitlab-templates --- .gitlab-ci.yml | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5aecccc06..fdbad82c2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,36 +7,29 @@ stages: include: - project: nci-gdc/gitlab-templates - ref: master + ref: 0.2.0 file: - templates/global/full.yaml - templates/python/full.yaml -variables: - BASE_CONTAINER_VERSION: "1.4.0" - PRE_COMMIT_DOCKER_IMAGE: docker.osdc.io/ncigdc/python3.7-builder:2.2.0 - DOCKER_BUILDKIT: 1 - PIP_EXTRA_INDEX_URL: https://nexus.osdc.io/repository/pypi-all/simple - DOCKER_BUILD_OPTS: "--build-arg PIP_EXTRA_INDEX_URL=https://nexus.osdc.io/repository/pypi-all/simple" - DOCKER_PUSH_OPTS: "--all-tags" - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-snapshots/" - - .python_versions: parallel: matrix: - - REPO_PY_VERSION: ["python36", "python37", "python38", "python39"] - -docker_build: - allow_failure: true - rules: - - when: never - -release: - image: docker.osdc.io/ncigdc/python36-builder:1.4.0 - allow_failure: true - rules: - - when: never + - REPO_PY_VERSION: ["python3.7", "python3.8", "python3.9"] + +tox: + stage: test + image: ${BASE_CONTAINER_REGISTRY}/${REPO_PY_VERSION}-builder:${BASE_CONTAINER_VERSION} + script: + - pip install tox + - tox + +tox legacy: + stage: test + image: ${BASE_CONTAINER_REGISTRY}/python36-builder:${LEGACY_BASE_CONTAINER_VERSION} + script: + - pip install tox + - tox -e py36 .override_gdcdictionary_version: rules: From 7048e5ab4ed91a40deec2edb2fe17e08fdec7d7c Mon Sep 17 00:00:00 2001 From: Arthur Collet Date: Tue, 6 Jun 2023 13:28:25 -0500 Subject: [PATCH 04/10] Using 0.2.0 of gitlab-templates --- .gitlab-ci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fdbad82c2..e64fee78f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,14 +12,12 @@ include: - templates/global/full.yaml - templates/python/full.yaml -.python_versions: - parallel: - matrix: - - REPO_PY_VERSION: ["python3.7", "python3.8", "python3.9"] - tox: stage: test image: ${BASE_CONTAINER_REGISTRY}/${REPO_PY_VERSION}-builder:${BASE_CONTAINER_VERSION} + parallel: + matrix: + - REPO_PY_VERSION: ["python3.7", "python3.8", "python3.9"] script: - pip install tox - tox From 7b8e9916043ac61e604f6e08d7b54f551a8c5955 Mon Sep 17 00:00:00 2001 From: Arthur Collet Date: Tue, 6 Jun 2023 13:34:01 -0500 Subject: [PATCH 05/10] Specify tox environment --- .gitlab-ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e64fee78f..af33586da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,13 +14,13 @@ include: tox: stage: test - image: ${BASE_CONTAINER_REGISTRY}/${REPO_PY_VERSION}-builder:${BASE_CONTAINER_VERSION} + image: ${BASE_CONTAINER_REGISTRY}/python${REPO_PY_VERSION}-builder:${BASE_CONTAINER_VERSION} parallel: matrix: - - REPO_PY_VERSION: ["python3.7", "python3.8", "python3.9"] + - REPO_PY_VERSION: ["3.7", "3.8", "3.9"] script: - pip install tox - - tox + - tox -e ${REPO_PY_VERSION} tox legacy: stage: test From 1212534991bd4dea2189262277140c9cb52c4aac Mon Sep 17 00:00:00 2001 From: ProfOak Date: Wed, 7 Jun 2023 17:33:14 -0500 Subject: [PATCH 06/10] DEV-1834: add extra rule for tags ... and re-add stages removed in earlier commit --- .gitlab-ci.yml | 113 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index af33586da..766aa46cc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,11 +29,120 @@ tox legacy: - pip install tox - tox -e py36 +# These rules determine when the plaster steps execute. .override_gdcdictionary_version: rules: - if: $GDCDICTIONARY_TARGET_VERSION_OVERRIDE != null variables: GDCDICTIONARY_TARGET_VERSION: $GDCDICTIONARY_TARGET_VERSION_OVERRIDE - - when: always + - if: $CI_COMMIT_TAG != null variables: - GDCDICTIONARY_TARGET_VERSION: $CI_COMMIT_REF_NAME + GDCDICTIONARY_TARGET_VERSION: $CI_COMMIT_TAG + - if: $CI_COMMIT_REF_NAME =~ /^(master|main|release)/ + when: never + +update_reqs_for_gdcdatamodel2: + image: docker.osdc.io/ncigdc/python36-builder:1.4.0 + stage: build + script: + - !reference [.load_github_key, script] + - git clone git@github.com:NCI-GDC/gdcdatamodel2.git + - cd gdcdatamodel2 + - git checkout "$GDCDICTIONARY_TARGET_VERSION" || git checkout -b "$GDCDICTIONARY_TARGET_VERSION" + - git log -1 + - sed -i 's|gdcdictionary @ git+https://github.com/NCI-GDC/gdcdictionary.git@.*#egg=gdcdictionary|gdcdictionary @ git+https://github.com/NCI-GDC/gdcdictionary.git@'"$GDCDICTIONARY_TARGET_VERSION"'#egg=gdcdictionary|' setup.cfg + - cat setup.cfg + - pip3 --version + - pip3 install virtualenv pip-tools==6.3.0 + - pip-compile -i https://pypi.org/simple --extra=dev --output-file=dev-requirements.txt pyproject.toml + artifacts: + paths: + - gdcdatamodel2/setup.cfg + - gdcdatamodel2/dev-requirements.txt + expire_in: 1 week + rules: + - !reference [.override_gdcdictionary_version, rules] + +execute_plaster: + image: docker.osdc.io/ncigdc/python3.8-builder:2.1.0 + stage: build + script: + - !reference [.load_github_key, script] + - pwd + - git clone git@github.com:NCI-GDC/gdcdatamodel2.git + - cd gdcdatamodel2 + - git checkout "$GDCDICTIONARY_TARGET_VERSION" || git checkout -b "$GDCDICTIONARY_TARGET_VERSION" + - git log -1 + - sed -i 's|version = .*|version ="'"$GDCDICTIONARY_TARGET_VERSION"'"|' plaster.toml + - sed -i 's/is_git_tag = .*/is_git_tag = false/' plaster.toml + - cat plaster.toml + - bash plaster + - git status + - rm setup.cfg dev-requirements.txt + artifacts: + paths: + - gdcdatamodel2 + expire_in: 1 week + rules: + - !reference [.override_gdcdictionary_version, rules] + +release_datamodels_to_nexus: + image: docker.osdc.io/ncigdc/python36-builder:1.4.0 + stage: release_gdcdatamodel2 + script: + - cd gdcdatamodel2 + - ls -R . + - cat setup.cfg + - cat dev-requirements.txt + - whoami + - apt-get update + - apt-get install -y python3-venv + - pip3 install -U setuptools_scm build twine setuptools + - python3 -m setuptools_scm + - python3 -m build + - twine check dist/* + - twine upload dist/* + variables: + TWINE_USERNAME: ${TWINE_USER} + TWINE_PASSWORD: ${TWINE_PASSWORD} + artifacts: + paths: + - dist/*.whl + reports: + dotenv: vars.env + rules: # Override globally-defined RELEASE_REGISTRY + - if: $CI_COMMIT_TAG + when: always + variables: + TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH + when: always + variables: + TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" + - if: $CI_COMMIT_REF_NAME =~ /master/ + when: always + variables: + TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" + - if: $CI_COMMIT_REF_NAME =~ /main/ + when: always + variables: + TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" + - when: always + needs: ['update_reqs_for_gdcdatamodel2', 'execute_plaster'] + +push_datamodels_to_github: + image: docker.osdc.io/ncigdc/python36-builder:1.4.0 + stage: release_gdcdatamodel2 + script: + - !reference [.load_github_key, script] + - cd gdcdatamodel2 + - cat setup.cfg + - cat dev-requirements.txt + - git status + - git add . + - git commit -m "Use gdcdictionary $GDCDICTIONARY_TARGET_VERSION $CI_COMMIT_SHA" + - git push origin "$GDCDICTIONARY_TARGET_VERSION" + allow_failure: true # failure when no changes of models + rules: + - !reference [.override_gdcdictionary_version, rules] + needs: ['update_reqs_for_gdcdatamodel2', 'execute_plaster'] From 8f87d9756bce20abebb57ce571f8105476b98bd4 Mon Sep 17 00:00:00 2001 From: ProfOak Date: Thu, 8 Jun 2023 12:30:33 -0500 Subject: [PATCH 07/10] DEV-1834: add back missing stages --- .gitlab-ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 766aa46cc..3f71bea0f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,8 @@ stages: - test + - build + - release_gdcdatamodel2 include: - project: nci-gdc/gitlab-templates From 856547700d49d5dc45111c894fb31225eafc9527 Mon Sep 17 00:00:00 2001 From: ProfOak Date: Thu, 8 Jun 2023 13:07:08 -0500 Subject: [PATCH 08/10] DEV-1834: Replace needs with dependencies The needs keyword is for out-of-order build stages. We keep the processes in order but we only want the full sequence to go if the rules are met for the first build step. --- .gitlab-ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3f71bea0f..c56e9161a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -130,7 +130,9 @@ release_datamodels_to_nexus: variables: TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" - when: always - needs: ['update_reqs_for_gdcdatamodel2', 'execute_plaster'] + dependencies: + - update_reqs_for_gdcdatamodel2 + - execute_plaster push_datamodels_to_github: image: docker.osdc.io/ncigdc/python36-builder:1.4.0 @@ -147,4 +149,6 @@ push_datamodels_to_github: allow_failure: true # failure when no changes of models rules: - !reference [.override_gdcdictionary_version, rules] - needs: ['update_reqs_for_gdcdatamodel2', 'execute_plaster'] + dependencies: + - update_reqs_for_gdcdatamodel2 + - execute_plaster From fcd124ab8272045dc5eda88a52c5a7517d20523e Mon Sep 17 00:00:00 2001 From: ProfOak Date: Thu, 8 Jun 2023 14:28:26 -0500 Subject: [PATCH 09/10] DEV-1834: Change rules block on final build step --- .gitlab-ci.yml | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c56e9161a..b2c115b82 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -112,24 +112,8 @@ release_datamodels_to_nexus: - dist/*.whl reports: dotenv: vars.env - rules: # Override globally-defined RELEASE_REGISTRY - - if: $CI_COMMIT_TAG - when: always - variables: - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" - - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH - when: always - variables: - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" - - if: $CI_COMMIT_REF_NAME =~ /master/ - when: always - variables: - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" - - if: $CI_COMMIT_REF_NAME =~ /main/ - when: always - variables: - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-releases/" - - when: always + rules: + - !reference [.override_gdcdictionary_version, rules] dependencies: - update_reqs_for_gdcdatamodel2 - execute_plaster From f72d3e4770a1affefebc0c51d073a40531c090fc Mon Sep 17 00:00:00 2001 From: ProfOak Date: Tue, 11 Jul 2023 15:30:04 -0500 Subject: [PATCH 10/10] DEV-1834: re-remove variables They get pulled from the gitlab templates repo. --- .gitlab-ci.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 334913a1d..b2c115b82 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,15 +14,6 @@ include: - templates/global/full.yaml - templates/python/full.yaml -variables: - BASE_CONTAINER_VERSION: "1.4.0" - PRE_COMMIT_DOCKER_IMAGE: docker.osdc.io/ncigdc/python3.7-builder:2.2.0 - DOCKER_BUILDKIT: 1 - PIP_EXTRA_INDEX_URL: https://nexus.osdc.io/repository/pypi-all/simple - DOCKER_BUILD_OPTS: "--build-arg PIP_EXTRA_INDEX_URL=https://nexus.osdc.io/repository/pypi-all/simple" - DOCKER_PUSH_OPTS: "--all-tags" - TWINE_REPOSITORY_URL: "https://nexus.osdc.io/repository/pypi-snapshots/" - tox: stage: test image: ${BASE_CONTAINER_REGISTRY}/python${REPO_PY_VERSION}-builder:${BASE_CONTAINER_VERSION}