[ci] Convert to DAG and commit windows artifacts from Linux, because SSH in Windows is really stubborn

This commit is contained in:
Fabian 2022-09-30 19:33:34 +02:00
parent 845cc1ca16
commit 123ea65f2b

View File

@ -15,15 +15,7 @@ workflow:
when: never when: never
- when: always - when: always
stages:
- prepare
- build
- deploy
- release
prepare: prepare:
stage: prepare
before_script: before_script:
- pip install setuptools_scm>=6.2 - pip install setuptools_scm>=6.2
script: script:
@ -41,7 +33,6 @@ prepare:
dotenv: build.env dotenv: build.env
update_windows_deps: update_windows_deps:
stage: prepare
tags: tags:
- shared-windows - shared-windows
- windows - windows
@ -59,26 +50,32 @@ update_windows_deps:
- Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" - Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
- choco install python --version=$PYTHON_VERSION -y --no-progress - choco install python --version=$PYTHON_VERSION -y --no-progress
- refreshenv - refreshenv
#- ssh -V
#- choco install openssh dos2unix -y --no-progress
- ssh -V
- python --version - python --version
- pip install pipenv - pip install pipenv
- Get-Service -Name ssh-agent | Set-Service -StartupType Manual script:
- ssh-agent - pipenv lock --dev --keep-outdated
#- dos2unix "${WINDOWS_SSH_PRIVATE_KEY}" artifacts:
#- cat "${WINDOWS_SSH_PRIVATE_KEY}" | ssh-add - paths:
- Pipfile.lock
# commit from linux, because setting up SSH in Windows is a fucking nightmare
commit_windows_deps:
needs:
- update_windows_deps
image: alpine
before_script:
- apk add --update git openssh-client
- eval $(ssh-agent -s)
- echo $env:WINDOWS_SSH_PRIVATE_KEY | & ssh-add - - echo $env:WINDOWS_SSH_PRIVATE_KEY | & ssh-add -
- git config --global user.name "Gitlab CI" - git config --global user.name "Gitlab CI"
- git config --global user.email "ci@gitlab.com" - git config --global user.email "ci@gitlab.com"
script: script:
- pipenv lock --dev --keep-outdated
- git commit -m "Updated windows deps from CI" Pipfile.lock - git commit -m "Updated windows deps from CI" Pipfile.lock
- git push - git push
package_linux: package_linux:
stage: build needs:
- prepare
before_script: before_script:
- python --version - python --version
- pip install pipenv - pip install pipenv
@ -92,7 +89,8 @@ package_linux:
- dist/fime_linux_* - dist/fime_linux_*
package_windows: package_windows:
stage: build needs:
- prepare
tags: tags:
- shared-windows - shared-windows
- windows - windows
@ -111,8 +109,9 @@ package_windows:
paths: paths:
- dist/fime_windows_* - dist/fime_windows_*
pypi_package: pypi_upload:
stage: deploy needs:
- package_linux
environment: pypi environment: pypi
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
@ -121,8 +120,10 @@ pypi_package:
script: script:
- twine upload dist/fime-*.whl - twine upload dist/fime-*.whl
gitlab_package: gitlab_package_upload:
stage: deploy needs:
- package_linux
- package_windows
image: curlimages/curl:latest image: curlimages/curl:latest
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG
@ -134,7 +135,8 @@ gitlab_package:
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "dist/${WINDOWS_AMD64_BINARY}.exe" "${PACKAGE_REGISTRY_URL}/${WINDOWS_AMD64_BINARY}.exe" curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "dist/${WINDOWS_AMD64_BINARY}.exe" "${PACKAGE_REGISTRY_URL}/${WINDOWS_AMD64_BINARY}.exe"
release_job: release_job:
stage: release needs:
- gitlab_package_upload
image: registry.gitlab.com/gitlab-org/release-cli:latest image: registry.gitlab.com/gitlab-org/release-cli:latest
rules: rules:
- if: $CI_COMMIT_TAG - if: $CI_COMMIT_TAG