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

Provide Baikal version as Docker build argument #205

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ jobs:
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8,linux/386
push: true
tags: ${{ inputs.tags }}
build-args: VERSION=${{ inputs.image-version }}
# TODO github.event.created_at does not seem to work
labels: |
org.opencontainers.image.created=${{ github.event.created_at }}
org.opencontainers.image.url=https://hub.docker.com/r/ckulka/baikal
Expand Down
25 changes: 23 additions & 2 deletions .github/workflows/test-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
# Get the latest release version from the GitHub API
- name: Parse release tag
id: parse-release-tag
run: |
echo Parsing tag from latest release ref $REF_NAME
REF_NAME=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r '.tag_name')
echo Latest release ref is $REF_NAME
BAIKAL_VERSION=${REF_NAME/+*/}
echo Parsed Baikal version $BAIKAL_VERSION from release $REF_NAME
echo BAIKAL_VERSION=$BAIKAL_VERSION >> "$GITHUB_OUTPUT"

- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
Expand All @@ -31,13 +42,20 @@ jobs:

- name: Build Docker image
id: build
run: docker build -f ${{ inputs.dockerfile }}.dockerfile -t baikal-image .
run: >
docker build
--file ${{ inputs.dockerfile }}.dockerfile
--build-arg VERSION=${{ steps.parse-release-tag.outputs.BAIKAL_VERSION }}
--tag baikal-image
.

- name: Start Baikal container
run: docker run --rm -dp 80:80 --name ${{ inputs.dockerfile }} baikal-image

- name: Run Cypress tests
run: npm run test
env:
CYPRESS_BAIKAL_VERSION: ${{ steps.parse-release-tag.outputs.BAIKAL_VERSION }}

- name: Stop Baikal container
run: docker stop ${{ inputs.dockerfile }}
Expand All @@ -59,7 +77,10 @@ jobs:
docker cp ${{ github.workspace }}/cypress/fixtures/mail-test.php baikal:/var/www/baikal/html/

- name: Run Cypress tests incl. MSMTP
run: CYPRESS_MSMTP_ENABLED=TRUE npm run test
run: npm run test
env:
CYPRESS_MSMTP_ENABLED: TRUE
CYPRESS_BAIKAL_VERSION: ${{ steps.parse-release-tag.outputs.BAIKAL_VERSION }}

- name: Archive test results
if: always()
Expand Down
2 changes: 1 addition & 1 deletion apache-php8.2.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Multi-stage build, see https://docs.docker.com/develop/develop-images/multistage-build/
FROM alpine AS builder

ENV VERSION 0.9.5
ARG VERSION

ADD https://github.com/sabre-io/Baikal/releases/download/$VERSION/baikal-$VERSION.zip .
RUN apk add unzip && unzip -q baikal-$VERSION.zip
Expand Down
2 changes: 1 addition & 1 deletion apache.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Multi-stage build, see https://docs.docker.com/develop/develop-images/multistage-build/
FROM alpine AS builder

ENV VERSION 0.9.5
ARG VERSION

ADD https://github.com/sabre-io/Baikal/releases/download/$VERSION/baikal-$VERSION.zip .
RUN apk add unzip && unzip -q baikal-$VERSION.zip
Expand Down
6 changes: 6 additions & 0 deletions cypress/e2e/create-baikal-instance.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ describe("Create Baikal instance", () => {
"Baïkal initialization wizard",
);

// Assert the correct Baikal version was installed
cy.get("#overview > p.lead").should(
"have.text",
`Configure your new Baïkal ${Cypress.env("BAIKAL_VERSION")} installation.`,
);

// Set administrator credentials
cy.get("#admin_passwordhash").type(adminCredentials);
cy.get("#admin_passwordhash_confirm").type(adminCredentials);
Expand Down
2 changes: 1 addition & 1 deletion nginx-php8.2.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Multi-stage build, see https://docs.docker.com/develop/develop-images/multistage-build/
FROM alpine AS builder

ENV VERSION 0.9.5
ARG VERSION

ADD https://github.com/sabre-io/Baikal/releases/download/$VERSION/baikal-$VERSION.zip .
RUN apk add unzip && unzip -q baikal-$VERSION.zip
Expand Down
2 changes: 1 addition & 1 deletion nginx.dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Multi-stage build, see https://docs.docker.com/develop/develop-images/multistage-build/
FROM alpine AS builder

ENV VERSION 0.9.5
ARG VERSION

ADD https://github.com/sabre-io/Baikal/releases/download/$VERSION/baikal-$VERSION.zip .
RUN apk add unzip && unzip -q baikal-$VERSION.zip
Expand Down