Skip to content

Commit fc7bccc

Browse files
committed
Test.
1 parent 97b9eeb commit fc7bccc

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

.gitlab-ci.yml

+11
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ include:
150150
- component: $CI_SERVER_FQDN/root/test-components-1/setup-silta-cli@main
151151
inputs:
152152
silta-cli-version: 'latest'
153+
- local: '/.gitlab/templates/drupal-build.yml'
154+
155+
drupal-build:
156+
extends: .drupal-build-template
157+
variables:
158+
EXECUTOR: "silta/cicd:latest" # Replace with your executor image
159+
DRUPAL_ROOT: "." # Customize if needed
160+
# ... other project-specific variables ...
161+
script:
162+
- echo "Project-specific build steps here..." # Add your project's build commands
163+
153164

154165
build-job0:
155166
stage: build

.gitlab/templates/drupal-build.yml

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
2+
.decrypt-files: &decrypt-files
3+
before_script:
4+
- |
5+
FILES=(${DECRYPT_FILES//,/ }) # Split comma-separated files into an array
6+
for FILE in "${FILES[@]}"; do
7+
echo "Decrypting $FILE..."
8+
# ... (your decryption logic for $FILE - e.g., using openssl, sops, etc.) ...
9+
done
10+
11+
.docker-setup: &docker-setup
12+
before_script:
13+
- echo "Setting up Docker..."
14+
# ... (your Docker setup commands - e.g., docker login, etc.) ...
15+
16+
.silta-setup: &silta-setup
17+
script:
18+
- echo "Setting up Silta..."
19+
# ... (your Silta setup commands using $RELEASE_SUFFIX and $CUSTOM_PROXY_COMMAND) ...
20+
# Example:
21+
- |
22+
if [[ -n "$CUSTOM_PROXY_COMMAND" ]]; then
23+
eval "$CUSTOM_PROXY_COMMAND"
24+
else
25+
silta config set proxy "YOUR_PROXY_SETTING" # Replace with your proxy setting
26+
fi
27+
silta init # Or other silta commands as needed
28+
29+
.drupal-docker-build: &drupal-docker-build
30+
script:
31+
- echo "Building Drupal Docker images..."
32+
# ... (your Drupal Docker build commands using $NGINX_BUILD_CONTEXT, $IMAGE_BUILD_BACKGROUND, and $IMAGE_BUILD_WAIT) ...
33+
# Example (adapt as needed):
34+
- docker build -t drupal-nginx:$CI_COMMIT_SHA -f $NGINX_BUILD_CONTEXT/Dockerfile .
35+
- docker build -t drupal-php:$CI_COMMIT_SHA -f Dockerfile-php .
36+
# ... (Set $php_IMAGE_URL, $nginx_IMAGE_URL, $shell_IMAGE_URL if needed) ...
37+
38+
39+
.store-image-urls: &store-image-urls
40+
script:
41+
- |
42+
echo "php_IMAGE_URL=${php_IMAGE_URL:-'default-php-image-url'}" >> tags # Use default if variable is not set
43+
echo "nginx_IMAGE_URL=${nginx_IMAGE_URL:-'default-nginx-image-url'}" >> tags
44+
echo "shell_IMAGE_URL=${shell_IMAGE_URL:-'default-shell-image-url'}" >> tags
45+
artifacts:
46+
paths:
47+
- tags
48+
49+
include:
50+
- local: '/.gitlab/templates/step-setup-silta-cli.yml'
51+
52+
drupal-build:
53+
image: $EXECUTOR
54+
variables:
55+
EXECUTOR: "silta/cicd:latest" # Replace with your actual executor image
56+
RESOURCE_CLASS: "medium" # Or use resource_group if available
57+
DRUPAL_ROOT: "."
58+
SILTA_CLI_VERSION: "latest"
59+
DECRYPT_FILES: ""
60+
SKIP_DEPLOYMENT: "false"
61+
RELEASE_SUFFIX: ""
62+
NGINX_BUILD_CONTEXT: "web"
63+
IMAGE_BUILD_BACKGROUND: "true"
64+
IMAGE_BUILD_WAIT: "true"
65+
CUSTOM_PROXY_COMMAND: ""
66+
before_script:
67+
- mkdir -p ~/project
68+
- cd ~/project/$DRUPAL_ROOT
69+
script:
70+
- echo "Codebase build steps here..." # Replace with your actual build commands
71+
extends:
72+
- .silta-cli-setup
73+
rules:
74+
- if: $SKIP_DEPLOYMENT == "false"
75+
when: on_success # Or 'always'
76+
extends:
77+
- .decrypt-files
78+
- .docker-setup
79+
- .silta-setup
80+
- .drupal-docker-build
81+
- .store-image-urls
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
.silta-cli-setup: &silta-cli-setup
2+
before_script:
3+
- |
4+
if [[ "$SILTA_CLI_VERSION" == "latest" ]]; then
5+
# Handle latest version installation (e.g., using a package manager)
6+
echo "Installing latest silta-cli..."
7+
# Example using curl (adapt as needed):
8+
curl -sL "$(curl -s https://api.github.com/repos/wunderio/silta-cli/releases/latest | grep browser_download_url | cut -d '"' -f 4 | grep linux-amd64.tar.gz)" | tar -xz -C /usr/local/bin
9+
elif [[ "$SILTA_CLI_VERSION" == "test" ]]; then
10+
echo "Installing test version of silta-cli..."
11+
# Install specific test version (replace with your actual logic)
12+
# Example:
13+
curl -sL "YOUR_TEST_SILTA_CLI_URL" | tar -xz -C /usr/local/bin
14+
fi
15+
silta version # Verify installation

0 commit comments

Comments
 (0)