From a8631701091142fb08f7aa56ccd5b6dc509c4e3a Mon Sep 17 00:00:00 2001 From: Hannes Wellmann Date: Wed, 3 Jan 2024 14:53:17 +0100 Subject: [PATCH] [FIXUP] try to fix Git LFS installation --- .github/workflows/maven.yml | 4 ---- Jenkinsfile | 45 ++++++++++++++++++++++++++++++------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index c62c4678bb0..e94f22d6f03 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -37,7 +37,6 @@ jobs: - name: checkout swt uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 with: - path: 'eclipse.platform.swt' #TODO: is this still necessary? fetch-depth: 0 # required for jgit timestamp provider to work lfs: true - name: Install Linux requirements @@ -58,7 +57,6 @@ jobs: with: run: >- mvn --batch-mode -V -U - -DforceContextQualifier=zzz -DforkCount=1 -Dcompare-version-with-baselines.skip=false -Dmaven.compiler.failOnWarning=true @@ -66,7 +64,6 @@ jobs: -DskipNativeTests=false -DfailIfNoTests=false clean install - working-directory: eclipse.platform.swt - name: Performance tests if: contains(github.event.pull_request.labels.*.name, 'performance') uses: coactions/setup-xvfb@b6b4fcfb9f5a895edadc3bc76318fae0ac17c8b3 # v1.0.1 @@ -81,7 +78,6 @@ jobs: -DfailIfNoTests=true -Dtest=PerformanceTests integration-test - working-directory: eclipse.platform.swt/tests/org.eclipse.swt.tests - name: Upload Test Results for ${{ matrix.config.name }} / Java-${{ matrix.java }} if: always() uses: actions/upload-artifact@c7d193f32edcb7bfad88892161225aeda64e9392 # v4.0.0 diff --git a/Jenkinsfile b/Jenkinsfile index 304e443f1cf..af980555057 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -74,6 +74,9 @@ pipeline { } stages { stage('Checkout swt git repos') { + environment { + PATH = "${WORKSPACE}/tools/git-lfs:${env.PATH}" // Add git-lfs (installed subsequently) to PATH explicitly until it is available by default + } steps { dir('tools') { // download git-lfs until it is available by default sh ''' @@ -81,7 +84,6 @@ pipeline { mv git-lfs-* git-lfs ''' } - withEnv(["PATH=${WORKSPACE}/tools/git-lfs:" + env.PATH]) { dir('eclipse.platform.swt') { checkout scm script { @@ -93,20 +95,42 @@ pipeline { error('Abort build only triggered by automated SWT-natives update.') } } + // Temporarily install hooks manually + writeFile(file:'.git/hooks/pre-push', text:''' + #!/bin/sh + command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'pre-push' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; } + git lfs pre-push "$@" + ''') + writeFile(file:'.git/hooks/post-checkout', text:''' + #!/bin/sh + command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-checkout' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; } + git lfs post-checkout "$@" + ''') + writeFile(file:'.git/hooks/post-commit', text:''' + #!/bin/sh + command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-commit' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; } + git lfs post-commit "$@" + ''') + writeFile(file:'.git/hooks/post-merge', text:''' + #!/bin/sh + command -v git-lfs >/dev/null 2>&1 || { echo >&2 "\nThis repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting the 'post-merge' file in the hooks directory (set by 'core.hookspath'; usually '.git/hooks').\n"; exit 2; } + git lfs post-merge "$@" + ''') sh ''' - echo $PATH git version git lfs version - git lfs install --local # install Git LFS only locally for the repository + git lfs install --local --skip-repo # install Git LFS only locally for the repository but skip the hooks that have been added manually above git lfs pull git fetch --all --tags --quiet git remote set-url --push origin git@github.com:eclipse-platform/eclipse.platform.swt.git ''' } - } } } stage('Check if SWT-binaries build is needed') { + environment { + PATH = "${WORKSPACE}/tools/git-lfs:${env.PATH}" // Add git-lfs (installed subsequently) to PATH explicitly until it is available by default + } steps { withAnt(installation: 'apache-ant-latest', jdk: 'openjdk-jdk11-latest') { // nashorn javascript-engine required in ant-scripts sh''' @@ -183,8 +207,9 @@ pipeline { ls -1R libs ''' } else { - withEnv(['PATH=C:\\tools\\cygwin\\bin;' + env.PATH]) { + withEnv(['PATH=C:\\tools\\cygwin\\bin;' + env.PATH.replace(':',';')]) { bat ''' + echo %PATH% unzip org.eclipse.swt.%PLATFORM%.master.zip rm org.eclipse.swt.%PLATFORM%.master.zip mkdir libs @@ -260,6 +285,9 @@ pipeline { } } stage('Commit SWT-native binaries, if build') { + environment { + PATH = "${WORKSPACE}/tools/git-lfs:${env.PATH}" // Add git-lfs (installed subsequently) to PATH explicitly until it is available by default + } when { expression { return params.forceNativeBuilds || fileExists ('tmp/build_changed.txt') } } @@ -297,7 +325,7 @@ pipeline { sh ''' mvn clean verify \ --batch-mode -DforkCount=0 \ - -DforceContextQualifier=zzz + -DforceContextQualifier=zzz \ -Dcompare-version-with-baselines.skip=false -Dmaven.compiler.failOnWarning=true \ -Dmaven.test.failure.ignore=true -Dmaven.test.error.ignore=true ''' @@ -314,6 +342,9 @@ pipeline { } } stage('Push SWT-native binaries, if build') { + environment { + PATH = "${WORKSPACE}/tools/git-lfs:${env.PATH}" // Add git-lfs (installed subsequently) to PATH explicitly until it is available by default + } when { expression { return params.forceNativeBuilds || fileExists ('tmp/build_changed.txt') } } @@ -325,7 +356,6 @@ pipeline { newSWTNativesTag = sh(script: 'git describe --abbrev=0 --tags --match v[0-9][0-9][0-9][0-9]*', returnStdout: true).strip() } echo "newSWTNativesTag: ${newSWTNativesTag}" - withEnv(["PATH=${WORKSPACE}/tools/git-lfs:" + env.PATH]) { //TODO: remove this once GIT-LFS is installed by default sh """ # Check for the master-branch as late as possible to have as much of the same behaviour as possible if [[ '${BRANCH_NAME}' == master ]] || [[ '${BRANCH_NAME}' =~ R[0-9]+_[0-9]+(_[0-9]+)?_maintenance ]]; then @@ -350,7 +380,6 @@ pipeline { git log -n 2 popd """ - } } } }