Skip to content

Commit

Permalink
Add GitLab deployment instructions
Browse files Browse the repository at this point in the history
Not tested in anger but looks like it should work! Hoping our friends at
GitLab can give the final verdict.
  • Loading branch information
lawrencejones committed Nov 13, 2024
1 parent 409354f commit 5c6563f
Showing 1 changed file with 48 additions and 2 deletions.
50 changes: 48 additions & 2 deletions docs/deploying.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- run:
name: Install catalog-importer
command: |
VERSION="1.7.0"
VERSION="2.4.3"
echo "Installing importer v${VERSION}..."
curl -L \
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
go-version: "1.20"
- name: Install catalog-importer
run: |
VERSION="1.7.0"
VERSION="2.4.3"
echo "Installing importer v${VERSION}..."
curl -L \
Expand All @@ -88,5 +88,51 @@ jobs:
- name: Sync
run: |
/tmp/catalog-importer sync --config=importer.jsonnet --prune
```
## GitLab CI
If you run on GitLab CI, an example config is:
```yaml
# .gitlab-ci.yml

variables:
IMPORTER_VERSION: "2.4.3"

sync:
image: ubuntu:latest

# You can use rules to control when the job runs
rules:
# Run on every push to any branch
- if: $CI_COMMIT_BRANCH
when: always

# Alternatively, you can use scheduled pipelines
# Configure this in GitLab UI: Settings > CI/CD > Pipeline schedules
# - if: $CI_PIPELINE_SOURCE == "schedule"
# when: always

before_script:
# Install curl and other dependencies
- apt-get update && apt-get install -y curl

# Install catalog-importer
- |
echo "Installing importer v${IMPORTER_VERSION}..."
curl -L \
-o "/tmp/catalog-importer_${IMPORTER_VERSION}_linux_amd64.tar.gz" \
"https://github.com/incident-io/catalog-importer/releases/download/v${IMPORTER_VERSION}/catalog-importer_${IMPORTER_VERSION}_linux_amd64.tar.gz"
tar zxf "/tmp/catalog-importer_${IMPORTER_VERSION}_linux_amd64.tar.gz" -C /tmp
script:
# Run sync with different options based on branch
- |
if [ "$CI_COMMIT_BRANCH" = "master" ] || [ "$CI_COMMIT_BRANCH" = "main" ]; then
/tmp/catalog-importer sync --config importer.jsonnet --prune
else
/tmp/catalog-importer sync --config importer.jsonnet --dry-run
fi
```

0 comments on commit 5c6563f

Please sign in to comment.