Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Jenkins sample to Cloud Pak for Data 4.5 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions samples/jenkins/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ To upload config file as a Jenkins secret, open the [credentials configuration p
Add the credentials with the following configuration:
- Kind: Secret file
- File: Select cpdctl configuration file copied in the previous step
- ID: CPDCTL_CPD402_CONFIG
- ID: CPDCTL_CPD450_CONFIG
- Description: Description of the credentials

![secret-file-credentials.png](img/secret-file-credentials.png)
Expand Down Expand Up @@ -136,7 +136,7 @@ into text files, located in the [pipelines](pipelines) directory. The division m
All of the pipelines have some common steps, to set up a working environment, install dependencies or to define the stage:
1. `node` - allocates an executor on a build agent (node) and runs further code in the context of a workspace on that agent.
In this sample, the default agent is used.
2. `withCredentials([file(credentialsId: 'CPDCTL_CPD402_CONFIG', variable: 'CPDCONFIG')])` - loads cpdctl configuration file
2. `withCredentials([file(credentialsId: 'CPDCTL_CPD450_CONFIG', variable: 'CPDCONFIG')])` - loads cpdctl configuration file
from a secret file uploaded to Jenkins in the Credentials section.
3. `checkout scm` - the code from the Source Control Management defined in the job configuration.
4. `stage` - defines the pipeline stage
Expand Down
2 changes: 1 addition & 1 deletion samples/jenkins/pipelines/dev
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node {
withCredentials([file(credentialsId: 'CPDCTL_CPD402_CONFIG', variable: 'CPDCONFIG')]) {
withCredentials([file(credentialsId: 'CPDCTL_CPD450_CONFIG', variable: 'CPDCONFIG')]) {
checkout scm

stage('Install cpdctl') {
Expand Down
2 changes: 1 addition & 1 deletion samples/jenkins/pipelines/prod
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node {
withCredentials([file(credentialsId: 'CPDCTL_CPD402_CONFIG', variable: 'CPDCONFIG')]) {
withCredentials([file(credentialsId: 'CPDCTL_CPD450_CONFIG', variable: 'CPDCONFIG')]) {
checkout scm

stage('Install cpdctl') {
Expand Down
2 changes: 1 addition & 1 deletion samples/jenkins/pipelines/test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node {
withCredentials([file(credentialsId: 'CPDCTL_CPD402_CONFIG', variable: 'CPDCONFIG')]) {
withCredentials([file(credentialsId: 'CPDCTL_CPD450_CONFIG', variable: 'CPDCONFIG')]) {
checkout scm

stage('Install cpdctl') {
Expand Down
9 changes: 6 additions & 3 deletions samples/jenkins/scripts/dev/train_model.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ notebook_id=$(find_asset notebook "train_model")
env_id=$(cpdctl environment list --output json -j "resources[?metadata.name=='$env_name'] | [0].metadata.asset_id" --raw-output)
echo "Using notebook environment '$env_name': $env_id"

cpd_url=$(cpdctl config profile get cpd --output json -j 'Profile.URL' --raw-output)
# assume there is only single profile configured
cpd_url=$(cpdctl config profile list --output json -j '[0].Profile.URL' --raw-output)

# assume there is only single user configured
user_name=$(cpdctl config user list --output json -j '[0].Name' --raw-output)
user_apikey=$(cpdctl config user get demouser --output json -j "User.Apikey.Value" --raw-output)
user=$(cpdctl config user list --output json -j '[0].Name' --raw-output)
user_name=$(cpdctl config user get "${user}" --output json -j 'User.Username' --raw-output)
user_apikey=$(cpdctl config user get "${user}" --output json -j "User.Apikey.Value" --raw-output)

cat > job.json <<-EOJSON
{
Expand Down
2 changes: 1 addition & 1 deletion samples/jenkins/scripts/test/create_test_space.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ls -al
unzip -l ${export_file}

timestamp=$(date "+%Y%m%d-%H%M%S")
test_space_name="test-space-${timestamp}"
test_space_name="mode-lifecycle-test-space-${timestamp}"

cpdctl space create --name ${test_space_name} --output json --jmes-query "metadata.id" --raw-output > ${test_space_id_file}

Expand Down