-
Notifications
You must be signed in to change notification settings - Fork 0
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
Refactor downloading Docker Compose bundle #31
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @culka and @jarkkoka)
development.sh
line 32 at r1 (raw file):
unzip jore4-docker-compose-bundle.zip "jore4-docker-compose-bundle-main/docker-compose/*" -d . mv jore4-docker-compose-bundle-main/docker-compose/* ./docker rm -rf jore4-docker-compose-bundle-main jore4-docker-compose-bundle.zip
Voit välttää temppitiedoston (tai jos et halua, niin talleta temppitiedosto /tmp:hen):
rm -rf docker
mkdir -p docker
curl -L https://github.com/HSLdevcom/jore4-docker-compose-bundle/archive/refs/heads/main.tar.gz \
| tar -xz \
-C ./docker \
--strip-components 2 \
--wildcards 'jore4-docker-compose-bundle-main/docker-compose/*'
ja kohdehakemisto kannattaa poistaa aluksi, jotta vanhoja tiedostoja ei jää
5c90577
to
142603f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @janneronkko and @jarkkoka)
development.sh
line 37 at r5 (raw file):
&& unzip -q /tmp/jore4-docker-compose-bundle.zip -d /tmp \ && mv /tmp/jore4-docker-compose-bundle-main/docker-compose/* ./docker \ && rm -fr \
&& rm
sijaan voisi käyttää mielummin ; rm
, suoritetaan poisto huolimatta siitä onnistuiko aiemmat operaatiot vai ei
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @culka and @jarkkoka)
development.sh
line 50 at r5 (raw file):
| head -1 \ | sed -E 's/.*"sha": "(.*)",/\1/' \ > ./docker/RELEASE_VERSION.txt
Kannattaa hakea jsonista data jq:lla:
curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/HSLdevcom/jore4-docker-compose-bundle/branches/main | jq -r .commit.sha
Teknisesti on mahdollista, että tässä RELEASE_VERSION.txt:hen tulee väärä commit SHA, koska on mahdollista, että muutoksia pusketaan juuri silloin kun skriptiä ajetaan, jolloin haettu paketti tulee eri commitista kuin haettu versio.
Eli muuta järjestystä ja hae sisältö commit SHA:n perusteella (en testannut alla olevaa koodia, muuten kuin jq-komennon osalta että se toimii varmasti):
commit_sha=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/HSLdevcom/jore4-docker-compose-bundle/branches/main | jq -r .commit.sha)
curl -sL https://github.com/HSLdevcom/jore4-docker-compose-bundle/archive/${commit_sha}.zip \
-o /tmp/jore4-docker-compose-bundle.zip \
&& unzip -q /tmp/jore4-docker-compose-bundle.zip -d /tmp \
&& mv /tmp/jore4-docker-compose-bundle-${commit_sha}/docker-compose/* ./docker \
&& rm -fr \
/tmp/jore4-docker-compose-bundle.zip \
/tmp/jore4-docker-compose-bundle-main/
echo ${commit_sha} >> .docker/RELEASE_VERSION.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @culka and @jarkkoka)
development.sh
line 50 at r5 (raw file):
Previously, janneronkko (Janne Rönkkö) wrote…
Kannattaa hakea jsonista data jq:lla:
curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/HSLdevcom/jore4-docker-compose-bundle/branches/main | jq -r .commit.sha
Teknisesti on mahdollista, että tässä RELEASE_VERSION.txt:hen tulee väärä commit SHA, koska on mahdollista, että muutoksia pusketaan juuri silloin kun skriptiä ajetaan, jolloin haettu paketti tulee eri commitista kuin haettu versio.
Eli muuta järjestystä ja hae sisältö commit SHA:n perusteella (en testannut alla olevaa koodia, muuten kuin jq-komennon osalta että se toimii varmasti):
commit_sha=$(curl -s -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/HSLdevcom/jore4-docker-compose-bundle/branches/main | jq -r .commit.sha) curl -sL https://github.com/HSLdevcom/jore4-docker-compose-bundle/archive/${commit_sha}.zip \ -o /tmp/jore4-docker-compose-bundle.zip \ && unzip -q /tmp/jore4-docker-compose-bundle.zip -d /tmp \ && mv /tmp/jore4-docker-compose-bundle-${commit_sha}/docker-compose/* ./docker \ && rm -fr \ /tmp/jore4-docker-compose-bundle.zip \ /tmp/jore4-docker-compose-bundle-main/ echo ${commit_sha} >> .docker/RELEASE_VERSION.txt
toki tietysti jq:n käyttö vaatii, että jq on asennettu kaikkien koneelle. Ja ehkä tuo github API:n palauttama JSON on aina formatoitu tuollein nätiksi, jotta grep toimii
"jore4-docker-compose-bundle" repository. The CLI commands used work on both Linux (GNU) and macOS (BSD) and are not dependent on shell built-ins.
c8a1f87
to
7eac7e2
Compare
… Compose bundle. Refactor `development.sh` to use GitHub CLI.
7eac7e2
to
fb9c8a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @culka and @janneronkko)
development.sh
line 32 at r1 (raw file):
Previously, janneronkko (Janne Rönkkö) wrote…
Voit välttää temppitiedoston (tai jos et halua, niin talleta temppitiedosto /tmp:hen):
rm -rf docker mkdir -p docker curl -L https://github.com/HSLdevcom/jore4-docker-compose-bundle/archive/refs/heads/main.tar.gz \ | tar -xz \ -C ./docker \ --strip-components 2 \ --wildcards 'jore4-docker-compose-bundle-main/docker-compose/*'
ja kohdehakemisto kannattaa poistaa aluksi, jotta vanhoja tiedostoja ei jää
--wildcards
option does not seem to be available on macOS (BSD). However, on Mac, --include
seems to do the same thing.
development.sh
line 50 at r5 (raw file):
Previously, janneronkko (Janne Rönkkö) wrote…
toki tietysti jq:n käyttö vaatii, että jq on asennettu kaikkien koneelle. Ja ehkä tuo github API:n palauttama JSON on aina formatoitu tuollein nätiksi, jotta grep toimii
Korvasin curlin käytön GitHub CLI:llä, jossa on erikseen --jq
-vipu, mikä ei vaadi erikseen jq:n asentamista.
Docker Compose bundle is now downloaded as a ZIP file from jore4-docker-compose-bundle repository instead of downloading the latest release from jore4-tools.
This change is