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

Use devcontainer in build #142

Merged
merged 52 commits into from
Oct 16, 2024
Merged

Use devcontainer in build #142

merged 52 commits into from
Oct 16, 2024

Conversation

unglaublicherdude
Copy link
Member

No description provided.

@unglaublicherdude unglaublicherdude marked this pull request as ready for review October 2, 2024 13:53
Copy link
Member Author

Choose a reason for hiding this comment

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

I moved some installation-steps from the postCreateCommand into the devcontainer-file itself


sudo cp memory.ini /usr/local/etc/php/conf.d/memory.ini

if [[ "$IS_CI" == "true" ]]; then
Copy link
Member Author

Choose a reason for hiding this comment

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

the other stuff is just for interactive use, so we don't need that in the ci on github

@@ -17,23 +20,47 @@ jobs:
- id: get-matrix
run: echo "nextcloud_versions=$(./get-matrix.sh)" | tee -a "$GITHUB_OUTPUT"

build-devcontainer:
Copy link
Member Author

Choose a reason for hiding this comment

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

This build the devcontainer like described in the devcontainer.json definition. But this is just the build, so lifecycle-hooks like postCreate are not called here.

image: ghcr.io/gdatasoftwareag/nextcloud/builder:latest
env:
IS_CI: true
options: --name nextcloud-antivirus-build-container
Copy link
Member Author

Choose a reason for hiding this comment

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

i had to set a fixed container name, because I need to put the build container into a network that it can reach the nextcloud and smtp containers.

uses: mig4/setup-bats@v1
with:
bats-version: 1.11.0
- name: postCreateCommands
Copy link
Member Author

Choose a reason for hiding this comment

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

calling the postCreateCommand-Script

@@ -3,7 +3,9 @@ ARG INSTALL_XDEBUG=1

FROM nextcloud:${NEXTCLOUD_VERSION}

RUN apt update && apt install -y \
SHELL [ "/bin/bash", "-c" ]
Copy link
Member Author

Choose a reason for hiding this comment

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

this was the reason why the if condition while building was not working. the docker build commands do run in sh

@@ -1,4 +1,5 @@
#!/bin/bash
set -e
Copy link
Member Author

Choose a reason for hiding this comment

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

early exit for the install script. without this, the script basically never failed in the background jobs (the ones startet with an &). This will lead to the early exit from the background jobs.

build_app &
wait
wait %2 || exit 1
Copy link
Member Author

Choose a reason for hiding this comment

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

this will actually fail the build script when something fails in the background jobs

@unglaublicherdude unglaublicherdude merged commit 06d33a6 into main Oct 16, 2024
4 checks passed
@lennartdohmann lennartdohmann deleted the use-devcontainer-in-build branch October 18, 2024 08:24
lennartdohmann pushed a commit that referenced this pull request Oct 22, 2024
* WIP

* WIP magic

* adjust scoper config

* Resolve dependency hell

* Make something

* add build step for the nextcloud builder

* add the checkout step

* login to registry

* use devcontainer as build-runner2

* skip the postCreate stuff when in CI

* change default shell for docker build

* extract some functions from the script to features

* run poststartcommands in ci

* fix filename

* fix script for non vscode environments

* remove extra install scoper step

* add fail fast on install

* use bash as default shell

* make apt less noisy

* try another fail

* remove trap in distclean

* add memory.ini to top

* give the shell job control

* just use bash

* Scope dependencies (#138)

Scope dependencies

---------

Co-authored-by: Matthias Simonis <[email protected]>

* Fix if the file size is zero, the app evaluates the file as too large to scan

(cherry picked from commit c37472d)

* WIP

* WIP magic

* adjust scoper config

* Resolve dependency hell

* Make something

* add fail fast on install

* exit early in the install script

* fix stuff

* add composer path to github path

* split postCreate and add to path

* remove the scoper installation (done in the postCreateCommand)

* add container user vscode

* remove vscode user

* add docker ps

* replace hostname in ci

* add debug stuff

* use static ip

* show json ps

* try connect the builder container to the compose network

* fix name

* move connect to after installation

* fix hostname

* add hostname to trusted_domains array

* fix smtp hostname

* replace quote types

* remove debugging stuff

---------

Co-authored-by: Lennart Dohmann <[email protected]>
Co-authored-by: PT-ATA No One <[email protected]>
(cherry picked from commit 06d33a6)
lennartdohmann pushed a commit that referenced this pull request Oct 23, 2024
* WIP

* WIP magic

* adjust scoper config

* Resolve dependency hell

* Make something

* add build step for the nextcloud builder

* add the checkout step

* login to registry

* use devcontainer as build-runner2

* skip the postCreate stuff when in CI

* change default shell for docker build

* extract some functions from the script to features

* run poststartcommands in ci

* fix filename

* fix script for non vscode environments

* remove extra install scoper step

* add fail fast on install

* use bash as default shell

* make apt less noisy

* try another fail

* remove trap in distclean

* add memory.ini to top

* give the shell job control

* just use bash

* Scope dependencies (#138)

Scope dependencies

---------

Co-authored-by: Matthias Simonis <[email protected]>

* Fix if the file size is zero, the app evaluates the file as too large to scan

(cherry picked from commit c37472d)

* WIP

* WIP magic

* adjust scoper config

* Resolve dependency hell

* Make something

* add fail fast on install

* exit early in the install script

* fix stuff

* add composer path to github path

* split postCreate and add to path

* remove the scoper installation (done in the postCreateCommand)

* add container user vscode

* remove vscode user

* add docker ps

* replace hostname in ci

* add debug stuff

* use static ip

* show json ps

* try connect the builder container to the compose network

* fix name

* move connect to after installation

* fix hostname

* add hostname to trusted_domains array

* fix smtp hostname

* replace quote types

* remove debugging stuff

---------

Co-authored-by: Lennart Dohmann <[email protected]>
Co-authored-by: PT-ATA No One <[email protected]>
(cherry picked from commit 06d33a6)
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.

4 participants