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

fix(installer): Pull & build datadog-packages from Gitlab (#27970) #28116

Merged
merged 1 commit into from
Aug 1, 2024
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
16 changes: 5 additions & 11 deletions .gitlab/deploy_packages/oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,14 @@ include:
script:
- python3 -m pip install -r tasks/libs/requirements-github.txt
- set +x
- export GITHUB_KEY_B64=$($CI_PROJECT_DIR/tools/ci/aws_ssm_get_wrapper.sh ci.datadog-agent.platform-github-app-key)
- export GITHUB_APP_ID=682216
- export GH_TOKEN=$(inv -e github.get-token-from-app --app-id-env=GITHUB_APP_ID --pkey-env=GITHUB_KEY_B64)
- export VERSION=$(inv agent.version --url-safe)-1
- git config --global credential.helper '!f() { echo username=x-access-token; echo "password=$GH_TOKEN"; };f'
- ${CI_PROJECT_DIR}/tools/ci/retry.sh git clone -v --depth=1 https://github.com/DataDog/datadog-packages /tmp/datadog-packages
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/"
- export GOPROXY="binaries.ddbuild.io,proxy.golang.org,direct"
- export GONOSUMDB="github.com/DataDog,go.ddbuild.io"
- cd /tmp/datadog-packages/cmd/datadog-package
- go build .
- ./datadog-package push registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:${VERSION} ${OMNIBUS_PACKAGE_DIR}/${OCI_PRODUCT}-${VERSION}.oci.tar
- go env -w GOPRIVATE="github.com/DataDog/*"
- export PATH=$PATH:$(go env GOPATH)/bin
- go install github.com/DataDog/datadog-packages/cmd/datadog-package@latest
- datadog-package push registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:${VERSION} ${OMNIBUS_PACKAGE_DIR}/${OCI_PRODUCT}-${VERSION}.oci.tar
# This is used for E2E tests. Doesn't cost more than an additional tag to the registry.
- ./datadog-package push registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:pipeline-${CI_PIPELINE_ID} ${OMNIBUS_PACKAGE_DIR}/${OCI_PRODUCT}-${VERSION}.oci.tar
- datadog-package push registry.ddbuild.io/ci/remote-updates/${OCI_PRODUCT}:pipeline-${CI_PIPELINE_ID} ${OMNIBUS_PACKAGE_DIR}/${OCI_PRODUCT}-${VERSION}.oci.tar
variables:
MAJOR_VERSION: 7

Expand Down
16 changes: 4 additions & 12 deletions .gitlab/packaging/oci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,10 @@
- rm -f $OMNIBUS_PACKAGE_DIR/*-dbg-*.tar.xz
- ls -l $OMNIBUS_PACKAGE_DIR
- python3 -m pip install -r tasks/libs/requirements-github.txt
- export GITHUB_KEY_B64=$($CI_PROJECT_DIR/tools/ci/aws_ssm_get_wrapper.sh ci.datadog-agent.platform-github-app-key)
- export GITHUB_APP_ID=682216
- set +x
- export GH_TOKEN=$(inv -e github.get-token-from-app --app-id-env=GITHUB_APP_ID --pkey-env=GITHUB_KEY_B64)
- git config --global credential.helper '!f() { echo username=x-access-token; echo "password=$GH_TOKEN"; };f'
- cd /tmp/
- ${CI_PROJECT_DIR}/tools/ci/retry.sh git clone --depth=1 https://github.com/DataDog/datadog-packages
- git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/".insteadOf "https://github.com/DataDog/"
- export GOPROXY="binaries.ddbuild.io,proxy.golang.org,direct"
- export GONOSUMDB="github.com/DataDog,go.ddbuild.io"
- cd datadog-packages/cmd/datadog-package
- go build .
- go env -w GOPRIVATE="github.com/DataDog/*"
- ${CI_PROJECT_DIR}/tools/ci/retry.sh go install github.com/DataDog/datadog-packages/cmd/datadog-package@latest
- OUTPUT_DIR="/tmp/oci_output"
- mkdir -p ${OUTPUT_DIR}
- ls $OMNIBUS_PACKAGE_DIR
Expand All @@ -53,7 +45,7 @@
if [ "${OCI_PRODUCT}" = "datadog-agent" ]; then
EXTRA_FLAGS="--configs ${INPUT_DIR}/etc/datadog-agent"
fi
./datadog-package create \
datadog-package create \
--version ${PACKAGE_VERSION} \
--package ${OCI_PRODUCT} \
--os linux \
Expand All @@ -65,7 +57,7 @@
done
- echo "Aggregating all layers into one package -> ${MERGED_FILE}"
- ls -l ${OUTPUT_DIR}/
- ./datadog-package merge ${OUTPUT_DIR}/*.tar
- datadog-package merge ${OUTPUT_DIR}/*.tar
# We need to propagate the exact version in the pipeline artifact
- cp merged.tar ${OMNIBUS_PACKAGE_DIR}/${MERGED_FILE}
# Only the major version is needed in the S3 bucket
Expand Down
Loading