CI: Remove update dependency job
Updating dependencies in a library does not make much sense. Due to we dont have a pubspec.lock the app which uses this library always uses the newest minor release by default. For new major releases which have a new API this breaks anyway and needs manual help. So if we depend on a specific major version we should not force the app to use the latest minor versions without a reason to stay as compatible as possible.
This commit is contained in:
parent
c196610998
commit
3e076425e6
|
|
@ -151,40 +151,3 @@ pages:
|
||||||
# - /opt/ort/bin/ort analyze -i $CI_PROJECT_DIR -o $CI_PROJECT_DIR/ --allow-dynamic-versions
|
# - /opt/ort/bin/ort analyze -i $CI_PROJECT_DIR -o $CI_PROJECT_DIR/ --allow-dynamic-versions
|
||||||
# - /opt/ort/bin/ort scan -i $CI_PROJECT_DIR/analyzer-result.yml -o $CI_PROJECT_DIR/ || true
|
# - /opt/ort/bin/ort scan -i $CI_PROJECT_DIR/analyzer-result.yml -o $CI_PROJECT_DIR/ || true
|
||||||
# - /opt/ort/bin/ort report -f GitLabLicenseModel -i $CI_PROJECT_DIR/scan-result.yml -o $CI_PROJECT_DIR/
|
# - /opt/ort/bin/ort report -f GitLabLicenseModel -i $CI_PROJECT_DIR/scan-result.yml -o $CI_PROJECT_DIR/
|
||||||
|
|
||||||
update-dependencies:
|
|
||||||
stage: coverage
|
|
||||||
image: debian:testing
|
|
||||||
needs: []
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
only:
|
|
||||||
- schedules
|
|
||||||
variables:
|
|
||||||
HOST: ${CI_PROJECT_URL}
|
|
||||||
UPDATE_BRANCH: ci-bot/dependency-updates
|
|
||||||
PRIVATE_TOKEN: ${GITLAB_API_TOKEN}
|
|
||||||
before_script:
|
|
||||||
- apt-get update && apt-get install -y curl git gnupg2 openssh-client python3
|
|
||||||
- curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -
|
|
||||||
- curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list
|
|
||||||
- apt-get update && apt-get install -y dart
|
|
||||||
- ln -s /usr/lib/dart/bin/pub /usr/bin/
|
|
||||||
|
|
||||||
- eval $(ssh-agent -s)
|
|
||||||
- echo "$SSH_PRIVATE_BOT_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
|
||||||
|
|
||||||
- mkdir -p ~/.ssh
|
|
||||||
- chmod 700 ~/.ssh
|
|
||||||
|
|
||||||
- ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
|
|
||||||
- chmod 644 ~/.ssh/known_hosts
|
|
||||||
|
|
||||||
- git config --global user.email "info@famedly.com"
|
|
||||||
- git config --global user.name "Famedly Bot"
|
|
||||||
script:
|
|
||||||
- pub get
|
|
||||||
- pub run dapackages:dapackages.dart ./pubspec.yaml
|
|
||||||
- pub get
|
|
||||||
- git remote set-url --push origin git@gitlab.com:$CI_PROJECT_PATH
|
|
||||||
- 'git diff --exit-code || (git checkout -B ${UPDATE_BRANCH} && git add . && git commit -m "chore: Update dependencies" && git push -f origin ${UPDATE_BRANCH} && ./scripts/open-mr.sh)'
|
|
||||||
|
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# source: https://about.gitlab.com/blog/2017/09/05/how-to-automatically-create-a-new-mr-on-gitlab-with-gitlab-ci/
|
|
||||||
|
|
||||||
# Extract the host where the server is running, and add the URL to the APIs
|
|
||||||
[[ $HOST =~ ^https?://[^/]+ ]] && HOST="${BASH_REMATCH[0]}/api/v4/projects/"
|
|
||||||
|
|
||||||
# Look which is the default branch
|
|
||||||
TARGET_BRANCH=`curl --silent "${HOST}${CI_PROJECT_ID}" --header "PRIVATE-TOKEN:${PRIVATE_TOKEN}" | python3 -c "import sys, json; print(json.load(sys.stdin)['default_branch'])"`;
|
|
||||||
|
|
||||||
# The description of our new MR, we want to remove the branch after the MR has
|
|
||||||
# been closed
|
|
||||||
BODY="{
|
|
||||||
\"id\": ${CI_PROJECT_ID},
|
|
||||||
\"source_branch\": \"${UPDATE_BRANCH}\",
|
|
||||||
\"target_branch\": \"${TARGET_BRANCH}\",
|
|
||||||
\"remove_source_branch\": true,
|
|
||||||
\"title\": \"chore: automated dependency update\"
|
|
||||||
}";
|
|
||||||
|
|
||||||
# Require a list of all the merge request and take a look if there is already
|
|
||||||
# one with the same source branch
|
|
||||||
LISTMR=`curl --silent "${HOST}${CI_PROJECT_ID}/merge_requests?state=opened" --header "PRIVATE-TOKEN:${PRIVATE_TOKEN}"`;
|
|
||||||
COUNTBRANCHES=`echo ${LISTMR} | grep -o "\"source_branch\":\"${UPDATE_BRANCH}\"" | wc -l`;
|
|
||||||
|
|
||||||
# No MR found, let's create a new one
|
|
||||||
if [ ${COUNTBRANCHES} -eq "0" ]; then
|
|
||||||
curl -X POST "${HOST}${CI_PROJECT_ID}/merge_requests" \
|
|
||||||
--header "PRIVATE-TOKEN:${PRIVATE_TOKEN}" \
|
|
||||||
--header "Content-Type: application/json" \
|
|
||||||
--data "${BODY}";
|
|
||||||
|
|
||||||
echo "Opened a new dependency update MR."
|
|
||||||
exit;
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "No new merge request opened.";
|
|
||||||
Loading…
Reference in New Issue