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

Refactor downloading Docker Compose bundle #31

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jarkkoka
Copy link
Contributor

@jarkkoka jarkkoka commented Dec 20, 2024

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 Reviewable

@jarkkoka jarkkoka marked this pull request as ready for review December 20, 2024 08:37
Copy link

@janneronkko janneronkko left a 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ää

@jarkkoka jarkkoka force-pushed the refactor-downloading-docker-compose-bundle branch 16 times, most recently from 5c90577 to 142603f Compare December 20, 2024 15:14
Copy link
Contributor

@culka culka left a 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

Copy link

@janneronkko janneronkko left a 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

Copy link

@janneronkko janneronkko left a 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.
@jarkkoka jarkkoka force-pushed the refactor-downloading-docker-compose-bundle branch 3 times, most recently from c8a1f87 to 7eac7e2 Compare January 3, 2025 18:05
@jarkkoka jarkkoka force-pushed the refactor-downloading-docker-compose-bundle branch from 7eac7e2 to fb9c8a3 Compare January 3, 2025 18:15
@jarkkoka jarkkoka requested review from culka and janneronkko January 7, 2025 13:35
Copy link
Contributor Author

@jarkkoka jarkkoka left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants