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

[Bug]: SignArtifacts.groovy clones opensearch-build in the workspace and not in a folder #1436

Closed
abhinavGupta16 opened this issue Jan 7, 2022 · 7 comments · Fixed by opensearch-project/opensearch-build-libraries#117
Assignees
Labels
bug Something isn't working

Comments

@abhinavGupta16
Copy link
Contributor

abhinavGupta16 commented Jan 7, 2022

Describe the bug

SignArtifacts.groovy currently clones the opensearch-build repo in the same workspace without creating a folder. This can cause issues since there might be other repositories that maybe cloning the their repositories and would mix up all the files in one directory.

To reproduce

Create a dummy job to clone any repository other than opensearch-build inside workspace on jenkins and call signer. After that, run ls $WORKSPACE to see files from both the repos in the same directory

Expected behavior

signArtifacts.groovy should create a separate temp folder to clone and run the commands for signing process

Acceptance Criteria

  • signArtifacts works in an isolated directory that it creates
  • all previous jobs should be able to run signAritfacts as expected (promoteArtifacts-job, signArtifacts-job, data-prepper-job)

Screenshots

If applicable, add screenshots to help explain your problem.

Host / Environment

No response

Additional context

No response

Relevant log output

data-prepper job for example clones data-prepper repository and signer clones opensearch-build and below are the contents of the final workspace with files from both repositories mixed in a single folder

+ ls /var/jenkins/workspace/Playground/david-abhng-dataprepper-job
ADMINS.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
DEVELOPER_GUIDE.md
LICENSE.txt
MAINTAINERS.md
NOTICE
ONBOARDING.md
Pipfile
Pipfile.lock
README.md
assemble.sh
build
build.gradle
build.sh
checkout.sh
ci.sh
config
data-prepper-api
data-prepper-core
data-prepper-logstash-configuration
data-prepper-plugins
deployment
docker
gradle
gradle.properties
gradlew
gradlew.bat
jenkins
lib
manifests
manifests.sh
meta
opensearch.pgp
publish
pyproject.toml
pytest.ini
release
release-notes
run.sh
scripts
settings.gradle
sign.sh
src
test.sh
tests
tools
vars
whitesource.config
zenhub_tab_image.png
@abhinavGupta16 abhinavGupta16 added bug Something isn't working untriaged Issues that have not yet been triaged labels Jan 7, 2022
@dblock
Copy link
Member

dblock commented Jan 10, 2022

All jobs should be executing inside docker contains with separate file systems and not walk over each-other.

@abhinavGupta16
Copy link
Contributor Author

All jobs should be executing inside docker contains with separate file systems and not walk over each-other.

Yes. But we can have multiple repositories being clones inside the same job. Updated the description log output for better explanation

@gaiksaya gaiksaya removed the untriaged Issues that have not yet been triaged label Jan 11, 2022
@prudhvigodithi
Copy link
Member

I dont see this a breaking issue, for the fact the build repo workflows has to be called with scripts being on the workspace folder example as ./build.sh, ./test.sh, having a separate copy in another folder would end changing the logic, but long story short is this still valid @gaiksaya @peterzhuamazon ?

@gaiksaya
Copy link
Member

We can remove the cloning logic from this library and let the workspace take care of the execution of .sign.sh similar to test and build.sh

@peterzhuamazon
Copy link
Member

This was at a time when we are not sure about how Jenkins workspace default git clone runs.
We can ignore this issue for now.

@gaiksaya
Copy link
Member

Hi @peterzhuamazon looks like this is still issue. Do you know if there is a workaround?

@gaiksaya
Copy link
Member

The below solution works:
Adding a dir

        if (!fileExists("$WORKSPACE/sign.sh")) {
            dir('opensearch-build'){
            git url: 'https://github.com/opensearch-project/opensearch-build.git', branch: 'main'
            }
        }

Let me know if anyone has any better solution. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
5 participants