Fix auth matrix and docker login.
Authorization by default will inherit the parent settings.
This has the side effect of ignoring the auth matrix.
For this reason we are injecting raw xml.
Docker plugin does not provide login feature.
Reverting back to the original approach.
Change-Id: Id3989a754c8a3145f3b175f93440cc45850d1af1
diff --git a/jjb/onf-macros.yaml b/jjb/onf-macros.yaml
index 4656c9c..794ce3d 100644
--- a/jjb/onf-macros.yaml
+++ b/jjb/onf-macros.yaml
@@ -33,13 +33,6 @@
days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '{artifact-num-to-keep}'
-- property:
- name: onf-infra-docker-properties
- properties:
- - docker-container:
- credentials-id: '{docker-credentials-id}'
- docker-registry-url: '{docker-registry}'
-
# trigger on gerrit patchsets and actions
# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
# Uses a regex based project match
diff --git a/jjb/shell/fabric-p4/fabric-p4-pre.sh b/jjb/shell/fabric-p4/fabric-p4-pre.sh
new file mode 100644
index 0000000..b317b50
--- /dev/null
+++ b/jjb/shell/fabric-p4/fabric-p4-pre.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+#
+# Copyright 2020-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Prebuild steps
+
+# exit on errors
+set +x -eu -o pipefail
+
+docker login --username ${DOCKERHUB_USERNAME} --password ${DOCKERHUB_PASSWORD}
diff --git a/jjb/templates/fabric-p4-verify.yaml b/jjb/templates/fabric-p4-verify.yaml
index 3fd2e00..8d1f01c 100644
--- a/jjb/templates/fabric-p4-verify.yaml
+++ b/jjb/templates/fabric-p4-verify.yaml
@@ -10,34 +10,33 @@
Runs fabric.p4 test pipeline
properties:
- - authorization:
- JenkinsPowerusers:
- - credentials-create
- - credentials-delete
- - credentials-manage-domains
- - credentials-update
- - credentials-view
- - job-build
- - job-cancel
- - job-configure
- - job-delete
- - job-discover
- - job-extended-read
- - job-move
- - job-read
- - job-workspace
- - run-delete
- - run-replay
- - run-update
- ONFStaff:
- - job-discover
- - job-read
+ - raw:
+ xml: |
+ <hudson.security.AuthorizationMatrixProperty>
+ <inheritanceStrategy class="org.jenkinsci.plugins.matrixauth.inheritance.NonInheritingStrategy"/>
+ <permission>com.cloudbees.plugins.credentials.CredentialsProvider.Create:JenkinsPowerusers</permission>
+ <permission>com.cloudbees.plugins.credentials.CredentialsProvider.Delete:JenkinsPowerusers</permission>
+ <permission>com.cloudbees.plugins.credentials.CredentialsProvider.ManageDomains:JenkinsPowerusers</permission>
+ <permission>com.cloudbees.plugins.credentials.CredentialsProvider.Update:JenkinsPowerusers</permission>
+ <permission>com.cloudbees.plugins.credentials.CredentialsProvider.View:JenkinsPowerusers</permission>
+ <permission>hudson.model.Item.Build:JenkinsPowerusers</permission>
+ <permission>hudson.model.Item.Cancel:JenkinsPowerusers</permission>
+ <permission>hudson.model.Item.Configure:JenkinsPowerusers</permission>
+ <permission>hudson.model.Item.Delete:JenkinsPowerusers</permission>
+ <permission>hudson.model.Item.Discover:JenkinsPowerusers</permission>
+ <permission>hudson.model.Item.Discover:ONFStaff</permission>
+ <permission>hudson.model.Item.ExtendedRead:JenkinsPowerusers</permission>
+ <permission>hudson.model.Item.Move:JenkinsPowerusers</permission>
+ <permission>hudson.model.Item.Read:JenkinsPowerusers</permission>
+ <permission>hudson.model.Item.Read:ONFStaff</permission>
+ <permission>hudson.model.Item.Workspace:JenkinsPowerusers</permission>
+ <permission>hudson.model.Run.Delete:JenkinsPowerusers</permission>
+ <permission>hudson.model.Run.Replay:JenkinsPowerusers</permission>
+ <permission>hudson.model.Run.Update:JenkinsPowerusers</permission>
+ </hudson.security.AuthorizationMatrixProperty>
- onf-infra-properties:
build-days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '-1'
- - onf-infra-docker-properties:
- docker-credentials-id: '{docker-credentials-id}'
- docker-registry: '{docker-registry}'
parameters:
- onf-infra-parameters:
@@ -91,6 +90,11 @@
- lf-infra-wrappers:
build-timeout: '30'
jenkins-ssh-credential: '{jenkins-ssh-credential}'
+ - credentials-binding:
+ - username-password-separated:
+ credential-id: docker-artifact-push-credentials
+ username: DOCKERHUB_USERNAME
+ password: DOCKERHUB_PASSWORD
builders:
- inject:
@@ -104,6 +108,7 @@
FABRIC_P4TEST_REPO={fabric_p4test_repo}
BMV2_RUN={bmv2_run}
TM_RUN={tm_run}
+ - shell: !include-raw-escape: ../shell/fabric-p4/fabric-p4-pre.sh
- shell: !include-raw-escape: ../shell/fabric-p4/fabric-p4-build-bmv2.sh
- shell: !include-raw-escape: ../shell/fabric-p4/fabric-p4-build-tofino.sh
- shell: !include-raw-escape: ../shell/fabric-p4/fabric-p4-p4test.sh