Externalize tokens for Danger, use correct base branch ref

This commit is contained in:
Andreas Dangel
2020-11-13 14:27:26 +01:00
parent be07f5b8c8
commit 7e35165c01
7 changed files with 13 additions and 17 deletions

View File

@@ -12,7 +12,7 @@ set -e
#set -x #set -x
function pmd_ci_build_main() { function pmd_ci_build_main() {
pmd_ci_setup_env pmd_ci_setup_private_env
pmd_ci_setup_gpg_key pmd_ci_setup_gpg_key
pmd_ci_setup_ssh pmd_ci_setup_ssh

View File

@@ -12,7 +12,7 @@
<servers> <servers>
<server> <server>
<id>ossrh</id> <id>ossrh</id>
<username>${env.CI_DEPLY_USER}</username> <username>${env.CI_DEPLOY_USER}</username>
<password>${env.CI_DEPLOY_PASSWORD}</password> <password>${env.CI_DEPLOY_PASSWORD}</password>
</server> </server>
</servers> </servers>

BIN
.ci/files/public-env.gpg Normal file
View File

Binary file not shown.

View File

@@ -5,11 +5,19 @@
# The functions here require the following environment variables: # The functions here require the following environment variables:
# PMD_SF_USER # PMD_SF_USER
# PMD_CI_BRANCH # PMD_CI_BRANCH
#
# DANGER_GITHUB_API_TOKEN
# PMD_CI_CHUNK_TOKEN
function regression_tester_setup_ci() { function regression_tester_setup_ci() {
# install openjdk8 for pmd-regression-tests # install openjdk8 for pmd-regression-tests
.ci/install-openjdk.sh 8 .ci/install-openjdk.sh 8
gpg --batch --yes --decrypt --passphrase="GnxdjywUEPveyCD1RLiTd7t8CImnefYr" \
--output .ci/files/public-env .ci/files/public-env.gpg
source .ci/files/public-env >/dev/null 2>&1
rm .ci/files/public-env
if hash "bundler" 2>/dev/null; then if hash "bundler" 2>/dev/null; then
log_debug "Bundler is already installed" log_debug "Bundler is already installed"
else else
@@ -17,11 +25,6 @@ function regression_tester_setup_ci() {
gem install bundler gem install bundler
fi fi
# Token for danger to add comments to PRs
export DANGER_GITHUB_API_TOKEN=f2f658fd5e72410e465104b65805dd7245479666
# Token for uploading reports to chunk.io
export PMD_CI_CHUNK_TOKEN="pmd:dMvJ1TH3oOl76QHf04EJ"
rm -f .bundle/config rm -f .bundle/config
bundle config set --local path vendor/bundle bundle config set --local path vendor/bundle
bundle config set --local with release_notes_preprocessing bundle config set --local with release_notes_preprocessing
@@ -38,9 +41,6 @@ function regression_tester_uploadBaseline() {
log_debug "$FUNCNAME branch=${PMD_CI_BRANCH}" log_debug "$FUNCNAME branch=${PMD_CI_BRANCH}"
local targetUrl="https://sourceforge.net/projects/pmd/files/pmd-regression-tester/" local targetUrl="https://sourceforge.net/projects/pmd/files/pmd-regression-tester/"
PMD_CI_BRANCH=${PMD_CI_BRANCH##refs/heads/}
log_debug "Using modified branch name: ${PMD_CI_BRANCH}"
local errexitstate="$(shopt -po errexit)" local errexitstate="$(shopt -po errexit)"
set +e # disable errexit set +e # disable errexit
( (
@@ -94,10 +94,6 @@ function regression_tester_executeDanger() {
set -e set -e
trap danger_failed ERR trap danger_failed ERR
PMD_CI_BRANCH=${PMD_CI_BRANCH##refs/heads/}
export PMD_CI_BRANCH
log_debug "Using modified branch name: ${PMD_CI_BRANCH}"
# Create a corresponding remote branch locally # Create a corresponding remote branch locally
if ! git show-ref --verify --quiet refs/heads/${PMD_CI_BRANCH}; then if ! git show-ref --verify --quiet refs/heads/${PMD_CI_BRANCH}; then
git fetch --no-tags origin +refs/heads/${PMD_CI_BRANCH}:refs/remotes/origin/${PMD_CI_BRANCH} git fetch --no-tags origin +refs/heads/${PMD_CI_BRANCH}:refs/remotes/origin/${PMD_CI_BRANCH}

View File

@@ -1,6 +1,6 @@
function pmd_ci_setup_env() { function pmd_ci_setup_private_env() {
log_info "Setting up secrets as environment variables..." log_info "Setting up secrets as environment variables..."
local -r ENV_FILE=.ci/files/env local -r ENV_FILE=.ci/files/private-env
printenv PMD_CI_SECRET_PASSPHRASE | gpg --batch --yes --decrypt \ printenv PMD_CI_SECRET_PASSPHRASE | gpg --batch --yes --decrypt \
--passphrase-fd 0 \ --passphrase-fd 0 \

View File

@@ -34,5 +34,5 @@ jobs:
shell: bash shell: bash
env: env:
MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3 MAVEN_OPTS: -Dmaven.wagon.httpconnectionManager.ttlSeconds=180 -Dmaven.wagon.http.retryHandler.count=3
PMD_CI_BRANCH: ${{ github.ref }} PMD_CI_BRANCH: ${{ github.event.base.ref }}
PMD_CI_PULL_REQUEST_NUMBER: ${{ github.event.number }} PMD_CI_PULL_REQUEST_NUMBER: ${{ github.event.number }}