Skip to content

Commit

Permalink
Made proposal usage for jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
michelu89 committed Apr 26, 2024
1 parent 7ff4f0c commit f889fee
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
24 changes: 20 additions & 4 deletions .github/workflows/pull_request_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,29 @@ jobs:
# env:
# TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Trigger Jenkins Job, for signing executable
- name: Commit artifact_url and version changes and push to pre release branch for jenkins
if: matrix.os == 'windows-latest'
shell: bash
run: |
ARTIFACT_URL="https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend/actions/runs/8847860794/artifacts/1450721842"
ENCODED_URL=$(echo "$ARTIFACT_URL" | jq -sRr @uri)
PARAMS="artifact_url=$ENCODED_URL&version=0.0.1"
BRANCH_NAME="pre_release_configuration"
echo "artifact_url=$ENCODED_URL" > parameters.txt
echo "version=0.0.1" >> parameters.txt
git config --global user.email "github-actions@github.com"
git config --global user.name "github-actions"
git checkout -b $BRANCH_NAME
git add parameters.txt
git commit -m "Add parameters.txt with artifact_url and version"
git push origin $BRANCH_NAME
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Trigger Jenkins Job, for signing executable
if: matrix.os == 'windows-latest'
shell: bash
run: |
DATA='{"repository": {"url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "html_url": "https://github.com/eclipse-esmf/esmf-aspect-model-editor-backend", "owner": { "name": "ESMF"}}, "pusher": { "name": "GitHub Action", "email": "esmf-dev@eclipse.org"}}'
SHA1="$(echo -n "${DATA}" | openssl dgst -sha1 -hmac "${WEBHOOK_SECRET}" | sed 's/SHA1(stdin)= //')"
curl -X POST https://ci.eclipse.org/esmf/github-webhook/ -H "Content-Type: application/json" -H "X-GitHub-Event: push" -H "X-Hub-Signature: sha1=${SHA1}" -d "${DATA}" -d artifact_url=$ARTIFACT_URL
curl -X POST https://ci.eclipse.org/esmf/github-webhook/ -H "Content-Type: application/json" -H "X-GitHub-Event: push" -H "X-Hub-Signature: sha1=${SHA1}" -d "${DATA}"
19 changes: 14 additions & 5 deletions .jenkins/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,24 @@ pipeline {
GITHUB_TOKEN = credentials('github-bot-token')
}

parameters {
string(name: 'artifact_url', defaultValue: '', description: 'Artifact Url')
string(name: 'version', defaultValue: '', description: 'Release Version')
}
stages {
stage('Read parameters file') {
steps {
script {
// Read properties file
def props = readProperties file: 'parameters.txt'

// Set environment variables
env.artifact_url = props['artifact_url']
env.version = props['version']
}
}
}

stages {
stage('Example') {
steps {
echo "Artifact URL: ${params.artifact_url}"
echo "Artifact URL: ${env.artifact_url}"
echo "VERSION: ${env.VERSION}"
}
}
Expand Down

0 comments on commit f889fee

Please sign in to comment.