replacing vsts with azurepipelines

This commit is contained in:
Preeti Bansal 2020-01-02 17:41:59 +05:30
Родитель dbc1ec057d
Коммит 49de6f7fdd
5 изменённых файлов: 25 добавлений и 25 удалений

Просмотреть файл

@ -3,7 +3,7 @@
set -e
AGENT_FOLDER="agent"
AZP_AGENT_VERSION="$(cat /vsts/agent/.agentVersion)"
AZP_AGENT_VERSION="$(cat /azurepipelines/agent/.agentVersion)"
AGENTVERSION="$(curl -s "https://api.github.com/repos/microsoft/azure-pipelines-agent/releases/latest" | jq -r .tag_name[1:])"
echo "Latest agent release version $AGENTVERSION"
@ -22,7 +22,7 @@ if [ $AGENTVERSION != $AZP_AGENT_VERSION ]; then
cd /azp/$AGENT_FOLDER
# Read download URL from the secret
AZP_DOWNLOAD_URL="$(cat /vsts/agent/.url)"
AZP_DOWNLOAD_URL="$(cat /azurepipelines/agent/.url)"
# Download the requested agent, else fall back to the version that was default when this was released
if [ -z "$AZP_DOWNLOAD_URL" ]; then
@ -45,8 +45,8 @@ trap 'cleanup; exit 143' TERM
echo "Mounting the .agent and .credentials files from a different source"
# /azurepipelines/agent is the default path change below lines if something else is set as mount path in CRD.
ln -fs /vsts/agent/.agent /azp/$AGENT_FOLDER/.agent
ln -fs /vsts/agent/.credentials /azp/$AGENT_FOLDER/.credentials
ln -fs /azurepipelines/agent/.agent /azp/$AGENT_FOLDER/.agent
ln -fs /azurepipelines/agent/.credentials /azp/$AGENT_FOLDER/.credentials
echo "Running Azure Pipelines agent..."

Просмотреть файл

@ -1,7 +1,7 @@
kind: Secret
apiVersion: v1
metadata:
name: vsts
name: azurepipelines
namespace: {{ .Values.app.namespace }}
labels:
app: {{ .Values.app.name }}

Просмотреть файл

@ -16,5 +16,5 @@ image:
tag: v1.25s
pullPolicy: IfNotPresent
vsts:
azurepipelines:
VSTS_SECRET: ""

Просмотреть файл

@ -44,22 +44,22 @@ func (c *AzurePipelinesPoolclient) AddNewPodForCR(obj *AzurePipelinesPool, label
spec := FetchPodSpec(obj, poolname)
// check if VolumeMounts is not present in the spec; then add the default one
if spec!=nil && len(spec.Containers) > 0 && spec.Containers[0].VolumeMounts == nil {
if spec != nil && len(spec.Containers) > 0 && spec.Containers[0].VolumeMounts == nil {
spec.Containers[0].VolumeMounts = append(spec.Containers[0].VolumeMounts, *getDefaultVolumeMount())
}
if spec != nil {
dep := &v1.Pod{
ObjectMeta: meta_v1.ObjectMeta{
Labels: labels,
GenerateName: "azure-pipelines-agent-",
},
Spec: *spec,
}
dep := &v1.Pod{
ObjectMeta: meta_v1.ObjectMeta{
Labels: labels,
GenerateName: "azure-pipelines-agent-",
},
Spec: *spec,
}
return dep
}
return nil
return dep
}
return nil
}
func (c *AzurePipelinesPoolclient) AddNewPodForCRTest(obj *AzurePipelinesPool, labels map[string]string, poolname string) *v1.Pod {
@ -70,10 +70,10 @@ func (c *AzurePipelinesPoolclient) AddNewPodForCRTest(obj *AzurePipelinesPool, l
GenerateName: "azure-pipelines-agent-",
},
Spec: v1.PodSpec{
Containers: []v1.Container {
Containers: []v1.Container{
{
Name: "vsts-agent",
Image: "prebansa/myagent:v1",
Name: "vsts-agent",
Image: "prebansa/myagent:v1",
},
},
},
@ -97,9 +97,9 @@ func FetchPodSpec(obj *AzurePipelinesPool, poolname string) *v1.PodSpec {
func getDefaultVolumeMount() *v1.VolumeMount {
return &v1.VolumeMount{
Name: "agent-creds",
MountPath: "/vsts/agent",
ReadOnly: true,
Name: "agent-creds",
MountPath: "/azurepipelines/agent",
ReadOnly: true,
}
}
}

Просмотреть файл

@ -334,7 +334,7 @@ func AddnewPodForCR(cr *devv1alpha1.AzurePipelinesPool) *corev1.Pod {
Name: "VSTS_SECRET",
ValueFrom: &corev1.EnvVarSource{
SecretKeyRef: &corev1.SecretKeySelector{
LocalObjectReference: corev1.LocalObjectReference{Name: "vsts"},
LocalObjectReference: corev1.LocalObjectReference{Name: "azurepipelines"},
Key: "VSTS_SECRET",
},
},