-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from jduimovich/ci-updates-jenkins
update to ci-test
- Loading branch information
Showing
8 changed files
with
115 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
#!/bin/bash | ||
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" | ||
|
||
ENV="MY_JENKINS_SERVER MY_JENKINS_USER MY_JENKINS_BUILD_TOKEN MY_JENKINS_TOKEN COSIGN_SECRET_PASSWORD COSIGN_SECRET_KEY COSIGN_PUBLIC_KEY " | ||
|
||
ENV+=" ACS__API_TOKEN ACS__CENTRAL_ENDPOINT GITOPS_AUTH_PASSWORD " | ||
source $SCRIPTDIR/../rhtap/verify-deps-exist "$ENV" "java " | ||
ENV="MY_JENKINS_SERVER MY_JENKINS_USER MY_JENKINS_BUILD_TOKEN MY_JENKINS_TOKEN" | ||
source $SCRIPTDIR/../rhtap/verify-deps-exist "$ENV" "curl " | ||
|
||
PNAME=$1 | ||
if [ -z $PNAME ]; then | ||
echo $0 pipelinename | ||
exit 0 | ||
fi | ||
|
||
curl -X POST -u $MY_JENKINS_USER:$MY_JENKINS_TOKEN \ | ||
$MY_JENKINS_SERVER/job/$PNAME/build?token=$MY_JENKINS_BUILD_TOKEN | ||
http_code=$(curl -s -w "%{http_code}" -u $MY_JENKINS_USER:$MY_JENKINS_TOKEN \ | ||
${MY_JENKINS_SERVER}job/$PNAME/build?token=$MY_JENKINS_BUILD_TOKEN) | ||
|
||
echo "Started pipeline $PNAME http_code = $http_code" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/bash | ||
SCRIPTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" > /dev/null 2>&1 && pwd)" | ||
|
||
# Copy the jenkins file contents the shared library | ||
# Can be used to update the release by setting | ||
# JENKIN_SHARED_LIB_USER=redhat-appstudio | ||
# JENKIN_SHARED_LIB_BRANCH=main | ||
# For dev the default is MY_GITHUB_USER and dev branch | ||
# see ci-test for branch munging in scripts | ||
# JENKIN_SHARED_LIB_USER=$MY_GITHUB_USER | ||
# JENKIN_SHARED_LIB_BRANCH=dev | ||
|
||
JENKIN_SHARED_LIB_USER=${JENKIN_SHARED_LIB_USER:-$MY_GITHUB_USER} | ||
JENKIN_SHARED_LIB_BRANCH=${JENKIN_SHARED_LIB_BRANCH:-dev} | ||
|
||
echo "Updating Jenkins shared lib for $JENKIN_SHARED_LIB_USER in branch $JENKIN_SHARED_LIB_BRANCH" | ||
|
||
WORKDIR=$(mktemp -d) | ||
JENKINS_SHARED_LIB=$WORKDIR/jenkins-library | ||
REPO=https://github.com/$JENKIN_SHARED_LIB_USER/tssc-sample-jenkins | ||
|
||
MULTI_CI=$(pwd) | ||
GEN_SRC=$MULTI_CI/generated/source-repo | ||
GEN_GITOPS=$MULTI_CI/generated/gitops-template | ||
|
||
git clone --quiet $REPO $JENKINS_SHARED_LIB | ||
cd $JENKINS_SHARED_LIB | ||
if [ $(git rev-parse --verify $JENKIN_SHARED_LIB_BRANCH 2> /dev/null) ]; then | ||
echo "$JENKIN_SHARED_LIB_BRANCH exists" | ||
git checkout $JENKIN_SHARED_LIB_BRANCH | ||
git pull | ||
else | ||
echo "$JENKIN_SHARED_LIB_BRANCH branch created" | ||
git checkout -b $JENKIN_SHARED_LIB_BRANCH | ||
git branch --set-upstream-to=origin/$JENKIN_SHARED_LIB_BRANCH | ||
fi | ||
|
||
# copy scripts and groovy files in to proper locations | ||
# delete extra files - We should move these outside of ./rhtap | ||
# so we don't copy extra files by mistake | ||
cp $MULTI_CI/rhtap/* $JENKINS_SHARED_LIB/resources | ||
cp $MULTI_CI/rhtap.groovy $JENKINS_SHARED_LIB/vars | ||
# skip the env.template.sh files, they are not for the library | ||
# we should consider copying the Jenkins files for gitops and src into a jenkinsfile-samples | ||
# so the latest Jenkinsfile is up to date in the library | ||
rm -rf $JENKINS_SHARED_LIB/resources/env.template.sh | ||
rm -rf $JENKINS_SHARED_LIB/resources/signing-secret-env.sh | ||
git add . | ||
git commit -m "Jenkins library update from tssc-dev-multi-ci" | ||
git status | ||
pwd | ||
git pull | ||
git push --set-upstream origin $JENKIN_SHARED_LIB_BRANCH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters