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

Tekton demo improvements #675

Merged
merged 1 commit into from
Sep 28, 2022
Merged

Conversation

mpryc
Copy link
Collaborator

@mpryc mpryc commented Sep 27, 2022

Couple of changes:

  1. Tekton demo can ran from local source tree (without -g flag).
  2. Running with -g flag ensures modifications to the pelorus git project happens in the temporary directory and not local source tree
  3. Better handling of branches:
    • if remote branch exists, use it
    • if remote branch does not exists, create one
  4. Cleanup function added.
  5. Ensure we don't pollute master branch.

Signed-off-by: Michal Pryc mpryc@redhat.com

Testing Instructions

Local directory run:
clone pelorus fork, run demo on existing branch or non-exising, e.g.

git clone git@github.com:mpryc/pelorus.git
cd pelorus
./demo-tekton.sh -r non_existing_remote_branch -c 3
# Create new branch existing_remote_branch using GitHub UI (to ensure script works fine with remote branches not synced to current clone):
./demo-tekton.sh -r existing_remote_branch -c 3

Temp directory

  • This is better as it works without polluting any of current files/branches from which script is being ran
  • Ensure -g url is provided to location where local user have commit access, most likely https is not the one...
cd pelorus
./demo-tekton.sh -r non_existing_remote_branch -c 3 -g git@github.com:mpryc/pelorus.git
# Create new branch existing_remote_branch using GitHub UI (to ensure script works fine with remote branches not synced to current clone):
./demo-tekton.sh -r existing_remote_branch -c 3 -g  git@github.com:mpryc/pelorus.git

Failing master, we really don't want to run this script with master branch...

./demo-tekton.sh -r master -c 3 -g  git@github.com:mpryc/pelorus.git

@redhat-cop/mdt

@weshayutin
Copy link
Contributor

There is quite a delay in the clean up. I think folks may think the script is hung. Suggestion is to log the cleanup as it works through or add a message it may take 2 minutes or so. :)

/var/tmp/PELORUS/pelorus1/demo
1. Namespace 'demoapp1' already exists
Clean up resources prior to execution:

@weshayutin
Copy link
Contributor

hrm.. still have a bug on the pelorus test.. unrelated to this PR

Test that Pelorus has found the latest git commit:
Build Type is buildconfig
test buildconfig: requires exporter named committime-exporter 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  2674  100  2674    0     0  15916      0 --:--:-- --:--:-- --:--:-- 15916

@mpryc mpryc force-pushed the demo_tekton_temp_dir branch from 50d1f58 to f7979d9 Compare September 27, 2022 20:45
@mpryc
Copy link
Collaborator Author

mpryc commented Sep 27, 2022

There is quite a delay in the clean up. I think folks may think the script is hung. Suggestion is to log the cleanup as it works through or add a message it may take 2 minutes or so. :)

/var/tmp/PELORUS/pelorus1/demo
1. Namespace 'demoapp1' already exists
Clean up resources prior to execution:

@weshayutin added some printf statements to be more informative what's happening.

@weshayutin
Copy link
Contributor

./demo-tekton.sh -b buildconfig -n demoapp1 -a demoapp1 -g https://github.com/weshayutin/pelorus.git  -r demoapp1  -c 12 -t 5

The current_branch is not substituted in the buildConfig in 05-

@weshayutin
Copy link
Contributor

weshayutin commented Sep 27, 2022

We would have to make sure we sync the branch name w/ the app name for this to work.. perhaps a fix

--- /tmp/meld-tmp3z5luvk2.yaml
+++ /home/whayutin/OPENSHIFT/git/KONVEYOR/PELORUS/upstream/pelorus/demo/tekton-demo-setup/05-build-and-deploy.yaml
@@ -22,8 +22,8 @@
       source:
         type: Git
         git:
-          uri: https://github.com/konveyor/pelorus
-          ref: master
+          uri: ${url}
+          ref: refs/heads/${APPLICATION_NAME}
         contextDir: "demo/python-example"
       strategy:
         sourceStrategy:

@mpryc mpryc force-pushed the demo_tekton_temp_dir branch from f7979d9 to 8699693 Compare September 28, 2022 09:13
@mpryc
Copy link
Collaborator Author

mpryc commented Sep 28, 2022

./demo-tekton.sh -b buildconfig -n demoapp1 -a demoapp1 -g https://github.com/weshayutin/pelorus.git  -r demoapp1  -c 12 -t 5

The current_branch is not substituted in the buildConfig in 05-

@weshayutin can't reproduce this. Maybe you are using old copy of this PR?

@mpryc
Copy link
Collaborator Author

mpryc commented Sep 28, 2022

We would have to make sure we sync the branch name w/ the app name for this to work.. perhaps a fix

--- /tmp/meld-tmp3z5luvk2.yaml
+++ /home/whayutin/OPENSHIFT/git/KONVEYOR/PELORUS/upstream/pelorus/demo/tekton-demo-setup/05-build-and-deploy.yaml
@@ -22,8 +22,8 @@
       source:
         type: Git
         git:
-          uri: https://github.com/konveyor/pelorus
-          ref: master
+          uri: ${url}
+          ref: refs/heads/${APPLICATION_NAME}
         contextDir: "demo/python-example"
       strategy:
         sourceStrategy:

Reworked a bit to include such. It's actually in 2 places, first is the template which takes the URI and REF and then it translates into tekton parameters.

Also added check if the Pelorus installation is suitable to run the demo (commit time properly monitoring namespace where we are building app).

@mpryc mpryc force-pushed the demo_tekton_temp_dir branch from 8699693 to 92644b1 Compare September 28, 2022 11:06
@mpryc
Copy link
Collaborator Author

mpryc commented Sep 28, 2022

/test 4.9-e2e-openshift

Couple of changes:
 1. Tekton demo can ran from local source tree (without -g flag).
 2. Running with -g flag ensures modifications to the pelorus git project
    happens in the temporary directory and not local source tree
 3. Better handling of branches:
    - if remote branch exists, use it
    - if remote branch does not exists, create one
 4. Cleanup function added.
 5. Fix binary build to allow multiple runs

Signed-off-by: Michal Pryc <mpryc@redhat.com>
@mpryc mpryc force-pushed the demo_tekton_temp_dir branch from 92644b1 to bf64946 Compare September 28, 2022 16:43
@weshayutin
Copy link
Contributor

Screenshot from 2022-09-28 11-03-02

multiple builds working on binary :) woot thanks!
buildConfig and s2i working as designed as well..

Tested w/

demo apps

./demo-tekton.sh -b buildconfig -n demoapp1 -a demoapp1 -g https://github.com/weshayutin/pelorus.git -r demoapp1 -c 12 -t 5
./demo-tekton.sh -b binary -n demoapp2 -a demoapp2 -g https://github.com/weshayutin/pelorus.git -r demoapp2 -c 12 -t 5
./demo-tekton.sh -b s2i -n demoapp3 -a demoapp3 -g https://github.com/weshayutin/pelorus.git -r demoapp3 -c 12 -t 5

@weshayutin weshayutin added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 28, 2022
@openshift-ci
Copy link

openshift-ci bot commented Sep 28, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: weshayutin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@weshayutin weshayutin merged commit 49bf2d5 into dora-metrics:master Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants