-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: enhance build process with docker authentication
Adds support for automatic docker authentication during the build process. If no credentials are found, the build will attempt to authenticate using the provided username, password, and destination registry. This ensures images can be pushed to private registries without manual setup. Additionally, refactors the Login command to use the new authentication helper method and adds placeholders for other commands. Updates the Dockerfile to include a shell command to keep the container running.
- Loading branch information
Showing
10 changed files
with
165 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Setting Up NFS-Compatible Storage for Azure DevOps Build Agents in AKS | ||
|
||
When running Docker builds with your own build agents in Azure DevOps within a Kubernetes cluster, like Azure Kubernetes Service (AKS), you'll need to prepare for some specific technical considerations. A common challenge is the AKS default storage drivers' lack of support for the Network File System (NFS), which can cause build process errors. | ||
|
||
## Understanding the Issue | ||
|
||
The default storage drivers in AKS often result in errors during Docker builds, such as: | ||
``` | ||
error: chmod on /azp/_work/1/s/.git/config.lock failed: Operation not permitted fatal: could not set 'core.filemode' to 'false'. | ||
``` | ||
These errors occur because the default storage options don't support certain filesystem operations, like changing file permissions or ownership, which are critical for tools like Git. | ||
|
||
## Solution: Enabling NFS-Compatible Storage | ||
|
||
To ensure Docker builds go smoothly within Kubernetes, it's recommended to use an NFS-compatible storage driver. NFS supports the shared access to files and directories that is essential for the interaction between the build agent and executing pods. | ||
|
||
### Step 1: Create an NFS Server | ||
|
||
Establish an NFS server, either self-managed or through a managed NFS service such as Azure Files. | ||
|
||
### Step 2: Configure the NFS Storage Class | ||
|
||
Introduce a new storage class in your Kubernetes cluster using the NFS provisioner to dynamically provision NFS-based persistent volumes. | ||
|
||
```yaml | ||
apiVersion: storage.k8s.io/v1 | ||
kind: StorageClass | ||
metadata: | ||
name: nfs-storage | ||
provisioner: kubernetes.io/nfs | ||
parameters: | ||
server: <NFS_SERVER_IP> | ||
path: /exported/path | ||
Step 3: Update the Build Agent Deployment | ||
Modify your build agent's deployment configuration to use the NFS storage class for persistent storage, ensuring the working directory is on an NFS-compatible volume. | ||
|
||
yaml | ||
Copy code | ||
|
||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: build-agent | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: build-agent | ||
image: your-build-agent-image | ||
volumeMounts: | ||
- name: work-dir | ||
mountPath: /azp/_work | ||
volumes: | ||
- name: work-dir | ||
persistentVolumeClaim: | ||
claimName: build-agent-pvc | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: build-agent-pvc | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
storageClassName: nfs-storage | ||
resources: | ||
requests: | ||
storage: 10Gi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters