Skip to content
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
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Fixes ${ISSUE_URL}
Add one or more labels to trigger offline builds:
- `build-default` - Full production build (ansible, terraform, all packages)
- `build-demo` - Demo/WIAB build
- `build-wiab-staging` - WIAB-staging build
- `build-min` - Minimal build (fastest, essential charts only)
- `build-all` - Run all three builds

Expand Down
71 changes: 65 additions & 6 deletions .github/workflows/offline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,22 @@
# - No label: No builds run (must add label to trigger builds)
# - 'build-default': Builds only default profile
# - 'build-demo': Builds only demo profile
# - 'build-wiab-staging' - Builds only wiab-staging profile
# - 'build-min': Builds only min profile
# - 'build-all': Explicitly builds all profiles (useful for workflow changes)
#
# Push to master/develop: Always builds all profiles regardless of labels
#
on:
push:
branches: [master, develop]
branches: [wpb-21356*]
tags: [v*]
paths-ignore:
- "*.md"
- "**/*.md"
pull_request:
types: [synchronize, reopened, labeled]
branches: [master, develop]
branches: [wpb-21356*]
paths-ignore:
- "*.md"
- "**/*.md"
Expand All @@ -32,9 +33,9 @@ jobs:
build-default:
name: Build default profile
if: |
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'build-all') ||
contains(github.event.pull_request.labels.*.name, 'build-default')
contains(github.event.pull_request.labels.*.name, 'build-default') ||
contains(github.event.pull_request.labels.*.name, 'build-wiab-staging')
runs-on:
group: wire-server-deploy
outputs:
Expand Down Expand Up @@ -72,6 +73,27 @@ jobs:
AWS_SECRET_ACCESS_KEY: '${{ secrets.AWS_SECRET_ACCESS_KEY }}'
AWS_REGION: "eu-west-1"

verify-default:
name: Verify default profile
needs: build-default
if: |
contains(github.event.pull_request.labels.*.name, 'build-all') ||
contains(github.event.pull_request.labels.*.name, 'build-default')
runs-on:
group: wire-server-deploy
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: cachix/install-nix-action@v27
- uses: cachix/cachix-action@v15
with:
name: wire-server
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"

- name: Install nix environment
run: nix-env -f default.nix -iA env

- name: Install terraform
uses: hashicorp/setup-terraform@v3
with:
Expand All @@ -89,6 +111,45 @@ jobs:
env:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'

# verify wiab-staging profile
verify-wiab-staging:
name: Verify wiab staging profile
needs: build-default
if: |
contains(github.event.pull_request.labels.*.name, 'build-all') ||
contains(github.event.pull_request.labels.*.name, 'build-wiab-staging')
runs-on:
group: wire-server-deploy
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: cachix/install-nix-action@v27
- uses: cachix/cachix-action@v15
with:
name: wire-server
signingKey: "${{ secrets.CACHIX_SIGNING_KEY }}"

- name: Install nix environment
run: nix-env -f default.nix -iA env

- name: Install terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: "^1.3.7"
terraform_wrapper: false

- name: Deploy offline wiab-staging environment to hetzner
run: ./offline/cd_staging.sh
env:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'

- name: Clean up hetzner wiab-staging environment; just in case
if: always()
run: (cd terraform/examples/wiab-staging-hetzner ; terraform init && terraform destroy -auto-approve)
env:
HCLOUD_TOKEN: '${{ secrets.HCLOUD_TOKEN }}'

# Build container in parallel
build-container:
name: Build container
Expand Down Expand Up @@ -118,7 +179,6 @@ jobs:
build-demo:
name: Build demo profile
if: |
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'build-all') ||
contains(github.event.pull_request.labels.*.name, 'build-demo')
runs-on:
Expand Down Expand Up @@ -179,7 +239,6 @@ jobs:
build-min:
name: Build min profile
if: |
github.event_name == 'push' ||
contains(github.event.pull_request.labels.*.name, 'build-all') ||
contains(github.event.pull_request.labels.*.name, 'build-min')
runs-on:
Expand Down
1 change: 1 addition & 0 deletions changelog.d/3-deploy-builds/wiab-staging
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ Changed: Add ansible playbook for wiab-staging VM provisioning
Fixed: offline-deploy.sh for SSH_AUTH_SOCK handling and remove defunct passwords for postgresql
Added: terraform resources for wiab-staging
Added: cd_staging script to verify the default build bundle
Changed: changed the flow of offline.yml - introduced wiab-staging build and split bundle processing with default-build
15 changes: 11 additions & 4 deletions offline/cd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ TF_DIR="${CD_DIR}/../terraform/examples/wire-server-deploy-offline-hetzner"
ARTIFACTS_DIR="${CD_DIR}/default-build/output"
VALUES_DIR="${CD_DIR}/../values"

COMMIT_HASH="${GITHUB_SHA}"
ARTIFACT="wire-server-deploy-static-${COMMIT_HASH}"

# Retry configuration
MAX_RETRIES=3
RETRY_DELAY=30
Expand Down Expand Up @@ -110,15 +113,19 @@ ssh-add - <<< "$ssh_private_key"
terraform output -json static-inventory > inventory.json
yq eval -o=yaml '.' inventory.json > inventory.yml

ssh -oStrictHostKeyChecking=accept-new -oConnectionAttempts=10 "root@$adminhost" tar xzv < "$ARTIFACTS_DIR/assets.tgz"
ssh -oStrictHostKeyChecking=accept-new -o ConnectionAttempts=10 \
"root@$adminhost" wget -q "https://s3-eu-west-1.amazonaws.com/public.wire.com/artifacts/${ARTIFACT}.tgz"

ssh -oStrictHostKeyChecking=accept-new -o ConnectionAttempts=10 \
"root@$adminhost" tar xzf "$ARTIFACT.tgz"

# override for ingress-nginx-controller values for hetzner environment $TF_DIR/setup_nodes.yml
scp -A "$VALUES_DIR/ingress-nginx-controller/hetzner-ci.example.yaml" "root@$adminhost:./values/ingress-nginx-controller/prod-values.example.yaml"
scp -oStrictHostKeyChecking=accept-new -o ConnectionAttempts=10 "$VALUES_DIR/ingress-nginx-controller/hetzner-ci.example.yaml" "root@$adminhost:./values/ingress-nginx-controller/prod-values.example.yaml"

scp inventory.yml "root@$adminhost":./ansible/inventory/offline/inventory.yml
scp -oStrictHostKeyChecking=accept-new -o ConnectionAttempts=10 inventory.yml "root@$adminhost":./ansible/inventory/offline/inventory.yml

ssh "root@$adminhost" cat ./ansible/inventory/offline/inventory.yml || true

ls -ls ssh_private_key || true
echo "Running ansible playbook setup_nodes.yml via adminhost ($adminhost)..."
ansible-playbook -i inventory.yml setup_nodes.yml --private-key "ssh_private_key" \
-e "ansible_ssh_common_args='-o ProxyCommand=\"ssh -W %h:%p -q root@$adminhost -i ssh_private_key\" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'"
Expand Down
8 changes: 6 additions & 2 deletions offline/cd_staging.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ CD_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
TF_DIR="${CD_DIR}/../terraform/examples/wiab-staging-hetzner"
ARTIFACTS_DIR="${CD_DIR}/default-build/output"
VALUES_DIR="${CD_DIR}/../values"

COMMIT_HASH="${GITHUB_SHA}"
ARTIFACT="wire-server-deploy-static-${COMMIT_HASH}"

Expand Down Expand Up @@ -113,6 +114,9 @@ chmod 400 ssh_private_key
terraform output -json static-inventory > inventory.json
yq eval -o=yaml '.' inventory.json > inventory.yml

# remove me
cat inventory.yml

echo "Running ansible playbook setup_nodes.yml via adminhost ($adminhost)..."
ansible-playbook -i inventory.yml setup_nodes.yml --private-key "ssh_private_key"

Expand All @@ -124,7 +128,7 @@ ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectionAt
"demo@$adminhost" tar xzf "$ARTIFACT.tgz"

# override for ingress-nginx-controller values for hetzner environment $TF_DIR/setup_nodes.yml
scp -A "$VALUES_DIR/ingress-nginx-controller/hetzner-ci.example.yaml" "demo@$adminhost:./values/ingress-nginx-controller/prod-values.example.yaml"
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectionAttempts=10 "$VALUES_DIR/ingress-nginx-controller/hetzner-ci.example.yaml" "demo@$adminhost:./values/ingress-nginx-controller/prod-values.example.yaml"

# Source and target files
SOURCE="inventory.yml"
Expand Down Expand Up @@ -192,7 +196,7 @@ yq eval -i ".all.vars.ansible_ssh_private_key_file = \"ssh/ssh_private_key\"" "$

echo "created secondary inventory file $TARGET successfully"

scp "$TARGET" "demo@$adminhost":./ansible/inventory/offline/inventory.yml
scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectionAttempts=10 "$TARGET" "demo@$adminhost":./ansible/inventory/offline/inventory.yml

ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectionAttempts=10 "demo@$adminhost" cat ./ansible/inventory/offline/inventory.yml || true

Expand Down
Loading