Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Build Che Theia generator on image build if it was changed in any way #441

Merged
merged 1 commit into from
Sep 25, 2019

Conversation

mmorhun
Copy link
Contributor

@mmorhun mmorhun commented Sep 17, 2019

Signed-off-by: Mykola Morhun mmorhun@redhat.com

What does this PR do?

Rebuild Che Theia generator when cache assembly is out of date.

Before we used previously built artifact if it existed on disk and with such approach we're loosing new changes in the generator.
Now the generator is built when there is a change in the generator source code or the last commit which has changed the generator is newer than built assembly.

Should provide fix for eclipse-che/che#14555

What issues does this PR fix or reference?

eclipse-che/che#14555

Copy link
Contributor

@benoitf benoitf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we compare date of tgz and generator directory ?

If directory is more recent then we regenerate the tgz ?

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 17, 2019

@benoitf I see no clear way of doing it. I've tried on my Fedora 30 to change a file inside subdirectory of tested directory and modification time of the top directory hasn't been changed. Also we do not know FS settings, like noatime etc. So it is safer to rebuild each time (and the script is easier to understand and maintain). Yes we'll lose ~20-30 seconds on build, but it worst them, I think.
But if you have some ides - will be glad to know.

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 17, 2019

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Sep 17, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has been successful:

@dmytro-ndp
Copy link
Contributor

ci-build

@che-bot
Copy link
Contributor

che-bot commented Sep 17, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has been successful:

@benoitf
Copy link
Contributor

benoitf commented Sep 17, 2019

@mmorhun

I would check the last git modification for generator folder

git log -1 --pretty=%ct -- generator

and compare it to .tgz file (if tgz is older than the git log date it needs to be generated again)

and check if we have dirty files in generator folder as well and if it's the case, we generate again as well

$ git status generator --porcelain

(if not empty output, generate again)

@mmorhun mmorhun changed the title Always build Che Theia generator on image build Build Che Theia generator on image build if it was changed in any way Sep 18, 2019
@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 18, 2019

@benoitf I've updated the PR, please review it again. Also would be great if you test the changes.

@che-bot
Copy link
Contributor

che-bot commented Sep 18, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 18, 2019

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Sep 18, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has been successful:

@benoitf
Copy link
Contributor

benoitf commented Sep 19, 2019

@mmorhun
FYI I have on macOS:

$ ./build.sh 
stat: illegal option -- -
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
./build.sh: line 33: [: 1566559750: unary operator expected
Copying Che Theia generator assembly

you could use date command instead as it's working fine on BSD/macOS

on macOs:

$ date -r generator/eclipse-che-theia-generator.tgz +%s
1564557705

on Linux:

$ docker run --rm -it -v $(pwd):/foo fedora stat --format=%Y /foo/generator/eclipse-che-theia-generator.tgz
1564557705

$ docker run --rm -it -v $(pwd):/foo fedora  date -r /foo/generator/eclipse-che-theia-generator.tgz +%s
1564557705

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 19, 2019

@benoitf thanks for letting me know. I have no Mac device to test, so please test it again)

Copy link
Contributor

@benoitf benoitf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested without tgz file, with a local change or a re-run and all is working as expected 👍

thx @mmorhun

@che-bot
Copy link
Contributor

che-bot commented Sep 19, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 19, 2019

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Sep 19, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 20, 2019

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Sep 20, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@che-bot
Copy link
Contributor

che-bot commented Sep 20, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 24, 2019

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Sep 24, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@benoitf
Copy link
Contributor

benoitf commented Sep 24, 2019

do we know what is the issue with the happy path ?

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 24, 2019

@benoitf the test failed with timeout on clone project, I think we can try to rerun it.

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 24, 2019

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Sep 24, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 25, 2019

crw-ci-test

@eclipse-che eclipse-che deleted a comment from che-bot Sep 25, 2019
@che-bot
Copy link
Contributor

che-bot commented Sep 25, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

Signed-off-by: Mykola Morhun <mmorhun@redhat.com>
@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 25, 2019

Rebased

@che-bot
Copy link
Contributor

che-bot commented Sep 25, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 25, 2019

crw-ci-test

@benoitf
Copy link
Contributor

benoitf commented Sep 25, 2019

@mmorhun I think you need to rebase again

@che-bot
Copy link
Contributor

che-bot commented Sep 25, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@mmorhun
Copy link
Contributor Author

mmorhun commented Sep 25, 2019

crw-ci-test

@che-bot
Copy link
Contributor

che-bot commented Sep 25, 2019

E2E Happy path tests of Eclipse Che Single User on K8S (minikube v1.1.1) has failed:

@dmytro-ndp
Copy link
Contributor

dmytro-ndp commented Sep 25, 2019

@mmorhun: this PR check had failed because of new Happy path tests issue eclipse-che/che#14660

@mmorhun mmorhun merged commit 2e5ef70 into master Sep 25, 2019
@mmorhun mmorhun deleted the fix-generator-cache-issue branch September 25, 2019 14:43
vinokurig pushed a commit that referenced this pull request Apr 6, 2021
Signed-off-by: Eric Williams <ericwill@redhat.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants