-
Notifications
You must be signed in to change notification settings - Fork 73
Integrating block-sync in an init-container #779
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
base: master
Are you sure you want to change the base?
Changes from all commits
e55d9dd
beec55f
1c39d4f
2c1f884
3e834aa
07476cd
23a7a07
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,8 @@ RUN mkdir -p /go/src/github.com | |
|
|
||
| COPY ./build.sh /go/src/github.com/build.sh | ||
|
|
||
| RUN chmod +x /go/src/github.com/build.sh | ||
| COPY ./key.sh /go/src/github.com/key.sh | ||
|
|
||
| RUN chmod +x /go/src/github.com/* | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should just give executable permission in this directory. This could create security issues. Just give all the known script names. |
||
|
|
||
| ENTRYPOINT ["/go/src/github.com/build.sh"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/bash | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's be more specific concerning the filename. |
||
|
|
||
| DIR="/go/src/github.com/prometheus/prometheus" | ||
|
|
||
| if [[ -z $PR_NUMBER || -z $STORAGE || -z $GITHUB_ORG || -z $GITHUB_REPO ]]; then | ||
| echo "ERROR:: environment variables not set correctly" | ||
| exit 1; | ||
| fi | ||
|
|
||
| # Clone the repository with a shallow clone | ||
| echo ">> Cloning repository $GITHUB_ORG/$GITHUB_REPO (shallow clone)" | ||
| if ! git clone --depth 1 https://github.com/$GITHUB_ORG/$GITHUB_REPO.git $DIR; then | ||
| echo "ERROR:: Cloning of repo $GITHUB_ORG/$GITHUB_REPO failed" | ||
| exit 1; | ||
| fi | ||
|
|
||
| cd $DIR || exit 1 | ||
|
|
||
| echo ">> Fetching Pull Request $GITHUB_ORG/$GITHUB_REPO/pull/$PR_NUMBER" | ||
| if ! git fetch origin pull/$PR_NUMBER/head:pr-branch; then | ||
| echo "ERROR:: Fetching of PR $PR_NUMBER failed" | ||
| exit 1; | ||
| fi | ||
|
|
||
| git checkout pr-branch | ||
|
|
||
| # Here, STORAGE is specified as an environment variable of the download-key init container, | ||
| # where it will copy the key.yml file from the Prometheus directory to the volume section of the | ||
| # emptyDir. This file will later be used by the data-downloader init container. | ||
| if [ -f "$DIR/bucket-config.yml" ]; then | ||
| echo "INFO:: bucket-config.yml file is Present on $DIR/bucket-config.yml directory so download the block from ObjecStorage." | ||
| cp "$DIR/bucket-config.yml" "$STORAGE/bucket-config.yml" | ||
| else | ||
| echo "INFO:: bucket-config.yml File does not exist on $DIR/bucket-config.yml directory so data is not downloaded from ObjectStorage." | ||
| fi | ||
Uh oh!
There was an error while loading. Please reload this page.