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

Add gitlab release job #184

Merged
merged 7 commits into from
Nov 17, 2023
Merged
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
22 changes: 22 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
variables:
RELEASE_BUCKET:
value: "cloudfoundry.datadoghq.com/datadog-cloudfoundry-buildpack"
description: "Bucket where the buildpack release will be stored"
DRY_RUN:
value: "true"
description: "Set to true to do a dry run"
REPO_BRANCH:
value: "master"
description: "The branch to use"


buildpack-prod-release:
stage: deploy
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-agent-builders/gitlab_agent_deploy:v6554890-8eae026
tags: ["runner:main"]
when: manual
before_script:
- apt-get update -y && apt-get install -y zip
script:
- 'export PRODUCTION=true'
- ./scripts/release.sh
39 changes: 39 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash -l

# http://redsymbol.net/articles/unofficial-bash-strict-mode/
IFS=$'\n\t'
set -euxo pipefail

# Make sure variables are set
PRODUCTION=${PRODUCTION:-"false"}
STAGING=${STAGING:-"false"}
DRY_RUN=${DRY_RUN:-"true"}
RELEASE_BUCKET=${RELEASE_BUCKET:-"false"}
REPO_BRANCH=${REPO_BRANCH:-"master"}


VERSION=$(cat VERSION)

git checkout $REPO_BRANCH

echo "Preparing the buildpack"
REFRESH_ASSETS=1 ./scripts/prepare.sh

echo "Building the buildpack version $VERSION"
./scripts/build.sh

if [ "$DRY_RUN" == "true" ]; then
exit 0
fi


echo "publishing the buildpack artifact"

if [ "$RELEASE_BUCKET" -a "$RELEASE_BUCKET" != "false" ]; then
if [ "$PRODUCTION" = "true" ]; then
# the production release bucket is cloudfoundry.datadoghq.com/datadog-cloudfoundry-buildpack
aws s3 cp datadog-cloudfoundry-buildpack-$VERSION.zip s3://$RELEASE_BUCKET/datadog-cloudfoundry-buildpack-$VERSION.zip --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers full=id=3a6e02b08553fd157ae3fb918945dd1eaae5a1aa818940381ef07a430cf25732

aws s3 cp datadog-cloudfoundry-buildpack-$VERSION.zip s3://$RELEASE_BUCKET/datadog-cloudfoundry-buildpack-latest.zip --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers full=id=3a6e02b08553fd157ae3fb918945dd1eaae5a1aa818940381ef07a430cf25732
fi
fi
Loading